Hi
Is it possible to use Power CLI to query VMware tools to see if a certain driver such as the SVGA Driver or VMCI Driver is installed ? Ive been looking at Get-View with VMware.vim.virtualmachineconfigspec which shows the status of the tools etc but doesn't seem to be able to delve to the level im after. Any one else managed to query these options
Sam
You could use the Invoke-VMScript cmdlet and query the WMI inside the guest OS.
Something like this
$vmName = 'MyVM'
$cmd = @"
Get-WmiObject -Query 'Select * from Win32_SoftwareFeature Where ProductName LIKE "VMware Tools%" and InstallState=3'|
Select Caption
"@
Invoke-VMScript -VM $vmName -ScriptType Powershell -ScriptText $cmd
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD ive got a script working using similer to what you had in your reply which gives me what im after however Ill need to add a rule to any server with the firewall on to allow WMI to run on the guests have you has that problem ?
No, I didn't have that.
But it is strange, the WMI call is made within the guest OS.
Normally the FW shouldn't interfere in that.
Which rule did you have to add ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi
Found that the issue was I was running the below command from my management server not in an invoke command
Ive now added it to my script
Get-WmiObject -Class Win32_SystemDriver -Filter "name='vsepflt'" | Select Caption
Is there a way to format the output ? Or query it so if the driver is found I can print success or not found not found ? Im looking to wrap an if command round it to run through several machines
You could do something like this
$cmd = @"
Get-WmiObject -Query 'Select * from Win32_SoftwareFeature Where ProductName LIKE "VMware Tools%" and InstallState=3'|
Select Caption
"@
Get-VM | %{
$result = Invoke-VMScript -VM $_ -ScriptType Powershell -ScriptText $cmd
if($result.ScriptOutput -match "vShield Drivers"){
Write-Output "vShield drivers installed on $($_.Name)"
}
else{
Write-Output "vShield drivers not installed on $($_.Name)"
}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference