Utils/ServicePortal.ps1
<# .NOTES =========================================================================== Created with: SAPIEN Technologies, Inc., PowerShell Studio 2019 v5.6.157 Created on: 2/20/2019 22:59 Created by: jisodl0 Organization: Filename: ServicePortal.ps1 =========================================================================== .DESCRIPTION A collection of functions for interacting with the J. B. Hunt IT Service Portal. #> $ChromePath = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" $ServicePortalURL = "http://itrequests.jbhunt.com" <# .SYNOPSIS Opens an Incident Record in the J.B. Hunt IT Service Portal. .PARAMETER IRNumber The number of the IR to open. .EXAMPLE PS C:\> Open-IncidentRecord -IRNumber '5772012' #> function Open-IncidentRecord { [CmdletBinding()] [Alias('Open-IR', 'oir')] param ( [Parameter(Mandatory = $true, Position = 0)] [Alias('IR')] [String] $IRNumber ) if (($IRNumber.StartsWith("IR")) -eq $false -and $IRNumber.Length -eq 7) { $IRNumber = "IR$IRNumber" } Start-Process -FilePath $ChromePath -ArgumentList "$ServicePortalURL/Incident/Edit/$IRNumber" } <# .SYNOPSIS Opens a Change Record in the J.B. Hunt IT Service Portal. .PARAMETER CRNumber The number of the CR to open. .EXAMPLE PS C:\> Open-ChangeRecord -CRNumber '5772012' #> function Open-ChangeRecord { [CmdletBinding()] [Alias('Open-CR', 'ocr')] param ( [Parameter(Mandatory = $true, Position = 0)] [Alias('CR')] [String] $CRNumber ) if (($CRNumber.StartsWith("CR")) -eq $false -and $CRNumber.Length -eq 7) { $CRNumber = "CR$CRNumber" } Start-Process -FilePath $ChromePath -ArgumentList "$ServicePortalURL/ChangeRequest/Edit/$CRNumber" } <# .SYNOPSIS Opens a Service Record in the J.B. Hunt IT Service Portal. .PARAMETER SRNumber The number of the SR to open. .EXAMPLE PS C:\> Open-ServiceRecord -SR '5772012' #> function Open-ServiceRecord { [CmdletBinding()] [Alias('Open-SR', 'osr')] param ( [Parameter(Mandatory = $true, Position = 0)] [Alias('SR')] [String] $SRNumber ) if (($SRNumber.StartsWith("SR")) -eq $false -and $SRNumber.Length -eq 7) { $SRNumber = "SR$SRNumber" } Start-Process -FilePath $ChromePath -ArgumentList "$ServicePortalURL/ServiceRequest/Edit/$SRNumber" } |