3

in our environment we have the requirement to open a website in background. The user should not notice anything.

I've tried it via the following Powershell command, but it isn't working:

Start-Process -WindowStyle Hidden "C:\Program Files\Internet Explorer\iexplore.exe" "www.google.com" 

Operating system is Windows 10 Enterprise LTSB. Is there any other solution?

Thanks in advance!

peeebeee
  • 2,541
  • 6
  • 21
  • 26
Patrick Grebe
  • 111
  • 2
  • 14

3 Answers3

2

Use Minimized for the win stile:

Start-Process -WindowStyle Minimized "C:\Program Files\Internet Explorer\iexplore.exe" "www.google.com" 

What is the point to open web site as background process. That is very bad architecture.

autosvet
  • 869
  • 1
  • 9
  • 17
  • `-WindowStyle Hidden`? – stuartd Dec 20 '17 at 14:47
  • We have a custom sharepoint site which generates a qr code from list data and sends this to a dymo label writer printer. We pass some data via the URL to the js code which is embedded in the sp site. This should happen in the background. – Patrick Grebe Dec 20 '17 at 14:48
0

This opens a window minimized:

$browserurl = 'https://stackoverflow.com/questions/47908413/open-a-website-in-background'
$p = [System.Diagnostics.Process]::new()
$P.StartInfo.Arguments = [string]::Format("{0}{1}", "-nomerge ", $browserurl)
$P.StartInfo.WindowStyle = [System.Diagnostics.ProcessWindowStyle]::Minimized
$P.StartInfo.CreateNoWindow = $true
$P.StartInfo.UseShellExecute = $true
$P.StartInfo.FileName = "iexplore.exe"
$P.Start()

I got this code from this C# post.. It has another link to working with IE's Com objects. Opening a Hidden Internet Explorer Window without it getting Focus?

Thom Schumacher
  • 1,469
  • 13
  • 24
0

Realised it via Google Chrome Portable and the following AutoIT-Script:

#include <Constants.au3>

_Start_Minimized_Chrome()

Func _Start_Minimized_Chrome()

Local $chrome = ShellExecute("C:\chrome\GoogleChromePortable.exe", '"https://website.com"')

WinWait("[CLASS:Firefox_WidgetWin_1]", "")
Local $WinList = WinList()
For $i = 1 To $WinList[0][0]
    If $WinList[$i][0] <> "" And StringInStr($WinList[$i][0], " - Mozilla Firefox", 1) Then WinSetState($WinList[$i][1], "", @SW_HIDE)
    Next
EndFunc   ;==>_Start_Minimized_Chrome
Patrick Grebe
  • 111
  • 2
  • 14