I need to refresh only the current web page using powershell.But all the opened web pages are being refreshed.My code is here
function Refresh-WebPages {
param(
$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
}
You have the Where
clause which filters out all windows with .url
Where-Object { $_.Document.url }
All you would need to do is refine that for the specific url you are looking for.
Where-Object { $_.Document.url -like 'http://google*' }
That would filter out all the pages that start with http://google
. If there is a more elegant solution for targeting one page I am not aware of it.