functions/Get-PrismStatus.ps1
<#
.SYNOPSIS Get the current status .DESCRIPTION Get the current printer status .PARAMETER ComputerName The host name or IP of your Prism .PARAMETER Session The session to your Prism, autocreated if not provided #> function Get-PrismStatus { param ( [Parameter(Mandatory)] [string] $ComputerName, [Parameter()] [microsoft.powershell.commands.webrequestsession] $Session ) $uri = "http://$ComputerName/status" if ($null -eq $Session) { $Session = New-PrismSession -ComputerName $ComputerName } $statusMessage, $file = (Invoke-RestMethod -Uri $uri -Method Get -WebSession $Session) -split '\s+' $status,$complete,$eta = $statusMessage -split ',' [PSCustomObject]@{ Status = if ($status -eq 'P') { 'Printing' } elseif ($status -eq 'I') { 'Idle' } else { 'Unknown' } Layer = $complete TimeRemaining = $eta -as [timespan] FileName = $file } } |