Tech

PowerShell Auto Refresh Google Chrome and Firefox

Hi all,
We have developed one application to interact with our end users basically It’s like a support forum. But the thing is we didn’t notified any new notification or chats till we refresh the page. So, we come up with an idea to refresh the page very frequently so that we will aware any new comments on the site.

Since the application was developed by a freelancer we are having few difficulties working with him again. So, I am trying to create a PowerShell Script to auto-refresh some or all open pages in Google chrome and others in Firefox.

But this below script one only refreshes 1 active page, not the others.

while(1) { # Loop forever
    sleep -Seconds 3 #1 hour
    $wshell = New-Object -ComObject wscript.shell 
    if($wshell.AppActivate('Chrome')) { # Switch to Chrome
    Sleep 1 # Wait for Chrome to "activate"
    $wshell.SendKeys('{F5}')  # Send F5 (Refresh)
    } else { break; } # Chrome not open, exit the loop
}

Thanks for the help