Running a .ps1-Script on a Windows agent as administrator

Hello,

the title basically says it all already:

I have an Icinga agent all set up on a Windows WSUS and need to run a local .ps1-script on this machine for my check to return the needed data. For this to work I would need to run the script from an administrator context. Is this possible via the agent?

Hi,

since Windows doesn’t have the concept of “sudo”, you’ll need to modify the service user for the Icinga service to one with elevated permissions.

Cheers,
Michael

Hi, its not working for everything, and maybe its not the most secure way, but you could use get-credentials and then export the credentials for reuse in the script. The password will be stored in an encrypted file that is only readable by the user on the same machine. With this credentials you can execute thing with different users.

I think this is the best way to go for the stated use-case, I stumbled across new problems, but that’s on our end and not Icinga’s ^^