VMware Cloud Community
aw443
Contributor
Contributor

VMware tools version rpt - Cleaning up format

I'm moving this from a post of another thread -- can anyone help improve upon this"Get-VM" command?

-a

I realize this post is a little old but I found it interesting (http://communities.vmware.com/thread/135389) and used it for reference in putting together something that returns the VM display name, its host name, tools status, and toolsversion. It then sorts by the name and outputs to a csv file, and appends the filename by the date and time.

I use this to generate a weekly report for a VMware tools upgrade project my team is working on. With all the VM's we have in our environment, and the amount of bru-ha-ha we have to go through to make a single change (I'm sure we all love-hate change control), this project will take a while to complete. Until then, I will be running this weekly. I've received requests to "make the report prettier". Granted this is just an output. I can paste into xls and add colors and formatting to make it easier to look at, but I'm wondering if there is anyway to just improve upon the csv output within the code itself so it comes out a little cleaner, or "prettier".

I understand it may not be as nice as presenting it into a wonderfully formatted xls spreadsheet, but i'm hoping it may create an easier output to digest for the reader, and save me some time on the xls front. Any ideas?

All in all this thread was very helpful to me in getting what I needed. Even if we can't pretty-it-up, its been helpful -- so I hope someone else can use this as well. Add or modify the expression and properties to suit what you need. Refer to the VI SDK here to view properties of the VM to call.

$date=get-date -uformat "%Y%m%d-%H%M%S"; get-vm | % { get-view $_.ID } | select Name, @{ Name="hostName"; Expression={$_.guest.hostName}}, @{ Name="ToolsStatus"; Expression={$_.guest.toolsstatus}}, @{ Name="ToolsVersion"; Expression={$_.config.tools.toolsVersion}} | sort-object name | export-csv c:\bin\out\vmtoolsver_$date.csv

-adubya

0 Kudos
0 Replies