Avatar of Kelly Garcia
Kelly Garcia
Flag for United Kingdom of Great Britain and Northern Ireland

asked on 

Powershell script reporting

Hi Guys,

I have written the script below to check all machines in our asset register that they have McAfee agent and hips installed, any suggestions for improvement will be greatly appreciate:

$ServerName = Get-Content .\LondonComps.txt, .\Singaporecomps.txt, .\usacomps.txt, .\RomaniaComps.txt

foreach ($Server in $ServerName) { 
 
        if (Test-Connection -ComputerName $Server -Count 2 -Quiet ) {  
         
            write-Host "$Server is alive and Pinging " -ForegroundColor Green 

		Get-Service *masvc*, *entercept*, *McAfeeFramework* -ComputerName $Server | select Status, DisplayName, Machinename
		
         
                    } else 
                     
                    { Write-Warning "$Server seems dead not pinging" 
             
                    }   

  
         
}

Open in new window


I want the results to be on Microsoft excel on whether the service is running or not which will indicate that the product is installed on the machine or not. please help I am unsure how to do this.

thank you in advance,
Kay
PowershellAnti-Virus Apps

Avatar of undefined
Last Comment
Kelly Garcia

8/22/2022 - Mon