Powershell远程调用-命令启动-进程应用程序

00jrzges  于 2022-12-23  发布在  Shell
关注(0)|答案(1)|浏览(142)

我正在尝试使用powershell在远程服务器上安装应用程序。下面是我使用的脚本:

$Username = 'administrator'
$Password = 'Password'
$pass = ConvertTo-SecureString -AsPlainText $Password -Force
$Cred = New-Object System.Management.Automation.PSCredential -ArgumentList $Username,$pass
Invoke-Command -ComputerName "IP" -ScriptBlock {Start-Process -FilePath `"C:\Windows\notepad.exe" `} -credential $Cred
nhaq1z21

nhaq1z211#

我无法选择会话号,您只能运行会话0。

相关问题