mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-22 16:03:22 +01:00
Add minimize-all-windows.ps1
This commit is contained in:
parent
263433a80b
commit
6da9a90a3e
@ -11,7 +11,6 @@
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
|
||||
try {
|
||||
Invoke-CimMethod -ClassName Win32_Operatingsystem -MethodName Win32Shutdown -Arguments @{ Flags = 0 }
|
||||
exit 0 # success
|
||||
|
21
Scripts/minimize-all-windows.ps1
Normal file
21
Scripts/minimize-all-windows.ps1
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user