PowerShell/WMI to Force Shutdown

By | 2022-09-14

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)

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.