Hi All,
Can anyone help with reporting on guests without the VMware Tools vShield Driver / Thin Agent Enabled ?
For the vShield driver you can do something like this
$script = @"
driverquery
"@
$vm = Get-VM -Name MyVDIStation
$output = Invoke-VMScript -VM $vm -ScriptText $script
$vShieldDriverPresent = $output -match "vsepflt"
I'm not 100% sure what you mean with the Thinagent, but I assume this might be the ViewAGent ?
If yes, you can do
$script = @"
Get-Service -Name WSNM
"@
$vm = Get-VM -Name MyVDIStation
$output = Invoke-VMScript -VM $vm -ScriptText $script
$ViewAgentPresent = $output -match "WSNM"
$ViewAgentRunning = $output -match "Running"
Btw, this and another bunch of View tricks from PowerCLI will be presented at the next Belgian VMUG meeting on May 24th 2013. :smileycool:
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
For the vShield driver you can do something like this
$script = @"
driverquery
"@
$vm = Get-VM -Name MyVDIStation
$output = Invoke-VMScript -VM $vm -ScriptText $script
$vShieldDriverPresent = $output -match "vsepflt"
I'm not 100% sure what you mean with the Thinagent, but I assume this might be the ViewAGent ?
If yes, you can do
$script = @"
Get-Service -Name WSNM
"@
$vm = Get-VM -Name MyVDIStation
$output = Invoke-VMScript -VM $vm -ScriptText $script
$ViewAgentPresent = $output -match "WSNM"
$ViewAgentRunning = $output -match "Running"
Btw, this and another bunch of View tricks from PowerCLI will be presented at the next Belgian VMUG meeting on May 24th 2013. :smileycool:
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Oops, just noticed that the vShield driver is also called the Thin agent.
So the 1st piece of code will get you that info.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks Luc, will give it a try soon.
Hi Luc,
I'm having a bit of trouble, I want to scan my Datacenter for all VM's and list guest machines / servers that doesn't have the vShield driver?
Try something like this
$script = @"
driverquery
"@
Get-Datacenter -Name MyDC | Get-VM | %{
$output = Invoke-VMScript -VM $_ -ScriptText $script
$_ | Select Name,@{N="vShield Agent present";E={$output -match "vsepflt"}}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks Luc,
I'm getting the following error
PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> $script
= @"driverquery"@Get-Datacenter -Name MyDC | Get-VM | %{ $output = Invoke-VMScr
ipt -VM $_ -ScriptText $script $_ | Select Name,@{N="vShield Agent present";E={
$output -match "vsepflt"}}}
Unrecognized token in source text.
At line:1 char:11
+ $script = <<<< @"driverquery"@Get-Datacenter -Name MyDC | Get-VM | %{ $outp
ut = Invoke-VMScript -VM $_ -ScriptText $script $_ | Select Name,@{N="vShield
Agent present";E={$output -match "vsepflt"}}}
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordEx
ception
+ FullyQualifiedErrorId : UnrecognizedToken
Actually,
I think I pasted it incorrectly, but when I run it I don't get any results
PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> $script
= @"
>> driverquery
>> "@
>>
PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> Get-Data
center -Name MyDC | Get-VM | %{
>> $output = Invoke-VMScript -VM $_ -ScriptText $script
>> $_ | Select Name,@{N="vShield Agent present";E={$output -match "vsepflt"}}
>>
>>
>>
>>
>>
>>
>>
Looks like the <CR><LF> got lost during your copy/paste of the script.
I'll attach the script, try it with that one.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks, Its seems to be giving me the results but I get the following error on each VM listed, please see image
There seem to be some VM that have an older version of VMware Tools running.
But that is a warning.
The error indicates that the account under which you run the script, doesn't have the required vCenter privileges.
See my Will Invoke-VMScript work ? post.
Since the command could not be run inside the guest OS of the VDI station, you get the default value in the vShield column, which is $false.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Luc,
Is this script intended only for VDI environment, I'm running it a multi tenanted server environment.
I used higher privileges but still get the error bellow. I'm just wondering the vShield driver is installed it reports "Thin Agent Enabled back to vShield manager, but I assume vShield manager gets that info from vCenter, would there be any way to query that instead?
image attached
VM False
Invoke-VMScript : 13/05/2013 3:51:21 PM Invoke-VMScript Timeout error
while waiting for VMware Tools to start in the guest.
At C:\scripts\VDI-DC-VM-vshield-agent-present.ps1:6 char:28
+ $output = Invoke-VMScript <<<< -VM $_ -ScriptText $script
+ CategoryInfo : OperationTimeout: (:) [Invoke-VMScript], VimExce
ption
+ FullyQualifiedErrorId : Client20_VmGuestServiceImpl_WaitProcessInGuest_O
perationTimeout,VMware.VimAutomation.ViCore.Cmdlets.Commands.InvokeVmScrip
t
No, the script should work with any VM, provided the VM's guest OS is supported for Invoke-VMScript.
Which guest OS are we looking at ?
Did you run the script from my post I mentioned earlier ?
It could give an indication what is missing.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The info you see in the vSphere client comes from the vShield plugin.
You can query vShield with some REST calls, Alan did a module for that.
I'll have a look.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Luc,
I'm just interested in Windows 2003, 2008 and 2012. Yes I ran the script you attached earlier.
Also if you see the image attached, the result "False" Those servers have vShield driver install and Thin agent enabled.
I just found this, is this what you were talking about
http://www.virtu-al.net/2012/01/04/vmware-vshield-powershell-module/
Yes, but I'm not sure how to query the vShield Manager for the information you're after.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks Luc, I'll play around with it, see how I go.
VMware Communities<http://communities.vmware.com/index.jspa>
Guests without vShield Driver or Thin Agent Enabled
created by LucD<http://communities.vmware.com/people/LucD> in VMware vSphere™ PowerCLI - View the full discussion<http://communities.vmware.com/message/2239255#2239255>