A
A
Andriy Shevchenko2020-10-01 09:04:10
PowerShell
Andriy Shevchenko, 2020-10-01 09:04:10

How to check if Google Chrome is installed and if not, install it?

There is a line from the initial script when installing GCWP

$LocalTempDir = $env:TEMP; $ChromeInstaller = "ChromeInstaller.exe"; (new-object    System.Net.WebClient).DownloadFile('http://dl.google.com/chrome/install/375.126/chrome_installer.exe', "$LocalTempDir\$ChromeInstaller"); & "$LocalTempDir\$ChromeInstaller" /silent /install; $Process2Monitor =  "ChromeInstaller"; Do { $ProcessesFound = Get-Process | ?{$Process2Monitor -contains $_.Name} | Select-Object -ExpandProperty Name; If ($ProcessesFound) { "Still running: $($ProcessesFound -join ', ')" | Write-Host; Start-Sleep -Seconds 2 } else { rm "$LocalTempDir\$ChromeInstaller" -ErrorAction SilentlyContinue -Verbose } } Until (!$ProcessesFound)


Since GCWP needs chrome, and on some computers it already exists, what script should be applied before that so that it first checks if Google Chrome is installed, and if so, would it skip this paragraph?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Dmitriev, 2020-10-01
@Capey

1. Google on Powershell check installed applications (if you want to check in the list of installed programs)
2. Google - Powershell check if foler\file exists (if you want to check a file or folder on a specific path)
3. Write a test condition if $true exit on the installed program from the list of installed programs or by the presence of a specific file or folder

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question