且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用 PowerShell 2.0 在远程计算机上运行批处理文件

更新时间:2022-12-23 09:27:43

这个命令应该能成功执行:

This command should execute successfully:

Invoke-Command -ComputerName $client -ScriptBlock { cd C:\Windows\System32\ccmsetup; ccmsetup /uninstall} -Credential $(Get-Credential) -Authentication CredSSP

但是您需要通过在每台机器上运行这两个命令来在所有机器上启用 CredSSP 身份验证:

but you will need to enable CredSSP authentication on all machines by running these two commands on each machine:

Enable-WsManCredSSP -Role Server -Force
Enable-WSManCredSSP -Role Client -DelegateComputer * -Force