diff --git a/samy.ps1 b/samy.ps1 index 3fb2cab..6e76669 100644 --- a/samy.ps1 +++ b/samy.ps1 @@ -1928,15 +1928,17 @@ function Get-SamyClientListFromServer { [Parameter(Mandatory)] [string]$Uri, - [Parameter(Mandatory)] - [string]$Password + [Parameter(Mandatory=$false)] + [AllowEmptyString()] + [string]$Password = "" ) try { Write-LogHybrid "Calling client list service at $Uri" Info Printers -LogToEvent - $headers = @{ - SAMYPW = $Password + $headers = @{} + if (-not [string]::IsNullOrEmpty($Password)) { + $headers.SAMYPW = $Password } $resp = Invoke-RestMethod -Uri $Uri ` @@ -1990,11 +1992,8 @@ function Invoke-GetPrinters { } $password = $body.password - if (-not $password) { - $Context.Response.StatusCode = 400 - Send-Text $Context 'Password is required.' - return - } + if ($null -eq $password) { $password = "" } # allow blank + $uri = 'https://bananas.svstools.ca/getprinters' Write-LogHybrid "Fetching printers from $uri" Info Printers -LogToEvent