Open Windows Shutdown Dialog

by Feb 3, 2022

Here is a one-liner that opens the Windows shutdown dialog:

(New-Object -ComObject Shell.Application).ShutdownWindows()

And with this one-liner, it turns into a new command named “bye”:

function bye { (New-Object -ComObject Shell.Application).ShutdownWindows() } 

If you place this line in your automatic profile (start) script located in $profile (you may have to create the file initially), when you are done scripting you can now simply type “bye” to shut down your Windows session.

Twitter This Tip! ReTweet this Tip!