Summary
It is possible to run a PowerShell script as another user without creating a separate script. The Task Scheduler command can be used to run the script as a different user
1
, or a function can be created that does what the script does and has the script as the input of the function.
1
Additionally, the Windows PowerShell can be used to ask for the user's credentials
2
, and a credential object can be stored in an invoke-command.
3
This allows non-administrators access to files.
According to