Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Enum ShowStates
- {
- Hide = 0
- Normal = 1
- Minimized = 2
- Maximized = 3
- ShowNoActivateRecentPosition = 4
- Show = 5
- MinimizeActivateNext = 6
- MinimizeNoActivate = 7
- ShowNoActivate = 8
- Restore = 9
- ShowDefault = 10
- ForceMinimize = 11
- }
- $V = Read-Host -Prompt 'Write in or paste the FQDN here'
- $ips = ([System.Net.Dns]::GetHostAddresses("$V")).IPAddressToString
- Start-Process 'notepad.exe'
- Sleep 1
- $wshell = New-Object -ComObject wscript.shell;
- $wshell.AppActivate('Untitled - Notepad')
- Sleep 1
- $wshell.SendKeys('FQDN:')
- $wshell.SendKeys('~')
- $wshell.SendKeys("$V")
- $wshell.SendKeys('~')
- $wshell.SendKeys('IP Address:')
- $wshell.SendKeys('~')
- $wshell.SendKeys("$ips") ; sleep 1
- $notePID = (Get-Process "notepad").Id
- $code = '[DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);'
- $type = Add-Type -MemberDefinition $code -Name myAPI -PassThru
- $process = Get-Process -Id $notePID
- $hwnd = $process.MainWindowHandle ; sleep 1
- $type::ShowWindowAsync($hwnd, [ShowStates]::Minimized)
Add Comment
Please, Sign In to add comment