Finding which Servers Have a Particular Driver

A couple of days ago, I wrote about getting a list of host names from vCenter. I needed these so I could use the list in a script to determine which servers were not running the vShield Endpoint Thin Agent Driver.

Now that I had a list of DNS names, I could use a WMI Query to find what I was after.

With Get-WmiObject, you can use Powershell to do remote queries of WMI objects. It has a fairly wide-range of uses. You can use it to return a list of processes, services, query the bios, and, what I needed, return system drivers. Like here:

$servers = Import-Csv [serverlist.csv]
Foreach ($server in $servers) {
 $computer = $server.dnsname
 $VShieldDriver = Get-WmiObject -Class Win32_SystemDriver -Filter "name='vsepflt'" -ComputerName $Computer -ErrorAction Continue
 Write-Verbose -Message "Successfully connected to $Computer"
 
 $result = [PSCustomObject]@{
 ComputerName = $Computer
 DisplayName = $VShieldDriver.DisplayName
 Name = $VShieldDriver.Name
 State = $VShieldDriver.State
 Status = $VShieldDriver.Status
 Started = $VShieldDriver.Started
 }

 $result | Export-Csv [export csv path] -append
}

I butchered another script for part of this and I will add it as a source if I can find it again. This will return Red for any non-Windows machines. You could add a PowerCLI query to determine OS if you wanted to avoid that. For my use, it was what I needed.

I haven’t tried it, but you can also do this with PowerCLI according to this blog.

Sources:

https://technet.microsoft.com/en-us/library/hh849824.aspx

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s