Tools Links Login

PowerShell/WMI to Force Shutdown

You can use this PowerShell and WMI combo one-liner to force a shutdown or restart of a remote computer.

(Get-WmiObject -Class Win32_OperatingSystem -ComputerName $Computer).Win32Shutdowntracker(0, "This is a custom comment", 0x00000000, 6)

If you need to provide credentials, you can do something like this:

(Get-WmiObject -Class Win32_OperatingSystem -ComputerName $Computer -Credential $CustomCredentials).Win32Shutdowntracker(0, "This is a custom comment", 0x00000000, 6)

 

About this post

Posted: 2022-09-14
By: dwirch
Viewed: 224 times

Categories

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.