VMware Horizon Community
btrabue
Enthusiast
Enthusiast

List of VM's and Entitlements Report Emailed

Hello-

I need some help from the experts because I am by far not an expert at scripting.  Does anyone know how to create a script that will list all VM's in pools, their version of the VM tools and who each one is entitled to in an Excel format?  A bonus for me would also have the file emailed daily.  Thank you in advance.

Reply
0 Kudos
9 Replies
LucD
Leadership
Leadership

To create the CSV you can do something like this

Get-VM | Select Name, @{N="Pool";E={$_.ResourcePool.Name}},
        @{N="Tools Version";E={$_.Extensiondata.Config.Tools.ToolsVersion}} | `
Export-Csv "C:\report.csv" -NoTypeInformation -UseCulture

Not sure what you mean with the "entitled to" part ?

To mail the report you could do

$smtpSrv = "smtp.server.domain"
$from = "vmware.report@lucd.info"
$to = "lucd@lucd.info"
$subject = "VM Report"
$body = Get-VM | Select Name, @{N="Pool";E={$_.ResourcePool.Name}},

      @{N="Tools Version";E={$_.Extensiondata.Config.Tools.ToolsVersion}}

$smtp = new-object Net.Mail.SMTPclient($smtpSrv)
$msg = new-object Net.Mail.MailMessage($from,$to,$subject,$body)
$smtp.send($msg)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
btrabue
Enthusiast
Enthusiast

Sorry, I re-read my post and the entitlement was confusing to me.

We need to have a list of all the VM's and the entitlement for each VM.

Reply
0 Kudos
LucD
Leadership
Leadership

Still not too sure what you mean with entitlement.

Is it the CPU and memory reservation of a VM ?

If yes, that you can get like this

Get-VM | Select Name, @{N="Pool";E={$_.ResourcePool.Name}},
        @{N="Tools Version";E={$_.Extensiondata.Config.Tools.ToolsVersion}},
        @{N="CPU Reservation MHz";E={$_.ResourcePool.CpuReservationMHz}},
        @{N="Mem Reservation MB";E={$_.ResourcePool.MemReservationMB}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
btrabue
Enthusiast
Enthusiast

I'm sorry and you are helping me out so much.  I attached an image of what we need.  I basically need the user that has been assigned/entitled to the VM along with the VM name and the version of tools that is installed.  I hope that this helps.  Thank you!

Reply
0 Kudos
mattboren
Expert
Expert

Hello, btrabue-

I think that you are talking about VMware View, View desktop pools, and user entitlements to those View desktop pools (and not about Resource Pools).  If so, there is now a snapin ("View PowerCLI") that has cmdlets for gathering the type of info that you desire.

The VMware View Integration document (pdf) lists some info about these cmdlets.  alanrenouf also wrote a bit about them (View 4.5 version) at his post at http://www.virtu-al.net/2010/09/14/vmware-view-4-5-more-powershell-cmdlets/.

Before working further on this, are you talking about VMware View desktop VMs and their entitlements?

Reply
0 Kudos
btrabue
Enthusiast
Enthusiast

Mattboren,

Yes, that is exactly what I am needing.  I have PowerCLI installed on the server and just need a way to produce a report that has the virtual computer name, the user account name that is assigned to it and what the version of the tools are that are installed on the VM.  Thank you!!

Reply
0 Kudos
LucD
Leadership
Leadership

Ok, now I get it, you mean View VMs.

I'm afraid I have no real experience with those cmdlets (yet).

Perhaps the View cmdlets list that Alan published makes you any wiser.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
LucD
Leadership
Leadership

Thread moved to the View Community.

LucD


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
BlueMike
Contributor
Contributor

The feature you are requested is related to VMware View.  I have recently tried to make similar scripts, but it appears that at this time you must connect directly to the VMware View server and run the PowerShell scripts directly on the server.  A ticket my company recently sent to VMware confirmed this was true even with VMware View 4.6.

The tools do exist, however, if you do run them on the VMware View server, and entitlements, pools, and related information can be pulled and tied to your vSphere scripts.  I gave up with that path, however, because I was wanting to completely automate my virtual machine and View deployments from my workstation and the workstations of other technicians.  Having everyone connect to the View server directly and run scripts there (as well as develop scripts!) was impractical and dangerous.  The ability to remotely manage VMware View would be HUGE to the whole deployment and management tasks.

I know this doesn't directly answer your question, but perhaps can give you some information that you can use to ask more direct questions.

Reply
0 Kudos