Just would like to be able execute Powershell scripts as administrator.
This request was archived: Available in Product
I have been able to run scripts as admin using the executePowershellCommand64BitsSystem function. You also need to take in consideration that the script needs to be built to bypass any prompt, using the -force arguments when needed or -credentials as some scripts are still harder to execute than others.
You can also run as System and that should work so long as you have admin credentials set on the machine.
Also worth noting if you bind and agent credential then call UseCredential before your next steps then anything execuded as "user" would use the creds bound to the agent thus elevating if they have proper access. More often than not I just run it as system just be sure to either add the -force command or if you are using shell then powershell.exe -executionpolicy bypass -file C:\path\to\script.ps1