【发布时间】:2018-11-20 09:30:07
【问题描述】:
我有一个场景,我需要远程重新启动计算机两次。 我的命令:
Invoke-Command -ComputerName $computerName -Credential $cred -ScriptBlock {
workflow Reboot {
Restart-Computer -Wait
Restart-Computer -Wait
}
Reboot
}
但这会返回错误
Failed to restart the computer com1 with the following error message: A system shutdown is in progress.
+ CategoryInfo : OperationStopped: (com1:String) [Restart-Computer], InvalidOperationException
+ FullyQualifiedErrorId : RestartcomputerFailed,Microsoft.PowerShell.Commands.RestartComputerCommand
+ PSComputerName : com1
【问题讨论】:
标签: powershell remote-access invoke-command