@george1421 I took a complete 180 on the methodology on this problem with the help of my co-worker who is better with Powershell than I am. Below is the sanitized version of our simple script to check Domain PC’s for the FOG Client:
ForEach ($Computer in (Get-ADComputer -Filter * -SearchBase "OU=Sample,DC=yourdomain,DC=com")) {
$ComputerName = $Computer.Name
If (Test-Connection $ComputerName -Count 1 -Quiet) {
$FogService = Get-Service -Name FogService -ComputerName $ComputerName -ErrorAction SilentlyContinue
If ($FogService) { Write-Output "FOG is running on $ComputerName" | Out-File C:\Scripts\FOG.csv -Append}
Else {Write-Output "FOG is not running on $ComputerName" | Out-File C:\Scripts\FOG.csv -Append }}
Else {Write-Output "$ComputerName is Offline" | Out-File C:\Scripts\FOG.csv -Append}
}
It isn’t the prettiest, but it is versatile in the way that you can really sub the FOGService with any other service name to check if said service is installed and running. I have a initial CSV for the online PC’s that had a broken or not installed FOG Client and set a GPO Startup script to remove any old service, install the new service, and finally start the service. Below is a sanitized batch file for that:
msiexec /q /x C:\LegacyClientInstaller\FOG Service Installer.msi"
msiexec /i "C:\NewClientInstaller" /quiet USETRAY="0" HTTPS="0" WEBADDRESS="YourFOGAddress" WEBROOT="/fog" ROOTLOG="1"
net start FOGService
Hope this may help someone someday!