# Scheduled Task to open browser/URL then close.

Hi All - I have a Windows Server 2012 machine and I need to create a task that executes a URL and after about a minute, closes the browser.

Using the "Create Basic Task Wizard" I was able to create the task to Open the browser and launch the URL BUT I cannot figure out how to close the browser a minute later.

Can you please provide with with instructions on how to do this?  Thanks!
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

IT super heroCommented:
create a powershell script (C:\myscripts\openCloseIE.ps1):
-------------------------------------------------------------------------------------------------------------
$oIE = New-Object -ComObject internetexplorer.application;$oIE.Navigate("http://myurl.sufix/mypage.html")
$oIE.Visible =$true #...or false, if you what it appear on the desktop, or not
start-sleep -seconds 60
\$oIE.quit()
-------------------------------------------------------------------------------------------------------------
Create a task that Starts a program: C:\Windows\system32\WindowsPowershell\v1.0\powershell.exe

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
Thank you.  I will try this.
@cdemott33 - I'd try the suggestion before I accept :)

I tried and got a security warning, powershell did not start a browser, so nothing happened.

@x-men - Anything you need to add maybe?
IT super heroCommented:
@Gerwin Jansen care to share the message, maybe?
@x-men - No problem, I tried both as a scheduled task as well as from a cmd (administrative) prompt:
C:\Temp>C:\Windows\system32\WindowsPowershell\v1.0\powershell.exe c:\temp\ee.ps1
c:\temp\ee.ps1 : File C:\temp\ee.ps1 cannot be loaded because running scripts is disabled on this system. For more info
At line:1 char:1
+ c:\temp\ee.ps1
+ ~~~~~~~~~~~~~~
+ CategoryInfo          : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess

C:\Temp>

I just got curious as the asker closed with ".. I will try this".
IT super heroCommented:
"cannot be loaded because running scripts is disabled on this system."

recommend executing the following: