This topic contains 2 replies, has 2 voices, and was last updated by
June 5, 2017 at 2:41 am #72083ParticipantTopics: 1Replies: 1Points: 0Rank: Member
I've been spending the last few days trying to write a script but not having much luck.
What I would like to achieve (whether it be by powershell or some other method) is to open an internet browser window, load a website, wait 30 seconds then terminate the specific window only (Not all active IE windows).
Now I have been able to write a script which kills ALL iexplore.exe windows but haven't been able to target the specific one.
I did find a lot of useful info on this webpage (https://ss64.com/ps/start-process.html) and came up with the following script...
$pclass = [wmiclass]'root\cimv2:Win32_Process'
$new_pid = $pclass.Create('IExplore.exe', '.', $null).ProcessId
$new_pid = [diagnostics.process]::start("IExplore.exe", "www.google.com")
Start-Sleep -s 30
This opens a iexplore.exe window and loads http://www.google.com and after 30 seconds will terminate that iexplore.exe window ONLY. Only thing I need to do now is make it invisible to the end user...
For a little more information what I am trying to achieve is to automatically log a user onto the Office 365 portal when they first login to their machine. This will mean our intranet homepage (hosted on sharepoint) will load faster without the user having to wait for single sign on to login and will mean sharepoint mapped drives will be accessible instantly rather than requiring the end user to open an IE window and login.
I don't expect anyone to do the work for me, but would be good to know if I am on the right track. I have tried to get this working myself but am under pressure to get it working ASAP.
June 5, 2017 at 4:17 am #72085ParticipantTopics: 1Replies: 1Points: 0Rank: Member
Also tried this...
$app = Start-Process -WindowStyle hidden -filepath "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -passthru
sleep -s 10
Seems to work for notepad but doesn't work for IE or chrome...
June 5, 2017 at 8:37 am #72094ParticipantTopics: 0Replies: 33Points: 0Rank: Member
$url = "www.powershell.org" $ie = New-Object -com internetexplorer.application $ie.visible = $false $ie.navigate($url)
The topic ‘Run Hidden IE session, Terminate after 30 seconds’ is closed to new replies.