Archive for the ‘scripts’ Category
PowerShell Scripting Examples for VMware Virtual Infrastructure
Like a lot of virtual infrastructure administrators already seem to be doing, I decided I better start learning about PowerShell scripting for VMware ESX and VirtualCenter. There has been a lot written on this topic in the recent months, but I have been just been speed reading through with the idea that “I’ll get around to understanding and learning this later when I have more time”. Now I am holding myself to this promise, so this post is my first steps to making myself learn. I am also looking forward to attending the Scripting VMware Infrastructure: Automating, Integrating, and Extending VI VMWorld Hands On Lab (Lab 09) already on my schedule for the conference.
Here’s what little I know about Powershell for VMware so far:
- PowerShell is actually a Microsoft application that is the base of the VMware VI Toolkit
- The best way for getting started with PowerShell is to download the Windows PowerShell 1.0 Documentation Pack
- The VMware Communities is home to the VI PowerShell Blog. They are actually running a scripting contest right now.
Here are links to several useful PowerShell scripts created by the user community: Read the rest of this entry »
Automate VMware Server Full VM backups with vmsbackup script
If you are running VMware Server on a Linux host and need to automate and schedule a process for backing up your guests then check out Two Bald Geeks’ bash script documented in the post at vmware-server VM backups. In short, the vmsbackup script systematically cycles through all VMs in a designated folder and accomplishes a full guest backup for each. To do this the script suspends the VM, copies it to another location, tars the copied file, removes any existing tars older then a specified time period, and then resumes the source VM again. Creating a Cron job for the script enables the process to be repeated on a scheduled basis.
Here’s some more information taken from the linked post on the strategy behind the script. Read the rest of this entry »
Search for VM Snapshots from the Service Console
There are several ways to determine if you have virtual machines with snapshots. Why you would want to know has been covered In various other posts both here at VM /ETC as well as on the other virtualization blogs. It’s so important that the virtualization community has created different tools and scripts to identify and monitor snapshot files for administrators. So, when I read the post WWoIT – Wayne’s World of IT: Find VM snapshots in ESX/VC I had an experience that Aaron Delp described as “/HEADDESK” (when he commented on my uploading files with the VI Client post).
It may not be the fanciest of methods, but probably the quickest way to find VM snapshots is to use the ls command from the ESX Service Console. By piping the output with grep to find files with the snapshot extension, .vmsn, and using the recursive switch you can scan all the VMFS LUNs visible to an ESX host. That’s so simple it hurts!
To use the ls command to find snapshots do the following: Read the rest of this entry »
Configure PortGroup settings across all ESX hosts simultaneously
VI3 Enterprise features VMotion, DRS, and HA require identical virtual networking settings on all of your ESX hosts. Unfortunately, VirtualCenter does not apply a central configuration policy or inheritance of settings from the cluster. Maybe a future version of VirtualCenter will evolve to include global configuration abilities? Until such a version is created, each ESX server’s virtual networking settings will continue to be configured individually by most administrators. However, there are some time saving, global configuration options available today. This post summarizes two methods provided by the virtualization community for creating PortGroups simultaneously across multiple ESX hosts. Read the rest of this entry »
FREE Disk space monitoring solutions for VMware virtual infrastructure
VMware VirtualCenter comes with built in alerting and a handful of alerts preconfigured. Unfortunately, alerting for disk space usage of either the ESX hosts or the virtual machines is not included. Administrators continue to use common physical infrastructure monitoring and reporting applications such as NetIQ and MOM for VMs, or SNMP capable programs like HP Openview or IBM Director for ESX host monitoring. A less complex and less expensive ( cost of installing and configuring agents on each VM OS ) alternative would be to tap into VirtualCenter’s central management ability to monitor, alert, and report on disk space. This post lists a few free solutions that can already use VC2.x or quickly be configured for ESX hosts and therefore save administrators time and money. Hopefully, a future feature of VC2.x will include vital disk space metrics and alerting.
Windows GUI for Storage VMotion
Another improvement alternative to the cumbersome storage vmotion feature has been made by the user community. I am assuming (and hoping) that one day soon we will all be announcing (and celebrating) the patch that includes the native VC 2.5 ability to call and configure storage vmotion from the VI Client, but until VMware does that the user community can be counted on to continue to make the process easier.
Graphical Front-End for Storage VMotion – blog.scottlowe.org is where I found out about Alexander Gaiswinkler’s post in the VMware Communities announcing his GUI for SVMotion. Installation instructions from Alexander’s post: Read the rest of this entry »
Script to clean up Virtual Center database
I was directed to a VMware Knowledge Base article about a script for cleaning up the VC database while upgrading to VC2.5. The company had about 18 months worth of data in their VC SQL database and wanted to preserve some recent historical data, but didn’t need to keep all of it. Purging data helped free disk space and reduce the time the upgrade actually took to complete.
The VMware article links to scripts for both Read the rest of this entry »









