'Need to remotely open Chrome Settings Help in foreground using PowerShell

I have a requirement to run a script everyday and automatically update "Chrome Browser" if a new version is released. I am using a PowerShell script that goes like this:

Add-Type -Path "C:\seleniumdrivers\webdriver.dll" 
$ChromeDriver = New-Object OpenQA.Selenium.Chrome.ChromeDriver 
$ChromeDriver.Navigate().GoToURL("chrome://settings/help") 

If I execute this manually on my system or manually on VM System X, it works (Chrome opens, settings > help opens).

But if I execute this as a PowerShell task via TFS > Release definition > PowerShell Task to execute on system X, this opens chrome as a Background Process in that system X.

How do I get Chrome Browser to open in the foreground and not as background process?

Additional Information

I wasn't able to navigate to "Chrome Settings Help" by using any other PowerShell command like Start-Process "chrome.exe" "www.google.com" etc. The above seems to be the only way.

Chrome settings help can also be opened by using SendKeys, but not using that due to the unreliability of send keys.

There is a scheduled task on system X which runs GoogleUpdate.exe every one hour which in turn updates Google Chrome if a new version is available. BUT, recently this Scheduled Task ran (checked all logs) on the system X but it didn't update the latest 97 version, even after a day. This is the reason why I'm preferring to run a PowerShell script for the same.

Also preferring to automate this as we have some automated Selenium test cases running on system X which need to always run on latest Chrome browser with latest Chrome driver. Any non sync between versions of browser and Driver will fail the test cases. This is why preferring to automate it (even though it's suggested to upgrade Chrome manually).



Solution 1:[1]

Even if the chrome browser doesn't open in the foreground, the browser does navigate to "chrome://settings/help" thereby updating chrome to latest version if a latest version exists.

When this is run in a remote VM via build, there are chrome instances opening in the background (can verify these in the task manager) and if a new version of Chrome is available, the browser updates (verified this when chrome updated from 96 -> 97, 97 -> 98.X, 98.X -> 98.Y, 98.Y -> 99). This is how updates happen when we use GoogleUpdate.exe as well - GoogleUpdate.exe launches Chrome browser in background and updates it if a new version is available.

So irrespective of whether the chrome browser opens in the foreground or background, Chrome Browser does the expected actions and updates.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Anu7