| 用途 | 远程重启/关机 |
|---|---|
| PowerShell | Restart-Computer -ComputerName host -Force |
| 传统命令 | shutdown /m \\host /r /t 0 /f |
| 确认 | Test-Connection / Test-NetConnection 轮询 |
常用示例
常用示例
Restart-Computer -ComputerName web01 -Force
# 无 PS 会话时
shutdown /m \\web01 /r /t 0 /f
# 等回线
while (-not (Test-Connection web01 -Count 1 -Quiet)) { Start-Sleep 5 }
Test-NetConnection web01 -Port 3389域控/集群/数据库节点重启前必须走变更窗口与依赖确认;重启“没回来”最常见原因是补丁安装失败回滚。