简体   繁体   中英

Start-Process with alternative credential in a remote session

all, I believe this scenario sounds indeed odd, but I do need your help on this. First I use

Enter-PSSession -ComputerName myComputerName -Credential domain\\user1

to remote to a third machine from my dev machine. I got a prompt like [myComputername]: PS C:\\Users\\user\\ . Then I try to Start-Process with another user, say domain\\user2. However it failed, although the executable path fed to the Start-Process is full under control of domain\\user2. I suppose there is no permission problem on this. For example

Start-Process -FilePath powershell -ArgumentList "-command " & {whoami} "" -Credential domain\\user2 -WorkingDirectory workingdirectory

It wouldn't print the domain\\user2. And it would if you run this command after remote desktop to the test machine. Anyone knows the root cause and the fix of this? Thanks & Regards, Jingfei

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM