简体   繁体   English

在远程会话中使用备用凭据启动进程

[英]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\\ . 我有一个像[myComputername]的提示:PS C:\\ Users \\ user \\ Then I try to Start-Process with another user, say domain\\user2. 然后我尝试与另一个用户进行Start-Process,比如domain \\ user2。 However it failed, although the executable path fed to the Start-Process is full under control of domain\\user2. 但是它失败了,尽管在域\\ user2的控制下,提供给Start-Process的可执行路径已满。 I suppose there is no permission problem on this. 我想这没有许可问题。 For example 例如

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

It wouldn't print the domain\\user2. 它不会打印域\\ 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 谢谢和问候,景飞

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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