functions/Get-PrismProfile.ps1
<#
.SYNOPSIS List all profiles .DESCRIPTION List all printer profiles, optionally filter by ID .PARAMETER ComputerName The host name or IP of your Prism .PARAMETER Session The session to your Prism, autocreated if not provided .PARAMETER Index Integer-based index between 1 and 7 that you want to retrieve .EXAMPLE Get-PrismProfile List all profiles #> function Get-PrismProfile { [CmdletBinding()] param ( [Parameter()] [string] $ComputerName = (Get-PrismPrinter).IPAddress, [Parameter()] [microsoft.powershell.commands.webrequestsession] $Session, [Parameter()] [ValidateRange(1,7)] [uint16] $Index ) $uri = "http://$ComputerName/user/{0}.conf" if ($null -eq $Session) { $Session = New-PrismSession -ComputerName $ComputerName } foreach ($i in (1..7)) { if ($Index -and $i -ne $Index) { Write-PSFMessage -String 'GetPrismProfile.FilterIndex' -StringValues $ComputerName, $Index, $i continue } $profileData = Invoke-RestMethod -Uri ($uri -f $i) -Method Get -WebSession $Session if ($profileData -is [System.String]) { continue } $profileData } } |