VMware Cloud Community
nicholas1982
Hot Shot
Hot Shot
Jump to solution

Guests without vShield Driver or Thin Agent Enabled

Hi All,

Can anyone help with reporting on guests without the VMware Tools vShield Driver / Thin Agent Enabled ?

Nicholas
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

View solution in original post

0 Kudos
17 Replies
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

nicholas1982
Hot Shot
Hot Shot
Jump to solution

Thanks Luc, will give it a try soon. Smiley Happy

Nicholas
0 Kudos
nicholas1982
Hot Shot
Hot Shot
Jump to solution

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?

Nicholas
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos
nicholas1982
Hot Shot
Hot Shot
Jump to solution

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

Nicholas
0 Kudos
nicholas1982
Hot Shot
Hot Shot
Jump to solution

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"}}

>>

>>

>>

>>

>>

>>

>>

Nicholas
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

nicholas1982
Hot Shot
Hot Shot
Jump to solution

Thanks, Its seems to be giving me the results but I get the following error on each VM listed, please see image

vsh.JPG

Nicholas
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos
nicholas1982
Hot Shot
Hot Shot
Jump to solution

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

vsh1.JPG

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

Nicholas
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos
nicholas1982
Hot Shot
Hot Shot
Jump to solution

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.

vsh2.JPG

Nicholas
0 Kudos
nicholas1982
Hot Shot
Hot Shot
Jump to solution

I just found this, is this what you were talking about

http://www.virtu-al.net/2012/01/04/vmware-vshield-powershell-module/

Nicholas
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos
nicholas1982
Hot Shot
Hot Shot
Jump to solution

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>

Nicholas
0 Kudos