We have swapped over to a new virus protection and I'm trying to track down all the machines with our old McAfee software on it. We are in a domain group, and all the PC's are listed in active directory.
$list = Get-ADComputer -Filter *
foreach($PC in $list){
$data = Get-WmiObject -ComputerName $PC -Class Win32_Product | sort-object Name |
Select-Object Name | Where-Object { $_.Name -like "*McAfee*"}
if($data){
Write-Output "$PC has $($data.name) installed" |
out-file C:\Users\username\Desktop -Append
}
}
I'm a bit amateur when it comes to powershell.
Im getting this error over and over again
Get-WmiObject : The RPC server is unavailable.
At line:4 char:13
+ $data = Get-WmiObject -ComputerName $PC -Class Win32_Product | so ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], COMException
+ FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
I've read it's likely a firewall setting in the group policy. Before I try and get that changed is this the most effective way to do this? I'm avoiding using a list of computer names for simplicity, but I can do if necessary.