Follow Steve on Twitter Follow Steve on Twitter
Subscribe to Steve's RSS feed Subscribe to Steve's RSS feed

Port Group Network Security Policy Action

Steve  | July 2nd, 2009

I have done some posts on using PowerShell actions in vWire and have generally shared scripts that give basic functionality to do things like start and stop a virtual machine and other scripts to help gather more information like returning the contents of a log file, for example.... Read more »

Follow Karen on Twitter Follow Karen on Twitter
Subscribe to Karen's RSS feed Subscribe to Karen's RSS feed

vWire Developer Videos Are Here!

Karen  | June 15th, 2009

People make a lot of jokes about "herding cats," and when I decided to video a group of our vWire developers for them to talk about their favorite vWire features, I worried it would be hard to get what are often considered the most introverted demographic in the world in front of... Read more »

Follow Matt on Twitter Follow Matt on Twitter
Subscribe to Matt's RSS feed Subscribe to Matt's RSS feed

OpsCheck and ConfigCheck are now completely free

Matt  | May 10th, 2009

We have had OpsCheck and ConfigCheck up over on vWire.com since the site was launched but we have noticed a trend.  A little less than half of the people who click on the buttons to get the tools don't actually download it.  There has always been a form in front of the download... Read more »

Follow Ted on Twitter Follow Ted on Twitter
Subscribe to Ted's RSS feed Subscribe to Ted's RSS feed

vWire Passed it Stress Test

Ted  | June 17th, 2009

My father recently underwent a stress test to determine how his heart performed under load.  The result was that he needed a pacemaker.  Tripwire's performance analysis team recently put vWire through a series of stress tests to determine how it would perform under load. I w... Read more »

Times Must be Tough!...
March 18th, 2009

Recent Virtual Black Hole Posts


Working with Maintenance Mode in PowerShell

by Steve  | June 30th, 2009

Today’s topic is working with PowerShell in vWire to enter and exit Maintenance Mode.  If you do not have vWire installed yet you can download it here.  Once you have vWire installed you will notice that there is a script action to exit Maintenance Mode.  When writing scripts for entering and exiting Maintenance Mode, exiting is by far the easiest to do.   Let’s take a look at the code to Exit Maintenance Mode.

          foreach ($h in $input)
          {
          Set-VMHost -VMHost $h -State “Connected” -Confirm:$false | % { “Exiting maintenance mode on ‘” + $h + “‘”}
          }

The first step is to loop through the piped $input to get the name of each of the VMware ESX hosts that you want to exit Maintenance Mode.  Once we have the name then we set the state of the host to Connected which will cause the host to exit Maintenance Mode.
Let’s take a quick look at all the options the -State switch will offer us:
If the State parameter is specified as Connected, then:
- if the host is currently connected and not in maintenance mode, does nothing.
- if the host is in maintenance mode, exits the maintenance mode.
- if the host is not connected or not responding, tries to reconnect.

If the State parameter is specified as Disconnected, then:
- if the host is currently connected, attempts to disconnect.
- if the host is not connected or not responding, does nothing.

If State is specified as Maintenance, then:
- if the host is currently connected and not in maintenance mode, enters maintenance mode.
- if the host is currently connected and in maintenance mode, does nothing.
- if the host is not connected or not responding, attempts to reconnect and enter maintenance mode.

If you notice, vWire does not ship with an action to Enter Maintenance Mode.  I built a quick down and dirty script or action to perform this task. You can download this action here from the community content section to be able to import into your vWire installation. Entering Maintenance mode actually requires a few more steps to work properly.  Let’s look at the code and see what is involved.

          $listESX = Get-VMHost
          ForEach ($vSRV in $input){
          ForEach ($ESX in $listESX){If ($ESX -cnotmatch $vSRV){
          Get-VMHost -Name $vSRV| Get-VM | Move-VM -Destination (Get-vmhost $ESX)
          }
          }
          Get-VMHost -Name $vSRV | Set-VMHost -State maintenance | % { “Entering maintenance mode on ‘” + $vSRV + “‘”}
          }

Notice that the first step is to get a list of all the VMware ESX hosts in the cluster. From there we will loop through the piped $input looking for each VMware ESX Server. Now, before we can enter Maintenance Mode, we will need to vMotion all the running virtual machines from the host we are performing the action on.  In the code $vSRV is the name of the VMware ESX host that we are working to put into Maintenance Mode and we want to make sure we use all the other VMware ESX servers in the cluster to migrate the virtual machines to.  The -cnotmatch switch will do just that to make sure the ESX hosts we got from the Get-VMHost command is not the name of the host we are working on

