To check if the vShield endpoint driver is installed in Windows we can use the following command, sc query type= driver | find "vsepflt"
To automate the above script across all Windows VMs in the vCenter Server
- Launch the PowerCLI shell and connect to the vCenter Server:
Connect-VIServer [vcenter server ip\fqdn]
- Copy the below script to a text file and name the file with “.PS1” extension. For eg. “script.PS1” Replace “Domain\User” and “Password” in the below script to a user account that has permissions to log into the VM’s.
$vms=GET-VM | Where-Object {$\_.PowerState -eq "PoweredOn" }
ForEach($vm in $vms)
{
if (Get-VMguest -VM $vm | Where-Object {$\_.OSFullName -like "\*Microsoft\*"})
{
Invoke-VMScript -VM $vm -GuestUser "Domain\\User" -GuestPassword "Password" -ScriptText "sc query type= driver | find \`"vsepflt\`" " -ScriptType bat | format-list vm,name,ScriptOutput
}
}
- Run the script. For eg. c:\script.PS1
So what does the script do?
- Get a list of VM’s that are powered on in vCenter Server.
- For each of the powered on VM’s:
- Check if the VM is configured to run a Windows OS
- Run the windows script to check if the driver is installed in the VM
- Print the output of the script along with the VM’s name