Get-IpsJob.ps1
<# .SYNOPSIS Get the status of an Image Portability Service job. .DESCRIPTION Gets the status of an Image Portability Service job. .PARAMETER CustomerId Specifies the customer id of the Citrix customer running this command. .PARAMETER SecureClientId Specifies the client id of the Citrix customer's API client. .PARAMETER SecureSecret Specifies the client secret of the Citrix customer's API client. .PARAMETER JobId Specifies the id of the job to get the status of. .PARAMETER Deployment Specifies the service address to send the job request to. It defaults to api.layering.cloud.com. This can be used if necessary to send the request to a geo specific deployment such as api.eu.layering.cloud.com. .INPUTS None. .OUTPUTS PSCustomObject. The job status. .EXAMPLE PS> $CitrixCreds = @{ CustomerId = 'a7f4wb1example' SecureClientId = '7fed2a1e-1495-46b7-8fd3-5644764af395' SecureSecret = '9T.3Q~MGlnB6NNgpNUUWrcquVzODrdGK~eXampLe' } PS> Get-IpsJob @CitrixCreds -JobId fb067a8a-b20a-4889-ba3e-1ec580edd9c5 #> Function Get-IpsJob { [CmdletBinding()] Param( [Parameter(Mandatory = $true)] [string]$CustomerId, [Parameter()] [string]$SecureClientId, [Parameter()] [string]$SecureSecret, [Parameter(Mandatory = $true)] [string]$JobId, [Parameter()] [string]$Deployment, [Parameter(Mandatory = $false)] [string]$LogFileDir, [Parameter(Mandatory = $false)] [string]$LogFileName = 'GetIpsJob.log', [Parameter(Mandatory = $false)] [switch]$OverwriteLog ) Begin { Add-PSSnapin Citrix.* } Process { # Set parameter 'Verbose' by internal parameter 'VerbosePreference', since the option -Verbose is occupied by powershell cmdlet $Verbose = $VerbosePreference -eq 'Continue' LogInit $MyInvocation $LogFileDir $LogFileName $OverwriteLog $Verbose VersionCheck $Deployment $CustomerId $parameters = AuthToCitrixCloud $CustomerId $SecureClientId $SecureSecret if ([string]::IsNullOrWhiteSpace($SecureClientId) -Or [string]::IsNullOrWhiteSpace($SecureSecret)) { $SecureClientId = $parameters.ApiKey $SecureSecret = $parameters.SecretKey } $job = Invoke-CCRestMethod -method 'Get' -deployment $Deployment -serviceRoute "jobs/$JobId" -customerId $CustomerId -secureClientId $SecureClientId $SecureSecret -raw $true Write-Output $job } } |