powershell远程显式启动exe文件


PowerShell交流中心分类: 远程管理powershell远程显式启动exe文件
极速蜗牛 管理员 提问于 2周 前

winserver服务器上有3个exe需要显式启动,平常都是手动启动的,现在想做成远程启动。
分别使用了2种方式来启动,exe都是以进程的方式启动
1.
$secpwd = convertto-securestring $password -asplaintext -force
$cred = new-object System.Management.Automation.PSCredential -argumentlist $account,$secpwd
$session_many = new-pssession -computername $computername -Credential $cred
Invoke-Command -Session $session_many -ThrottleLimit 1 -ScriptBlock {
start-process ‘C:\publish\Live\TranslateService\TranslateService.exe’ -Verb runas
sleep 2
start-process ‘C:\publish\Live\UpdateService\UpdateService.exe’ -Verb runas
}
2.
wmic /node:192.168.0.224 /user:TEST /password:111 process call create “cmd.exe /c C:\publish\Live\TranslateService\TranslateService.exe”

×用微信扫描并分享