Powershell script to refresh Internet Explorer (IE) at frequent intervals. This script is handy for Enterprise applications or sites that timeout or automatically log off the user after specific intervals of time.
In my case it was my Citrix Storefront application that timed out every 5 mins on non-activity. I used to enter my Network password and Citrix image password atleast 30-40 times in a day. I decided to write a script that would refresh my IE browser window at every 3 minute interval.
You can change the browser URL and Refresh time interval values highlighted in yellow below as per your requirements. Copy and Paste the below script in a PowerShell editor, save the file with .ps1 extension.
$ie = New-Object -com internetexplorer.application;
$ie.Navigate("https://www.mycitrixstorefront.com/default.aspx")
$ie.Visible = $true
$i = 0;
# Wait for the page to load
while ($i -ge 0)
{
Write-Host 'IE Refresh count: ' + $i
Start-Sleep -Seconds 180
$i = $i+1;
$ie.Refresh()
}
You can then create a .BAT file and reference the .ps1 script. The batch could then be scheduled in the Windows Task scheduler or executed manually to refresh your IE browser at frequent intervals
cd /d %~dp0
powershell -noexit -file ".\RefreshIE.ps1" "%CD%"
pause
In my case it was my Citrix Storefront application that timed out every 5 mins on non-activity. I used to enter my Network password and Citrix image password atleast 30-40 times in a day. I decided to write a script that would refresh my IE browser window at every 3 minute interval.
You can change the browser URL and Refresh time interval values highlighted in yellow below as per your requirements. Copy and Paste the below script in a PowerShell editor, save the file with .ps1 extension.
$ie = New-Object -com internetexplorer.application;
$ie.Navigate("https://www.mycitrixstorefront.com/default.aspx")
$ie.Visible = $true
$i = 0;
# Wait for the page to load
while ($i -ge 0)
{
Write-Host 'IE Refresh count: ' + $i
Start-Sleep -Seconds 180
$i = $i+1;
$ie.Refresh()
}
You can then create a .BAT file and reference the .ps1 script. The batch could then be scheduled in the Windows Task scheduler or executed manually to refresh your IE browser at frequent intervals
cd /d %~dp0
powershell -noexit -file ".\RefreshIE.ps1" "%CD%"
pause