用于重启机器的 Powershell cmd 无法正常工作

Powershell cmd to restart machine isn't working

我在 windows 到 运行 这个批处理文件中将此设置作为计划任务:

powershell.exe restart-computer
EXIT

Powershell 正在像其他命令一样工作。

我认为任务 returns 0x1 意味着与权限相关的失败?

我 运行 任务可以选择 运行 当我登录或不登录并具有最高权限时。

当我在 powershell 中键入 restart-computer 时,它起作用了。

您是否尝试过使用 -force 参数?

powershell.exe restart-computer -force