0

I followed the following link (Maximize window and bring it in front with powershell) instructions to make this happen but with internet explorer tab. Unfortunately it throws a few errors. Here is my code.

$sig = '[DllImport("user32.dll")] public static extern bool 
ShowWindowAsync(IntPtr hWnd, int nCmdShow);'
Add-Type -MemberDefinition $sig -name NativeMethods -namespace Win32
Stop-Process -Name iexplore -ea 0;iexplore.exe
$hwnd = @(Get-Process iexplore)[0].MainWindowHandle
# Minimize window
[Win32.NativeMethods]::ShowWindowAsync($hwnd, 2)
# Restore window
[Win32.NativeMethods]::ShowWindowAsync($hwnd, 4)

Throws the following errors:

    iexplore.exe : The term 'iexplore.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the 
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:3 char:35
+ Stop-Process -Name iexplore -ea 0;iexplore.exe
+                                   ~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (iexplore.exe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
D__
  • 25
  • 9

0 Answers0