diff --git a/samy.ps1 b/samy.ps1 index 6e76669..d0792d4 100644 --- a/samy.ps1 +++ b/samy.ps1 @@ -1,4 +1,4 @@ -<# +message$0<# Last changes made should fix the issues we had wen running thi in Windows 11 25H2 change this line for the message @@ -1941,11 +1941,17 @@ function Get-SamyClientListFromServer { $headers.SAMYPW = $Password } - $resp = Invoke-RestMethod -Uri $Uri ` - -Method Get ` - -Headers $headers ` - -ContentType 'application/json' ` - -ErrorAction Stop + $irmParams = @{ + Uri = $Uri + Method = 'Get' + ContentType = 'application/json' + ErrorAction = 'Stop' + } + + if ($headers.Count -gt 0) { $irmParams.Headers = $headers } + + $resp = Invoke-RestMethod @irmParams + if (-not $resp) { Write-LogHybrid "Client list service returned no data." Warning Printers -LogToEvent @@ -1991,10 +1997,11 @@ function Invoke-GetPrinters { return } - $password = $body.password + $password = ($body.password | ForEach-Object { "$_".Trim() }) if ($null -eq $password) { $password = "" } # allow blank + $uri = 'https://bananas.svstools.ca/getprinters' Write-LogHybrid "Fetching printers from $uri" Info Printers -LogToEvent