Warning: this post has no “virtual” content !
This time I post a function that allows you to export your data to a “real” spreadsheet (XLS format) instead of a CSV file.
The reason for posting this function was a series of threads in the PowerCLI Community by Suresh. Over several threads he has been collecting scripts that create various reports on his vSphere environment. Ultimately he wanted to have a spreadsheet where each report would be stored on a worksheet.
PowerShell has the very handy Export-Csv cmdlet to create CSV files but afaik nothing for creating XLS files
Michael asked if it was possible to produce a report that showed the NX/XD flag setting for all the guests.
Piece of cake I thought, but it turned out to be a bit more complex than that. If you don’t set the NX/XD flag (expose or hide) explicitly on the guest, the hyper-visor will use a default that is defined per OS you can have on the guest.
In the end I think I came up with a script that seems to handle all the different possibilities I encountered.
Today Steve Jin published a post called How to Enable ESX Server Logs for Troubleshooting. A very useful tip when you are looking for those hard-to-find “features” in your script.
Steve’s tip reminded me that I have a similar small function in my toolchest to do something similar for the vCenter log.
The function allows you to switch the vCenter log between “warning” and “verbose” on the fly. No need to go into the vCenter client to change the logging option anymore while debugging.
There was another interesting question on the PowerCLI community. Mike was wondering if it would be possible to change the VMware Tools scripts with a PowerCLI script. As far as I can see there are two options available with the VMware Tools scripts.
- You can run the default scripts that are installed on the guests when you install VMware Tools
- You can use Custom scripts and you have to specify the path of these scripts to VMware Tools
To use the 2nd option you will need, as William already pointed out, the VIX APIs.
But if you can live with the first option, and reuse the default scripts, the current PowerCLI build has all you need.
Some of you might be interested to know, Alan and Luc are writing a PowerCLI book.
We don’t have many more details at the moment but wanted to let you know, as we are both very excited (and nervous by the amount of work) about this project.
As you know we both live and breathe PowerCLI. And we want to share our knowledge to help others achieve the level of PowerCLI automation we both know is possible.
One thing you can expect from this book is a practical approach with examples galore. We aim to cover most of the common configuration/troubleshooting and reporting areas with easy to understand examples and explanations.