Advertisement
Guest User

Untitled

a guest
Sep 13th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $Win32ShowWindowAsync = @{
  2.     Namespace = "Win32Functions"
  3.     Name = "Win32ShowWindowAsync"
  4.     Language = "CSharp"
  5.     MemberDefinition = @"
  6.         [DllImport("user32.dll")]
  7.         public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
  8. "@
  9. }
  10. IF (-not ("Win32Functions.Win32ShowWindowAsync" -as [type]))
  11. {
  12.     Add-Type @Win32ShowWindowAsync
  13. }
  14. $title = "*PowerShell*"
  15. Get-Process | Where-Object -FilterScript {$_.MainWindowHandle -ne 0} | ForEach-Object -Process {
  16.     IF ($_.MainWindowTitle -like $title)
  17.     {
  18.         [Win32Functions.Win32ShowWindowAsync]::ShowWindowAsync($_.MainWindowHandle, 6) | Out-Null
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement