Quantcast
Channel: Jahnin's Technical Journal!
Viewing all articles
Browse latest Browse all 31

PowerCLI script to query all windows VM's and check if the vShield Endpoint driver is installed.

$
0
0
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

1. Launch the PowerCLI shell and connect to the vCenter Server:
"Connect-VIServer [vcenter server ip\fqdn]"

2. 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
}
}

3. Run the script. For eg. c:\script.PS1

So what does the script do?
1. Get a list of  VM's that are powered on in vCenter Server.
2. For each of the powered on VM's:
    a. Check if the VM is configured to run a Windows OS
    b. Run the windows script to check if the driver is installed in the VM
    c. Print the output of the script along with the VM's name


Viewing all articles
Browse latest Browse all 31

Trending Articles