Add minimize-all-windows.ps1

This commit is contained in:
Markus Fleschutz 2022-06-09 16:20:56 +02:00
parent 263433a80b
commit 6da9a90a3e
2 changed files with 21 additions and 1 deletions

View File

@ -11,7 +11,6 @@
Author: Markus Fleschutz | License: CC0
#>
try {
Invoke-CimMethod -ClassName Win32_Operatingsystem -MethodName Win32Shutdown -Arguments @{ Flags = 0 }
exit 0 # success

View File

@ -0,0 +1,21 @@
<#
.SYNOPSIS
Minimizes all windows
.DESCRIPTION
This PowerShell script minimizes all open windows.
.EXAMPLE
PS> ./minimize-all-windows
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
$shell = New-Object -ComObject "Shell.Application"
$shell.minimizeall()
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}