Hard worker
Hard worker

Reputation: 4056

Powershell cmd to restart machine isn't working

I have this setup as a scheduled task in windows to run this batch file:

powershell.exe restart-computer
EXIT

Powershell is working as other commands work.

The task returns 0x1 which I believe means a failure relating to permissions?

I run the task with the option to run it when I'm logged in or not and with highest privileges.

When I type restart-computer in powershell it works.

Upvotes: 0

Views: 2887

Answers (1)

user4665026
user4665026

Reputation:

Have you tried using the -force parameter?

powershell.exe restart-computer -force

Upvotes: 1

Related Questions