Powershell to get list of hosts

This is very promising - thanks.
I have two items though.

  1. I had to add -UseBasicParsing in the line below due to a message about Internet Explorer. I’m not sure if this will affect anything, or more specifically #2 below. I have another script where I interrogate webpages where I had to do this with no other issues.

$result = Invoke-WebRequest -Uri $URI -Method Post -Body $postParams -UseBasicParsing

  1. I’m getting a web response of:
    StatusCode : 200
    StatusDescription : OK
    Content : ERROR: Invalid automation secret for user myusername

I 100% know that the password I’m using is correct.
I assume $mycheckmkuser and $mycheckmsecret are to be set with the username and password I use to log into CheckMK.

I don’t know how to get past this issue.

1 Like