Jump to content

Dan P

Members
  • Posts

    1
  • Joined

  • Last visited

  1. I have what was a working PowerShell script to get a list of all my systems in Pulseway. It is no longer working. I am getting a 200 response, just no data. I even tried to replicate it in Node JS since there is official documentation for it, but I get the same response - 200 but no data. $username = 'administrator' $password = '*************' #Adding credentials to header $header = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($username):$($password)")) } #Call API to return first 100 systems - calls are limited to 100 results $first100 = Invoke-RestMethod -uri https://xxxxxxxxxxxx.pulseway.com/api/v2/systems -Method GET -Header $header -ContentType "application/json" #Call API to return second 100 systems using offset of 100 as a query $second100 = Invoke-RestMethod -uri https://xxxxxxxxxxx.pulseway.com/api/v2/systems?offset=100 -Method GET -Header $header -ContentType "application/json" #Create and calculate variable for total number of systems counted $total = 0 $total += $first100.data.length $total += $second100.data.length Foreach ($r in $first100.data) { If ($r.name[6] -match "-" -and $r.group -match "US Workstations") { Write-Host $r.name } } Foreach ($r in $second100.data) { If ($r.name[6] -match "-" -and $r.group -match "US Workstations") { Write-Host $r.name }
×
×
  • Create New...