How to impersonate a Windows domain account on the system account

Anonymous
2025-02-21T04:04:45+00:00

Hi,

I have the below Powershell command which is calling the SSM Parameter to get the domain username and password. then it start the application "Winrar" using the domain account. This works fine when i run it under the local administrator account.

Powershell script:

===========

$domain = (Get-SSMParameterValue -Name domainName).Parameters[0].Value

$username = (Get-SSMParameterValue -Name domainJoinUserName).Parameters[0].Value

$password = (Get-SSMParameterValue -Name domainJoinPassword -WithDecryption $True).Parameters[0].Value | ConvertTo-SecureString -asPlainText -Force $credential = New-Object System.Management.Automation.PSCredential('labdomain\admin',$password)

Start-Process -FilePath "C:\Program Files\WinRAR\Winrar.exe" -Credential $credential

Issue:

====

When i try to run the same command under the local system account. it throws the below error.

C:\Users\administrator>PsExec.exe -i -s %windir%\system32\WindowsPowerShell\v1.0\PowerShell_ISE.exe

 Start-Process : This command cannot be run due to the error: Access is denied.

At line:5 char:1

  • Start-Process 'C:\Program Files\WinRAR\Winrar.exe' -Credential $cr ...
  • 
    

    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException

    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand

Windows Server Remote and virtual desktops PowerShell

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question. To protect privacy, user profiles for migrated questions are anonymized.

0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2025-02-21T13:34:49+00:00

    Hello,

    This issue is beyond the scope of technical support on this forum, you can visit the Microsoft Q&A forum to inquire:

    Results in Microsoft Credentials - Training, Certification, and Program Support

    Best regards,

    Jingjing Wu

    0 comments No comments
  2. Anonymous
    2025-02-21T20:01:24+00:00

    Thank you i have submitted

    0 comments No comments