title: Not able to run exe from powershell for a system user
body: <p>I am trying to run an exe from powershell script on windows-7 64 bit machine. In this script I want to run exe as another user. It works when user invoking script is an actual user. But in my case, this powershell script will be executed from system user account and for system user script does not work. Here in a simple code I am using to open notepad. This code fails for system user.</p>
  
  <pre><code>$username = 'MyDomain\MyUser'
  $password = 'mypswd'
  $cred = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
  Start-Process -Credential $cred  "notepad.exe"
  </code></pre>
  
  <p>I have set execution policy to unrestricted. When I run this script for system user, then I get error as </p>
  
  <blockquote>
    <p>Start-Process : This command cannot be executed due to the error: Access is den
    ied.
    At D:\temp\trythis.ps1:4 char:14
    + Start-Process &lt;&lt;&lt;&lt;  -Credential $cred  "notepad.exe"
        + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOp
       erationException
        + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.C
       ommands.StartProcessCommand</p>
  </blockquote>
  
  <p>Is there any way in which I can run this script for system user?</p>