-
Notifications
You must be signed in to change notification settings - Fork 74
Closed
Description
Running as system administrator, impersonating a user doesn't work. I expect whoami to return 'MyUser'.
PS C:\windows\system32> whoami
nt authority\system
PS C:\windows\system32> $user="MyUser"
PS C:\windows\system32> $pass="MyPass"
PS C:\windows\system32> $secpass = ConvertTo-SecureString $pass -AsPlainText -Force
PS C:\windows\system32> $cred = New-Object System.Management.Automation.PSCredential $user,$secpass
PS C:\windows\system32> Invoke-CommandAs -ScriptBlock { whoami } -AsUser $cred
nt authority\system
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels