- 1 year ago
Can't run Start-Process with RunAsUser from .ps1 file
If you are unable to run Start-Process
with RunAsUser
from a .ps1
file, it could be due to a few different reasons:
Execution Policy: PowerShell has an "Execution Policy" that controls which scripts can be run on a system. If the execution policy is set to "Restricted", scripts cannot be run at all. Try running the following command to set the execution policy to "RemoteSigned":
javascriptSet-ExecutionPolicy RemoteSigned
Permissions: The user account that is running the script may not have the necessary permissions to execute the
RunAsUser
command. Ensure that the user account has administrative privileges, and that the PowerShell session is running as an administrator.Syntax error: Check that the syntax of your
Start-Process
command is correct, and that all required parameters are included.Compatibility: Some versions of PowerShell may not support the
RunAsUser
parameter forStart-Process
. Ensure that you are running a version of PowerShell that supports this parameter.Security software: Some security software may block the
RunAsUser
parameter or other PowerShell commands. Check if any security software is running on the system and try temporarily disabling it to see if that resolves the issue.
If none of these solutions work, you may need to provide more information about the error message or behavior you are encountering in order to diagnose the issue further.