具有凭据的Powershell启动过程将永远运行

时间:2019-12-03 08:49:11

标签: powershell credentials hang windows-server-2016 start-process

我在Powershell中使用start-process命令时遇到问题,当使用-credentials参数时,Powershell_ISE会永远运行,但永远不会结束。

问题似乎出在一台服务器上,所以当我在此特定服务器(Windows Server 2016)上运行它时,Powershell_ISE会永远运行,而我无法停止它,那么它只会陷入停止模式。

当我在另一台服务器上的Powershell_ISE中运行完全相同的行时,它运行时没有任何问题。

在出现问题的服务器上,我尝试使用新创建的帐户来确保其不是与个人资料相关的问题。

我已将执行策略设置为不受限制。 是的,我以管理员身份运行Powershell_ISE。

    Set-ExecutionPolicy Unrestricted

    $username = "DOMAIN\USERNAME"
    $password = "PASSWORD"
    $Password = ConvertTo-SecureString “$password” -AsPlainText -Force

    $Credentials = New-Object System.Management.Automation.PSCredential ($username, $Password)

    Start-Process Notepad.exe -Credential $Credentials

Notepad.exe的使用只是用于测试,我在另一件事中使用了此功能,但不适用于任何进程。

我必须将此服务器用于此功能,其原因是该服务器正在生产中的IIS中托管RDS工具。

有人知道这可能是什么原因吗?

0 个答案:

没有答案