Refreshing Web Pages

by Dec 3, 2010

Imagine you opened a number of Web pages in Internet Explorer and would like to keep the display current. Instead of manually reloading these pages in intervals, you can use this script:

function Refresh-WebPages {
$interval = 5
"Refreshing IE Windows every $interval seconds."
"Press any key to stop."
$shell = New-Object -ComObject Shell.Application
do {
'Refreshing ALL HTML'
$shell.Windows() |
Where-Object { $_.Document.url } |
ForEach-Object { $_.Refresh() }
Start-Sleep -Seconds $interval
} until ( [System.Console]::KeyAvailable )
[System.Console]::ReadKey($true) | Out-Null

It will automatically refresh all opened Internet Explorer pages every five seconds.

Twitter This Tip!
ReTweet this Tip!