Search your Log Files (Helpful Script of the Day)
Today’s Helpful Script of the Day is a handy little script I cooked up that allows you to search the recent entries of your VMware log files straight from the Powershell Console.
It works like this:
First, it would like to know what string you are looking for. Maybe it’s the name of a virtual machine, maybe the word Error, maybe a specific date and time (note however that each log has it’s own date / time format).
Then it tries to check whether or not you are connected to a server already by looking at the value of the $DefaultVIServer variable. (If you have a definitive way to determine whether or not you’re connected: let me know in the comments.) If you’re not connected, the script will ask which server to connect to. You can connect to Virtual Center Servers or ESX Servers.
Then it checks which log files are available. It will loop through all of them, checking if your search string is found.
It then displays the most recent matches found. You can modify the $maxResults value in the script to adjust it to your needs.
Hope it’s Helpful!
Hugo
Tags
Active Directory API bind order cleanup cluster CPU Custom Fields datastores description device management directory tree errors Event Log file name filter Fun function HA IT known issues License Server LUN multipath NIC objects Oneliner portgroups PowerCLI PowerShell profile recursive Registry Scripts security session share snapshots SQL Stat VI Toolkit VMware vSphere WMI WSUS ZenArchives
- July 2012
- July 2011
- February 2011
- January 2011
- December 2010
- May 2010
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008




