powershell - 如何使用PowerShell关闭计算机?

标签 powershell

我想在脚本中执行关机过程。
我使用Stop-Computer。但是它总是重新启动,不会关闭。我单独尝试了stop-computer,它可以工作,但是当我将其应用于脚本时,它会重新启动,没有关闭,任何人都可以提出任何想法吗?

最佳答案

引用stop-computer,您可以使用-Force强制立即关闭计算机。

stop-computer -computername localhost -Force

关于powershell - 如何使用PowerShell关闭计算机?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64567499/

相关文章:

powershell - 如何使用 Windows Powershell 提取嵌套文件夹中的所有 zip 文件

wpf - 如何在 PowerShell ISE 中使用 WPF DataGrid (.Net 4.0)?

windows - 如何在 Windows 上的 powershell 上执行 sudo

java - 用于检查虚拟机是否崩溃的 Powershell 脚本

sql-server - 使用 Powershell 设置 SQL Server 'Maximum server memory in (MB)'

sql-server - 为什么FORMAT无法与expandproperty一起使用

powershell - 在PowerShell中在屏幕上和文件中显示输出

php - exec ('script.ps1' ) 返回错误,cmd> script.ps1 运行成功

powershell - 从多台计算机获取 WMI 数据并导出为 CSV

regex - 如何用powershell替换每行的第一部分和最后一部分