GenXdev.Windows
A Windows PowerShell module that provides ui Windows manipulation helpers
* ✅ Allow resizing/repositioning/closing of Windows
* ✅ Read/write access to Windows special folder locations
Install-Module "GenXdev.Windows"
Import-Module "GenXdev.Windows"
Update-Module
Command | aliases | Description |
---|---|---|
Get-Window | Returns a window helper for the main window of the specified process | |
Set-KnownFolderPath | Sets a known folder's path using SHSetKnownFolderPath. | |
Get-KnownFolderPath | Gets a known folder's path using SHGetKnownFolderPath. | |
Get-DesktopScalingFactor | Returns the scaling factor that is configured for a monitor | |
Set-TaskbarAlignment | Sets the alignment for the Windows 11+ Taskbar | |
Get-PowershellMainWindow | Returns a window helper object for the mainwindow of the process responsible for hosting the Powershell terminal | |
Get-PowershellMainWindowProcess | Returns the process of the window responsible for hosting the Powershell terminal | |
Set-WindowPosition | wp | Positions a window in a configurable manner, using commandline switches |
Set-WindowPositionForSecondary | wps | Positions a window like Set-WindowPosition -> wp but defaults to the configured secondairy monitor |
Copy-SetWindowPositionParameters | The dynamic parameter block of a proxy function. This block can be used to copy a proxy function target's parameters . | |
Start-ProcessWithPriority | nice | |
Initialize-ScheduledTaskScripts | Creates daily and hourly PowerShell scripts and their corresponding scheduled task that will runas current-user and it's PowerShell profile |
Get-Window
Returns a window helper for the main window of the specified process
Get-Window [-ProcessName] <String> [<CommonParameters>]
Returns a window helper for the main window of the specified process
-ProcessName <String>
The process to get the window helper for
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
Set-KnownFolderPath
Sets a known folder's path using SHSetKnownFolderPath.
Set-KnownFolderPath [-KnownFolder] <String> [-Path] <String> [<CommonParameters>]
Sets a known folder's path using SHSetKnownFolderPath.
-KnownFolder <String>
The known folder whose path to set.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Path <String>
The path.
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
Get-KnownFolderPath
Gets a known folder's path using SHGetKnownFolderPath.
Get-KnownFolderPath [-KnownFolder] <String> [<CommonParameters>]
Gets a known folder's path using SHGetKnownFolderPath.
-KnownFolder <String>
The known folder whose path to get.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
Get-DesktopScalingFactor
Returns the scaling factor that is configured for a monitor
Get-DesktopScalingFactor [[-monitor] <Int32>] [<CommonParameters>]
Returns the scaling factor that is configured for a monitor
-monitor <Int32>
The monitor to return the scaling factor for, or if not supplied the primary monitor is
used
Required? false
Position? 1
Default value 0
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
Set-TaskbarAlignment
Sets the alignment for the Windows 11+ Taskbar
Set-TaskbarAlignment [-Justify] <Object> [<CommonParameters>]
Sets the alignment for the Windows 11+ Taskbar
-Justify <Object>
The new alignment
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
Get-PowershellMainWindow
Returns a window helper object for the mainwindow of the process responsible for hosting
the Powershell terminal
Get-PowershellMainWindow [<CommonParameters>]
Returns a window helper object for the mainwindow of the process responsible for hosting
the Powershell terminal
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
Get-PowershellMainWindowProcess
Returns the process of the window responsible for hosting the Powershell terminal
Get-PowershellMainWindowProcess [<CommonParameters>]
Returns the process of the window responsible for hosting the Powershell terminal
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
Set-WindowPosition --> wp
Positions a window
Set-WindowPosition [[-Process] <Process[]>] [-Monitor <Int32>] [-NoBorders] [-Width
<Int32>] [-Height <Int32>] [-X <Int32>] [-Y <Int32>] [-Left] [-Right] [-Top] [-Bottom]
[-Centered] [-RestoreFocus] [-PassThrough] [<CommonParameters>]
Positions a window in a configurable manner, using commandline switches
-Process <Process[]>
The process of the window to position
Required? false
Position? 1
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false
-Monitor <Int32>
The monitor to use, 0 = default, 1 = secondary, -1 is discard
Required? false
Position? named
Default value -1
Accept pipeline input? false
Accept wildcard characters? false
-NoBorders [<SwitchParameter>]
Open in NoBorders mode --> -nb
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Width <Int32>
The initial width of the window
Required? false
Position? named
Default value -1
Accept pipeline input? false
Accept wildcard characters? false
-Height <Int32>
The initial height of the window
Required? false
Position? named
Default value -1
Accept pipeline input? false
Accept wildcard characters? false
-X <Int32>
The initial X position of the window
Required? false
Position? named
Default value -1
Accept pipeline input? false
Accept wildcard characters? false
-Y <Int32>
The initial Y position of the window
Required? false
Position? named
Default value -1
Accept pipeline input? false
Accept wildcard characters? false
-Left [<SwitchParameter>]
Place window on the left side of the screen
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Right [<SwitchParameter>]
Place window on the right side of the screen
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Top [<SwitchParameter>]
Place window on the top side of the screen
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Bottom [<SwitchParameter>]
Place window on the bottom side of the screen
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Centered [<SwitchParameter>]
Place window in the center of the screen
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-RestoreFocus [<SwitchParameter>]
Restore PowerShell window focus --> -bg
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-PassThrough [<SwitchParameter>]
Returns a [System.Diagnostics.Process] object of the browserprocess
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
Set-WindowPositionForSecondary --> wps
Positions a window and positions it by default on the secondairy monitor
Set-WindowPositionForSecondary [[-Monitor] <Int32>] [<CommonParameters>]
Positions a window like Set-WindowPosition -> wp but defaults to the configured secondairy
monitor
-Monitor <Int32>
The monitor to use, 0 = default, 1 = secondary, -1 is discard
Required? false
Position? 1
Default value -2
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
Copy-SetWindowPositionParameters
Proxy function dynamic parameter block for the Set-WindowPosition cmdlet
Copy-SetWindowPositionParameters [[-ParametersToSkip] <String[]>] [<CommonParameters>]
The dynamic parameter block of a proxy function. This block can be used to copy a proxy
function target's parameters .
-ParametersToSkip <String[]>
Required? false
Position? 1
Default value @()
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
Start-ProcessWithPriority --> nice
Start-ProcessWithPriority [-FilePath] <string> [[-ArgumentList] <string[]>] [[-Priority]
{Idle | BelowNormal | Low | Normal | AboveNormal | High | RealTime}] [-noWait]
[<CommonParameters>]
-ArgumentList <string[]>
Required? false
Position? 1
Accept pipeline input? false
Parameter set name (All)
Aliases None
Dynamic? false
Accept wildcard characters? false
-FilePath <string>
Required? true
Position? 0
Accept pipeline input? false
Parameter set name (All)
Aliases None
Dynamic? false
Accept wildcard characters? false
-Priority <string>
Required? false
Position? 2
Accept pipeline input? false
Parameter set name (All)
Aliases None
Dynamic? false
Accept wildcard characters? false
-noWait
Required? false
Position? Named
Accept pipeline input? false
Parameter set name (All)
Aliases None
Dynamic? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
Initialize-ScheduledTaskScripts
Creates daily and hourly PowerShell scripts and their corresponding scheduled tasks
Initialize-ScheduledTaskScripts [[-FilePath] <String>] [[-Prefix] <String>]
[<CommonParameters>]
Creates daily and hourly PowerShell scripts and their corresponding scheduled task that
will run
as current-user and it's PowerShell profile
-FilePath <String>
Optionally the path of the directory where the scripts will reside
Defaults to [ProfileDir]\ScheduledTasks
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Prefix <String>
Optionally a unique prefix for the Scheduled-Task names
Defaults to 'PS'
Required? false
Position? 2
Default value PS
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).