Techibee.com

PowerShell: Minimize all windows

Have you ever got a requirement to minimize all windows on the desktop using powershell script? It is helpful when you want to give a pop-up message to user which should draw their immediate attention.

I came across this little tip while exploring shell.application com object. It has other useful functions like undominimizeall, cascade windows, and many other explorer functions.

$shell = New-Object -ComObject "Shell.Application"
$shell.minimizeall()

You can also undo minimize all windows by using below code.

$shell = New-Object -ComObject "Shell.Application"
$shell.undominimizeall()

To see the clear functionality, add some delay between minimizeall() function and undominimizeall() function.

$shell = New-Object -ComObject "Shell.Application"
$shell.MinimizeAll()
start-sleep -Seconds 5
$shell.undominimizeall()

Hope this helps… You can explore more functions of shell.application object by using below code snippet.

New-Object -ComObject "Shell.Application" | gm | select Name, MemberType
Exit mobile version