Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $Win32ShowWindowAsync = @{
- Namespace = "Win32Functions"
- Name = "Win32ShowWindowAsync"
- Language = "CSharp"
- MemberDefinition = @"
- [DllImport("user32.dll")]
- public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
- "@
- }
- IF (-not ("Win32Functions.Win32ShowWindowAsync" -as [type]))
- {
- Add-Type @Win32ShowWindowAsync
- }
- $title = "*PowerShell*"
- Get-Process | Where-Object -FilterScript {$_.MainWindowHandle -ne 0} | ForEach-Object -Process {
- IF ($_.MainWindowTitle -like $title)
- {
- [Win32Functions.Win32ShowWindowAsync]::ShowWindowAsync($_.MainWindowHandle, 6) | Out-Null
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement