Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Start-Process with alternative credential in a remote session

$
0
0

Hi, 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 toStart-Process with another user, say domain\user2. However it failed, although the executable path fed to theStart-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


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>