Hello,
I created a script which should check if Google Chrome is installed in a users Local AppData folder. In order to do that, it checks if the registry key in HKEY_USERS\UserSID\Software\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome is there.
When running the script manually on a Test-VM as administrator, the output gets written into a text file.
However, I would like to let a GPO do the work and make it scan every computer to check if Chrome is installed in the Local AppData.
Does anyone know what I would have to add in my script? Something with iteration probably? Unfortunately I just started with Powershell so I don’t know how to continue with it.
Thank you in advance!
$registryPath = "Registry::HKEY_USERS\*\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome"
$outputFile = "\\FileShare\NewFolder\Chrome.txt"
if (Test-Path $registryPath) {
$InstallLocation = (Get-ItemProperty -Path $registryPath -Name InstallLocation).InstallLocation
$displayVersion = (Get-ItemProperty -Path $registryPath -Name DisplayVersion).DisplayVersion
$output = "$($env:COMPUTERNAME), $InstallLocation, $displayVersion, $(Get-Date -Format ""dd-MM-yyyy HH:mm:ss"")"
$output | Out-File -Append -FilePath $outputFile
Write-Host "Checking ready."
} else {
#Registry key not found
Write-Error "Can't find the registry"
}