Elevated privileges


#1

Hi all,

I’ve wrote a powershell script which need administrator’s privileges to successfully run a Get-ClusterNode command. So i don’t know how to do it.

I have tried this:

[/settings/external scripts/scripts/check_as_user] check_hyperv_vm_load = cmd /c echo scripts\check_hyperv_vm_load.ps1; exit($lastexitcode) | powershell.exe -command - user = administrator password = My_Plain_Text_Password

But i have this error:

Unknown command(s): check_hyperv_vm_load

I have a workaround but i don’t like it. I run NSclient++ service as “administrator” instead of “Local System”.

So, i have 2 questions:

  • without change service user, how can i configure NSClient.ini to run a script as administrator ?
  • Can i use a crypted password ?

Many thanks for help.


#2

Oops, there are some errors. After correct these, i have used long format

[/settings/external scripts/scripts/check_hyperv_vm_load]
command = cmd /c echo scripts\check_hyperv_vm_load.ps1; exit($lastexitcode) | powershell.exe -command -
user = domain.local\\administrator
password = My_Plain_Text_Password

But now, i have this error:

Failed to login as domain.local\administrator: 52e: The user name or password is incorrect

Perhaps i don’t have to use Plain-text password. Even if i could use this, i would prefer using encrypted password. For now, i have to run the service as priviliged user.

Any help ?