-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathHiddenProcess.ps1
More file actions
25 lines (25 loc) · 816 Bytes
/
Copy pathHiddenProcess.ps1
File metadata and controls
25 lines (25 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Add-Type @'
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
'@ -name “Win32ShowWindowAsync” -namespace Win32API
Function Set-ProcessWindowStyle
{
param(
[Parameter(
Mandatory=$true,
ValueFromPipeline=$true)]
[System.Diagnostics.Process]$Process,
[ValidateSet("Show", "Minimized","Maximized","Hidden")]
[string]$WindowStyle="Show"
)
$WinStateInt = 1
switch($WindowState)
{
"Hidden" {$WinStateInt = 0}
"Show" {$WinStateInt = 1}
"Maximize" {$WinStateInt = 3}
"Minimize" {$WinStateInt = 6}
}
[Win32API.Win32ShowWindowAsync]::ShowWindowAsync($Process.MainWindowHandle,$WindowState)
}
Get-Process iexplore | Set-ProcessWindowStyle -WindowStyle Hidden