PowerShell: Check if VMware vShield driver is installed and running

Page content

The VMware vShield driver is a system driver named vsepflt.

It is easy to check the status of this driver by running msinfo32.exe and navigating to “Software EnvironmentSystem Drivers”

image

This can however be a bit cumbersome on an environment with more than one virtual machine. That’s why I recommend using PowerShell instead.

The System Drivers category displayed by msinfo32 is nothing else than the WMI-class Win32_SystemDriver, so I wrote a short function that can be used to inventory the status of the VMware vShield driver. It takes one parameter, –ComputerName and returns a PSCustomObject containing the name of the server inventoried and the basic properties of the driver.

Here is an example:

image

We can easy see that Server01 does not have the VShield driver installed, Server02 is offline (or at least not responding) and Server03 and Server04 is running fine.

The function wraps the following query in a PowerShell advanced function:

Get-WmiObject -Class Win32_SystemDriver -Filter “name=‘vsepflt’” -ComputerName $Computer -ErrorAction Stop

function Get-SWVShieldStatus
{
    [Cmdletbinding()]
    Param(
        [Parameter(Mandatory,ValueFromPipeline)]
        [String[]]
        $ComputerName
    )
    Process
    {
        Foreach($Computer in $ComputerName)
        {
            Try
            {
                $VShieldDriver = Get-WmiObject -Class Win32_SystemDriver -Filter "name='vsepflt'" -ComputerName $Computer -ErrorAction Stop
                Write-Verbose -Message "Successfully connected to $Computer"
                [PSCustomObject]@{
                    ComputerName = $Computer
                    DisplayName = $VShieldDriver.DisplayName
                    Name = $VShieldDriver.Name
                    State = $VShieldDriver.State
                    Status = $VShieldDriver.Status
                    Started = $VShieldDriver.Started
                }
            }
            Catch
            {
                Write-Verbose -Message "Failed to inventory $Computer"
                Write-Error -Exception $_.Exception -Message "Failed to inventory $Computer" -Category ConnectionError
                Continue
            }
        }
    }
}