Now the script can migrate all the running virtual machines to all the other hosts in the cluster and then will enter Maintenance Mode successfully.

Until next time Happy Scripting!


Using PowerShell in vWire

by Steve  | June 23rd, 2009

Since we launched vWire at the beginning of the month I have been asked a few times how to help people get their PowerShell scripts to work with vWire.  This post is going to answer that question and give examples that you will need to make this happen. The first thing that you need to know is that vWire works by pipelining the information to PowerShell.  PowerShell will accept this input in the form of the variable $input.  Let me give you a quick example that should help make better sense of this.   Let’s look at the code to start virtual machines.

Foreach ($vm in (get-vm))
{
Start-VM -VM $vm  -confirm:$false
}

In this example I use a foreach loop to get all the names of the virtual machines that the command “get-vm” returns and puts it in the $vm variable.  Each different virtual machine name is looped through the Start-VM command until all virtual machines have been started.  The -confirm:$false switch is so that we do not get prompted to confirm we want to perform this action or start the virtual machines.

Now let’s look at the same code that would work in vWire

 

Notice that the object type is set to “Virtual Machine.” This lets vWire know what object this action or script will be used against. If you wrote an action for the hosts then the object type would be Hosts. You have the choice to select:

 

1.DataCenter 

2.Cluster

3.Host

4.VM

5. Snapshots

6. Resource Pool

7. Cluster Objects (i.e. affinity rules)

8. Device Objects (i.e. vCDROM, vNic ect)

9. Management Objects (i.e. VC Folders ect)

10. Storage Objects (SCSI LUN)

11. VM Object (Current Snapshots)

 

This should give you enough information to get started and take a peek at the power you have with vWire. For more information on vWire you can check out the vWire Community and to also share content with others in the community.

Time to sharpen your skills with vWire because I have heard rumors there might be a contest coming up.


Checking and Setting Time with vSphere PowerCLI and vWire

by Steve  | June 19th, 2009

I posted earlier in the week that I was going to present some scripts that are using one of the new cmdlets from the vSphere PowerCLI.  The scripts today are for getting and setting time information on the ESX hosts. If you have installed vWire then you can download the action here.

Inside this xml bundle you will find three scripts to work with this time.  There is one script to check and another script to set the time server settings on the VMware ESX server. Both these scripts are considered and deployed as a host based action. There is one more script that sets the time server settings from a Cluster level in vWire.  If you run the cluster based time script it will set the time on all the servers in the cluster it was run against.

Let’s take a look at the code..

Foreach ($h in $input)
{
Add-VmHostNtpServer -NtpServer “time1.timserver.com”,”time2.timeserver” -VMhost $h
}

As can see there is really not much to the code and you have to really love PowerShell for what you can do with your environment. 

 

Have a good weekend and happy scripting!

 

Steve


Vote for the Top VMware Blogs and a Chance to Vote for Me!

by Steve  | June 17th, 2009

My good friend Eric Siebert of vSphere-land is updating his top 20 VMware Blog list, and is looking for some help deciding what his Top 5 should be. I am currently rank #18 and I would really love to move up higher in the ranks with your help. You can see the current list on his vLaunchPad, and then vote here. Below come from the original post: Now get out and vote!!!

I have a hard time picking the top blogs from the many great ones that are out there. I initially started with a top 10 and recently expanded it to the top 20 as more and more blogs have started. In this post I outline my blog selection criteria for the top 20 and it’s no easy task for me to pick them and rate them in order. Well here’s the chance for you to pick the top 5 of my top 20 blog list using this new survey form that I created. You can pick from the current top 20 which you can see on my vLaunchpad,or choose other and add one that is not on the list. The survey will be open for 2 weeks, afterwords I’ll announce the results and update my vLaunchpad accordingly.  Duncan Epping from http://yellow-bricks.com has been the reigning number #1 for a while now and is a tough one to beat. So head on over to my survey and cast your vote, each position will have a weight assigned with it and they will be added up accordingly for the final results.


Configuration Control - TripwireTripwire's solutions for virtual and physical infrastructures provide comprehensive configuration management, improving availability, security, and compliance.
x

Subscribe to The Virtual Black Hole RSS Feed Email Notification

Enter your email address:

Delivered by FeedBurner