How to run a custom powershell script with elevated privileges in a playbook
Summary
How to run a custom PowerShell script with elevated privileges in a playbook
Issue
A custom PowerShell script that requires elevated privileges will not run, even if the credential profile has elevated privileges.
Instructions
- Upgrade the customer to
2.7 SP1 HF8or greater - In the action's Credential Profile, select a profile that has elevated privileges.
- Put this line of code at the start of the script, and paste the rest of the former script into the code block.
Invoke-WithImpersonation -ScriptBlock { #Insert code in here }