Kaseya Community

Elevated Command Prompt Script?

This question is not answered

Hey everyone,
                       I been searching the web for a script to run an elevated command prompt as an administrator. Does anyone know how to do this. The reason I'm asking is I have a script to uninstall IE10 but it needs to be ran as an administrator. Not like a domain administrator or local administrator . Any answers or thoughts will be well apperciated. 


All Replies
  • Try one of these options and let me know if it works for you.

    1. Use an impersonateUser() statement before your executeShellCommand() to execute the shell command using a specified administrator account.

    2. Or set up the credentials on the machines using Agent>Set Credentials and then use an executeShellCommand() statement and set it's RunAs parameter to 'Execute as user'.

  • Run as SYSTEM and you won't need credentials at all. The Local System account trumps UAC and all of that madness.

  • There was one program that I had to also run as admin and get past UAC because it would not install as SYSTEM at all.

    I grabbed the psexec (technet.microsoft.com/.../bb897553.aspx) program from Microsoft and used

    #vAgentConfiguration.agentTempDir#\PsExec.exe /accepteula -u username -p password -h -e installer.exe /switches

    Funny enough the page for the psexec switches does not list -h switch but it is the elevated permissions switch for psexec