The Lowercase w

EMC Elect 2016 – Thank you!

Posted by Matt Liebowitz

Today I was officially named as an EMC Elect 2016, my 2nd year in a row and 3rd overall year in the program.  To say I'm honored and thrilled is an understatement!

A while back I remember Duncan Epping saying something on Twitter similar to, "Everyone at VMware should be a vExpert."  I'm paraphrasing but his sentiment is clear - if you work for a company, you shouldn't need an award to incentivize you to evangelize that company's products.  He's absolutely right and I completely agree with him.  I would evangelize EMC's products regardless of whether or not there was an EMC Elect award and I'll continue to do so if I'm not an Elect.  The award is simply icing on the cake for doing something I already believe in.

Winning the award has special meaning to me for two reasons.

1) If you're judged by the company that you keep, then I am certainly in very select company.  The people on the list who are my fellow EMC Elect winners for 2016 have my utmost respect, and to be named in the same list as them is very humbling.  I truly mean that.

2) I believe in what we're doing at EMC.  I believe that our Federation Enterprise Hybrid Cloud solution is an amazing combination of technology (hardware/software) and services from EMC Global Services (where I work).  I work everyday to improve our professional services to make delivery smoother and make our people better which leads to happier customers and better projects.  The Federation Enterprise Hybrid Cloud by itself is a great piece of technology and checks the boxes for many customers, but our services (and those of our great EMC partners) are what ultimately brings it home for our customers.  I believe and fully support both, and being awarded for doing that makes it feel much sweeter.

Thank you to the whole EMC Elect team and I'm looking forward to another great year in the program!

Tagged as: No Comments

Display list of Multiple vCenter Servers to connect to in your PowerCLI Scripts

Posted by Ben Liebowitz

If you’re company anything like mine, you probably have multiple vCenter servers in your environment.  They may be linked, they may not.  In my environment, we have 4 vCenter servers we consider Production, even though one is for QA, and we have a lab environment.

Normally, I just connect to vCenter manually in PowerCLI before I run a command/script to make a change, run a report, etc.  But then I got to thinking, wouldn’t it be easier if I just had something to include at the beginning of my scripts to provide a list.  Something I could put in the beginning of each script...

# PowerCLI script with list of vCenter servers
# Created by BLiebowitz on 11/11/2015

# List vCenters to connect to

Write-host "Select which vCenter to connect to:"
Write-Host ""
Write-Host "1. vCenter1"
Write-Host "2. vCenter2"
Write-Host "3. vCenter3"
Write-Host "4. vCenter4"

$Ivcenter = read-host “Select a vCenter Server. Enter Number “

if ($Ivcenter –eq 1) {
$vcenter = "vCenter1"
} elseif ($Ivcenter -eq 2) {
$vcenter = "vCenter2"
} elseif ($Ivcenter -eq 3) {
$vcenter = "vCenter3"
} else {
$vcenter = "vCenter4"

write-host ""
Write-Host "You Picked: "$vcenter
write-host ""
start-sleep -s 3

# Connect to vCenter
connect-viserver $vcenter

# perform the work you wanted to perform.  use the $vcenter variable for the vCenter server name.

# Disconnect from vCenter
disconnect-viserver $vcenter -confirm:$false

If you wanted, for some reason, to connect to EVERY vCenter (one at a time), you can do this instead.  Keep in mind, it will not prompt you to choose, it will login to vCenter1, perform the task, disconnect, then repeat with vCenter2, etc.

This is good for scheduling things like exporting a copy of your VDS config on a regular basis, etc.

# PowerCLI script with list of vCenter servers
# Created by BLiebowitz on 11/11/2015

# Build array for each vCenter
$array = "vcenter1", "vcenter2", "vcenter3", "vcenter4"
for($count=0;$count -lt $array.length; $count++)

# Connect to vCenter
connect-viserver $array[$count]

# perform the work you wanted to perform.  use the $array[$count] variable for the vCenter server name. (including the brackets)


Hope you find this useful!

Ben Liebowitz, VCP, vExpert
NJ VMUG Leader


Migrating Roles & Privileges from an old vCenter to a new vCenter using PowerCLI

Posted by Ben Liebowitz

So we’re finally upgrading an old environment running vCenter 4.0 to a new vCenter running 5.5.  Instead of attempting an upgrade, we’re building new.  As it’s a new build, we had to find a way to migrate the roles & privileges to the new vCenter.

I have done this in the past utilizing the “Cheap Disaster Recovery” scripts from Gabe’s Virtual World.  You can find Gabe on twitter here! For some reason, the export script didn't work for me here. Perhaps the source environment is too old, but when I tried to edit the script to find the problem, I noticed the script was written before the Get-VIRole cmdlet was created in PowerCLI.

Then, I came across this CLONE ROLES BETWEEN TWO VIRTUAL CENTER SERVERS blog post by Grzegorz Kulikowski which talked about how to do the export/import using the Get-VIRole cmdlet.  Although his post was written for transferring one role at a time, I decided to expand on it and write a script to transfer ALL ROLES!  So, I wrote a “foreach” loop to capture each role, export the privileges, create the new role in the new vCenter and finally transfer the privileges over to the new role.  It then loops back to the next role… RINSE/REPEAT!

Any existing roles will error out, so you may see some _BLOOD SPLATTER_, but don’t worry.  Smile

# PowerCLI Script to Transfer Roles between vCenters
# Written by BLiebowitz on 11/6/2015

# Variables

# Set the PowerCLI Configuration to connect to multiple vCenters
Set-PowerCLIConfiguration -DefaultVIServerMode multiple -Confirm:$false

# Connect to both the source and destination vCenters
connect-viserver -server $VC1, $VC2

# Get roles to transfer
$roles = get-virole -server $VC1

# Get role Privileges
foreach ($role in $roles) {
[string[]]$privsforRoleAfromVC1=Get-VIPrivilege -Role (Get-VIRole -Name $role -server $VC1) |%{$}

# Create new role in VC2
New-VIRole -name $role -Server $VC2

# Add Privileges to new role.
Set-VIRole -role (get-virole -Name $role -Server $VC2) -AddPrivilege (get-viprivilege -id $privsforRoleAfromVC1 -server $VC2)

disconnect-viserver –server $VC1, $VC2

Hope you find it useful!

Ben Liebowitz, VCP, vExpert

NJ VMUG Leader


Place a vSphere Host into Maintenance Mode via PowerCLI

Posted by Ben Liebowitz

So, we had two different vSphere hosts, in two different environments, have hardware faults this week.  One had a bad memory module, and the other a bad FAN.  As I launched the VI client for each environment and placed the problem host into maintenance mode, I started to think… “I bet I can automate this!”

Depending on how complex your environment, you may or may not find this useful.  For me, I have 6 different production vCenter servers, one QA vCenter and a LAB vCenter.  Keeping all 8 Thick Clients open on my laptop can really kill the resources and I constantly get logged out of the web clients if I'm not clicking around.  BUT I always leave my PowerCLI window open and can connect  to the vCenter I need, quicker than launching the VI Client, typing in the name of the vCenter I want to connect to, selecting the Use Windows Session Credentials Check-box and clicking LOGIN.

Since I run my PowerCLI window with the same credentials as I use to login to each vCenter, I don't have to pass credentials or have it prompt me.  I just use the command below:

connect-viserver vCENTER

Now, if you already have the thick/web client open, it's probably faster to just right click on the host and enter maintenance mode.  However, if you're not yet connected to vCenter, using a script may be easier.  Also, if the part repair isn't going to be done until after hours, you can schedule the script to run later.  Especially, if you're not going to be online and are going to allow an on-site/NOC technician to handle it.  You'll probably want to add a command to shutdown the host also.

# Place the selected host into Maintenance Mode.
Get-VMHost -Name PROBLEM_HOST | set-vmhost -State Maintenance

# Shutdown the host
Stop-VMhost -VMhost PROBLEM_HOST -Confirm:$false

After I ran that command, I started to think about how I can expand on that and decided to have the script list out the hosts and let me choose the host from the list.  I also added a note how to remove that host from Maintenance Mode when I was ready, so I could just copy/paste that back into my PowerCLI window...  I left the shutdown command out of the script below as I don't always want to shutdown the host right away, but if you want to put it in, feel free!

# PowerCLI Script to place host into Maintenance Mode
# Created by BLiebowitz on 11/2/2015

# Choose which host to place into maintenance mode (you MUST connect to vCenter first)
Write-host "Choose which vSphere host to place into Maintenance Mode."
write-host ""
$IHOST = Get-VMhost | Select Name | Sort-object Name
$i = 1
$IHOST | %{Write-Host $i":" $_.Name; $i++}
$DSHost = Read-host "Enter the number for the host to place into Maintenance Mode."
$SHOST = $IHOST[$DSHost -1].Name
write-host "You have selected" $SHOST"."

# Place Selected host into Maintenance Mode

Get-VMHost -Name $SHOST | set-vmhost -State Maintenance

# Display Note how to exit the host from Maintenance Mode.
write-host ""
write-host "To exit Maintenance Mode, Copy/Paste and run the line below:"
write-host "get-vmhost -name $SHOST | set-vmhost -state Connected"

Hope you can find this script as useful!


Ben Liebowitz, VCP, vExpert
NJ VMUG Leader


You should backup your VDS Configs with PowerCLI

Posted by Ben Liebowitz

So, another vExpert that I follow on twitter (@h0bbel) recently had an issue in his home lab where he cut power to his lab, and his vDS lost all the portgroup names.  Seeing this post made me think, “I should probably backup MY vDS configs too, as my backups were pretty old!

Here are some PowerCLI commands that I found that could help you backup your config!   Also, here is the blog post I used for this script, written by Alan Renouf... AKA PowerCLI Man! (Link)

# PowerCLI script to backup vDS config
# Created by BLiebowitz on 10/22/2015

# Build array for each vCenter with vDS switch
$array = "vc1", "vc2", "vc3", "vc4"
for($count=0;$count -lt $array.length; $count++)

# Connect to vCenter
connect-viserver $array[$count]

# Get the name of each vSwitch
$vds = get-vdswitch

# Backup the entire vDS switch
get-vdswitch | export-vdswitch -Description "vCenter 5.5 vDS Switch" -Destination ("c:\VMware\vDS\"+ $array[$count] + "_" + $vds + ".zip") -Force

# Backup each individual Portgroup
Get-vdswitch | Get-vdportgroup | foreach {
Export-vdportgroup -vdportgroup $_ -Description "Backup of $($_.Name) PG" -Destination ("c:\VMware\vDS\" + $array[$count] + "\$($_.Name).zip") -Force
# Disconnect from vCenter
disconnect-viserver $array[$count] -confirm:$false
# Rince & Repeat

Backup your vDS configs TODAY!  Smile

- Ben Liebowitz, VCP, vExpert
NJ VMUG Leader


My First VMworld Experience

Posted by Ben Liebowitz








So, VMworld US 2015 was my first time being able to experience VMworld first hand, and not by streaming keynotes and watching recorded sessions months later.  As a VMUG Leader, I’ve experienced VMUG Meetings and UserCons before (both as a leader and a member) but this was a whole different animal!

First off, I have to credit my brother, Matt, for helping to guide my VMworld experience, introduce me to different VMworld regulars, recommend places to go, things to do, etc. I also have to thank VMUG Headquarters for sending me!


I arrived on Sunday afternoon and went to my hotel.  My room wasn’t ready yet, but I was able to drop off my bag.  I met my brother for lunch nearby at Maetron.  He introduced me to his friend Tim, who he has hung out with at every VMworld he’s attended.  We had a quick bite to eat and headed over so I could register.  We decided to go to Moscone South to register (they had registration at both South and West) as the Solutions Exchange was there and would be opening up later on.  Only, we find out, that materials pickup was only at Moscone West.  So we took the quick walk over to West, and I was able to grab my backpack.  We split up and met back at Moscone South just before the Solutions Exchange opened.  The Solutions Exchange area was massive.  I’ve seen large ball rooms with vendors setup before, but this reminded me of the Javitz center in NYC!  The booths were massive, with giant signs hanging from the ceiling.  Some even had a 2nd level!  I wish I had thought to take pictures.  I grabbed a couple that I found online to give some perspective to the size of the Solutions Exchange and the amount of people in attendance!  Hell, I may be in one of these pictures!



Sunday evening, I had dinner with Matt, Tim and Matt's coworker and friend from back when we used to work at CompUSA together, Dave.  It was good to relax after a long trip and talk about technology, conferences, users, etc.


Monday morning, I went straight to the VMUG Lounge in Moscone West to pickup VMUG Virt!  Virt is the VMUG Mascot and I was designated his guardian for the day on Monday.  My task was to bring Virt around, take pictures of him doing different things, and post them on social media.  This is a picture of VMUG Virt!

My first stop on Monday morning, was the PernixData Breakfast for people awarded with PernixPro or PernixPrime.  This was at the Thirsty Bear pub just past Moscone South.  This was Virt’s first visit somewhere, so I had to grab a picture of him with the sign to mark the occasion!  There I met with PernixData Sales Reps & Engineers from all over the country, PernixData users, other VMUG Leaders, etc.  It was a great networking event, even if they did run out of food and had to run to the store for more! Smile  Here is a picture of VMUG Virt outside the Thirsty Bear!


Next up was the VMworld 2015 General Session.  This is held in the big hall in Moscone North.  However, many people go to the HangSpace in Moscone North to watch it on the big screens setup there.  While my brother says this used to be a well-kept secret to view the Keynote, it’s become a very popular one.  It was tough to do, but I managed to find a seat and meet up with my brother and some friends.  The keynote was interesting to watch live (somewhat).  The demo of performing a vMotion between datacenters was great, and the fact that you can now perform a vMotion between your on-premises datacenter and vCloud Air is just amazing!  VMUG Virt got to take a picture here also!


Also setup in the Hangspace, along with ping pong/pool tables, refreshments, the EVO: Rail challenge area, was the VMware Snaps photobooth.  Here, you could take a picture in front of a green screen and in the background they would add one of 8 slogans.  Here are the pictures taken of myself and VMUG Virt.  Being a bacon aficionado, I had to choose Bacon.  Virt had to be a SuperHero!



Although I had booked up my schedule full of sessions to take, I ended up skipping some of them to either walk the Solutions Exchange floor, take a break in the VMUG Lounge, or just take some time to decompress…  The first session I attended was Take Virtualization to the Next Level:  vSphere with Operations Management.  This was a good session from Martin Yip and Himanshu Singh.  As my company recently purchased VSOM licenses instead of normal Enterprise Plus Licenses, this was an informative session on things that we’ll be able to do with Operations Management.  Here’s a picture of VMUG Virt waiting for his (and my) first session to start!  You’ll notice that I went to the Registration desk and got Virt a blank VMworld 2015 Badge!


After this session ended, I met up with my brother over in the VMworld Speakers Lounge, where he and his co-presenter Deji were having issues connecting to their lab environment for some live demos.  Here’s VIRT Hanging in the Speaker’s Lounge


While they worked with the VMworld AV staff on what turned out to be an issue with the IP Confirmation on Deji's laptop, Virt got up on stage and pretended to be a guest speaker.


After that, I went and walked the Solutions Exchange floor a bit.  I got to meet with several vendors, get contact info not only for myself but to bring new sponsors into my VMUG group!  Several vendor booths were always packed, like PernixData and Rubrik!  PernixData had a contest to give away a pretty nice Home Lab.  To win, you had to tweet a picture of yourself with the PernixData logo…  See my entry below.  Rubrik had a great idea to bring the Delorean from Back to the Future (complete with Mr. Fusion) and allow people to sit in it for photo ops!  See pictures of both VMUG Virt and myself going… BACK TO THE FUTURE!!




One of the next sessions I attended was at over in the Marriott…  vCenter Server Appliance (VCSA) Best Practices & Tips/Tricks.  This was a great session by William Lam.  Although I’m not using the VCSA in any of my environments currently, it was good to see as I could see us using the Fling to migrate to it eventually.

After the sessions, I had 3 evening events on my calendar that I was going to attempt to make…  The first one was the VMUG Leader Reception, at the W Hotel.  This was a very nice gathering with some entertainment, a booth where you could take a 10 second video in front of a screen and they printed out a flip book out of it, drinks, food, etc.  It was really great to be able to network with fellow VMUG Leaders from all over the world!  VMUG Virt also got to take a picture here.



Then, we (Virt and I) went to the PernixData: The DataCenter Awakens Cantina party, about 2 blocks from the W Hotel at the Minna Gallery, and it was packed!  I managed to get to the back where they had people dressed as Star Wars characters and you got to pose for pictures with them.  It was too crowded for my liking so after taking some pictures with the characters, I headed out.  Here is me at Virt battling Darth Vader and other characters below!


The last event on my list was the vBrisket event over at SouthPaw BBQ & Southern Cooking.  However, this was a bit of a walk and my feet were already ready to fall off, I decided to just go back to my hotel and crash for the night.  VMUG Virt decided to watch some TV before bed.



On Tuesday morning, I met up with Greg, one of the leaders of the NYC VMUG group, in order to hand off VMUG Virt as Greg was his keeper for the day on Tuesday.  After meeting Greg in the lobby of the hotel, I went to grab breakfast over in Moscone West and then headed to the Hang Space to meet my brother to watch the Tuesday morning Keynote.  Thankfully, this time it was much less crowded and we were able to find a spot to sit and comfortably watch.  This was a good keynote, with a surprise speaker from Microsoft talking about Windows 10 and using tools like Airwatch to manage it. Pat Gelsinger is also a very good, powerful speaker.  You can tell he has worked in the Tech field a long time and still gets excited at new advancements.

Next up was my brother’s session over at the Marriott.  Virtualize Active Directory, the Right Way.  The session was run by Deji Akomolafe and my brother, Matt Liebowitz.  This was a good session as my company is in the process of virtualizing the majority of our Domain Controllers will be virtual (where we have VMware Infrastructure that is).  They had some great suggestions about what to do with Time Sync, snapshots, etc.  Even though one of their demos failed, it was a very informative and humorous session.  As they say, you can’t always please the demo gods.  Next time, try sacrificing a small virtual animal (stuffed animal?)


After grabbing lunch and stopping by the VMUG Lounge for a while, I went to what ended up being one of my favorite sessions of the trip.  Becoming a vRealize Automagician: Why Automation isn’t Automatic.  This was a session led by Jad El-Zein.  He moderated a panel of 3 engineers from 3 different companies who talked about how they implemented vRA and how they used it, what issues they ran into in their journey, etc.  Being a VMUG Leader, I always like to see the customers talk about the products and how they use them and that’s exactly what Jad brought us here.  Great job guys!


After this session, I went back and wandered around the Solutions Exchange, again looking for info on new vendors I was not aware of, and potential VMUG sponsors for my local group in New Jersey.  VCE was giving away something, at this point I forget what, but to win you had to tweet yourself with your face in this stand-in…  the person in front of me used a stuffed animal in her picture, and the guy said I had to beat that… all I had in my bag that wasn’t something from another vendor was my bag of pretzels!  Needless to say, my pretzels didn’t win.


Tuesday night was the vExpert party at the Julie Morgan Ballroom, about a 20 min walk from my hotel.  I walked over to my brother’s hotel and we took a cab over together along with Tim.  As we pull up, we see someone in a VMware shirt at the curb next to a bunch of boxes.   He recognized our badges and asked if we were going to the vExpert event.  We were recruited to carry some boxes up, so we each grabbed a box, signed in at the front desk and up we went.  The boxes turned out to be VMware vExpert Polo Shirts sponsored by vCloudAir.  The party was fun and we got some good info about the vExpert program, how it’s growing, etc.  After grabbing dinner at a Japanese place we found near the vExpert party, I took a cab back to the hotel and crashed!

shirt1 shirt2


Wednesday morning, I grabbed breakfast and headed over to the session Instant Application Recovery and DevOps Infrastructure for VMware Environments – A Technical Deep Dive.  This was an in-depth look at Rubrik’s Converged Backup Appliance by Chris Wahl & Arvind "Nitro" Nithrakashyap.  I’m a big fan of Rubrik’s Converged Backup Platform and what they’re doing for the backup space.  At the beginning of the session, they handed out raffle tickets and at the end of the session, picked a winner for this awesome Star Wars Lego collection.  I WON!


2015-09-16 16_30_10-Chris Wahl (@ChrisWahl) _ Twitter


After the Rubrik session, was the VMUG Leader Luncheon at the Marriott.  This turned out to be a great event, as I got to meet a bunch of other leaders, talk to them about how they find sponsors, how/when/where they run their meetings, etc.  At the end, it turned into a roundtable discussion to go over issues we’re having as VMUG Leaders and how the other leaders or VMUG HQ could help!  I got some great suggestions out of this to bring back to my VMUG group!  Here a group shot with all the VMUG Leaders, with VIRT hidden in the middle!  I’m in the front row on the right side. Smile


After that, I headed over to the VMUG Lounge to relax before going back to my hotel to crash for a while before the VMworld Party at AT&T Park.  While at the lounge, I ran into Nigel Hickey, fellow VMUG Leader (Houston VMUG) & Author of the vExpert Spotlight blog series!  It was great to meet Nigel and learn he was originally from New Jersey! Below is the selfie Nigel took of us, as well as Steve Athanas with Virt shoved in his backpack!

VMware-Certification image

After texting back and forth with my brother about how I was thinking about bailing on the party, my brother convinced me to go and we met up outside of Moscone West to catch the buses to the event.  The event was billed as “Full Access to AT&T Park with headline entertainment by Neon Trees and Alabama Shakes.”  When we got there, what we found was amazing!  All the concession stands were open and FREE, as well as carnival booths setup down on the field where you could play games and each win won a prize!  All while the band(s) played on the stage. It was a great time and I’m glad I went!  I even managed to win a stuffed animal (a pig of course) to bring home for my son (18 months old at the time), Shane!  Thanks Matt for helping me to win and staying in line to play over and over and over again until one of us won! Smile

20150902_193350 20150902_194057


Thursday morning, I packed up my bags and headed over to Moscone West to drop off my luggage at the bag check and have breakfast.  I met my brother and we hung out in the lounge area on the 2nd floor instead of heading to the General Session.  I headed over to the VMUG Lounge to work the booth until it was time for my to head to the airport at 1pm.  While at the lounge, I got to hang with VMUG Virt for a bit again, I manned the VMUG Plinko board (which ended up being me doing squats for 2 and a half hours, which I paid for with sore leg muscles for a few days!)  On the Plinko board you could win a Pen, a Pin, a Patch, a VMUG USB Fan, or the grand prize (an entry into a contest for a $500 travel voucher).  It was fun and enabled me to meet a lot of the VMUG Members and other VMUG Leaders!  Before I left to head home, I got a group shot of VIRT with the VMUG HQ Staff!





Overall, I had a great trip, met a lot of people, learned a few things, and was able to network a bit for my local VMUG group in New Jersey.  I hope I'm able to return again next year at VMworld 2016 Las Vegas!


PowerCLI Script to list VMs not specifically set to Thick Eager Zeroed

Posted by Ben Liebowitz

First, I’ll start with a little back story.

We recently deployed an EMC XTremIO All-Flash storage appliance.   The recommendation we got from EMC, for the best deduplication ratios, was to use the Thick-Eager Zeroed disk format.  No matter how many times I tell my coworkers to make sure to use this format when deploying VMs to the xTremIO LUNs, once in a while, someone does forgets and deploys a THIN provisioined VM.

Also, we found that when performing P2Vs using the VMware Standalone Converter, when you choose the THICK disk format, it does the P2V and uses the Thick-Lazy Zeroed format.

To prepare for the script, I use folders in the Datastores & Datastore Clusters Inventory View.  I have a parent folder for each SAN, and may have sub folders for datastores dedicated to certain functions, say Microsoft Exchange, etc.  I also put all the LOCAL drives into a folder as well. 

You could very easily modify the script below to modify the script to show anything not THIN provisioned by changing “EagerZeroedThick” to “Thin”.

Here is the script:

Connect-viserver VCENTER_NAME

get-folder -name SAN_NAME |
Get-VM |
Get-HardDisk |
where {$_.StorageFormat -ne "EagerZeroedThick"} |
select Parent,StorageFormat,Filename |
export-csv c:\VMware\diskformat.csv -notypeinformation -useculture

PowerCLI Script to change the DRS Slider

Posted by Ben Liebowitz

So, I have a cluster of hosts that makes up our QA Environment.  As with most QA environments, it’s tight on resources and very over-subscribed.  On a regular basis, I have to move our DRS Slider to be more aggressive, RUN DRS to refresh recommendations, and then move the slider back.  This allows DRS to rebalance the cluster.  Today, I decided to script it.

I made use of a script that @lucd22 posted ( to change the DRS Migration Threshold (slider value).

Here is the script:

# Set Variables
$clusName = CLUSTER_NAME

# Connect to your vCenter
Connect-VIServer $vCenter

# Change DRS Slider to Most Agressive
# Choose the value of the slider, 1 being most agressive, and 5 being most conservative
$rate = 1

write-host "Changing DRS Migration Threshold to most agressive"

$clus = Get-Cluster -Name $clusName | Get-View

$clusSpec = New-Object VMware.Vim.ClusterConfigSpecEx
$clusSpec.drsConfig = New-Object VMware.Vim.ClusterDrsConfigInfo
$clusSPec.drsConfig.vmotionRate = $rate
$clus.ReconfigureComputeResource_Task($clusSpec, $true)

# Run DRS to get new recommendations and apply them

write-host "Refreshing DRS Recommendations"
Get-DrsRecommendation -Cluster $clusName -Refresh

# Change DRS Slider back to normal

write-host "Changing DRS Migration Threshold back to Normal"

$rate = 2

$clus = Get-Cluster -Name $clusName | Get-View

$clusSpec = New-Object VMware.Vim.ClusterConfigSpecEx
$clusSpec.drsConfig = New-Object VMware.Vim.ClusterDrsConfigInfo
$clusSPec.drsConfig.vmotionRate = $rate
$clus.ReconfigureComputeResource_Task($clusSpec, $true)

- Ben Liebowitz
Twitter:  @ben_liebowitz


PowerCLI Script to migrate VMs from one vCenter to another

Posted by Ben Liebowitz

Hey everyone, this is another guest post from Ben Liebowitz, Matt’s brother.

Before I get into the script, I’ll give you some background…  We are working on migrating VMs off of our vSphere 4.1 environment to our new vSphere 5.5 environment.  The 4.1 environment is using the Nexus 1000v Virtual Switch while the 5.5 environment is using a vDS switch.

We found the easiest way to migrate the VMs was to remove them from inventory on the 4.1 side and then add them to inventory on the 5.5 side (as all the hosts in each environment saw the same storage).  Doing this manually for approx 250 VMs was painful, so I scripted the process.

I started with exporting the VM’s information regarding its name, datastore location, Network Portgroup(s), & folder location.  I found that by using the folder location in Get-VM, I was just getting it’s current folder name and not the full path.  Being I have folder name duplicates (one in an Internal Folder and the same structure in a DMZ folder) I needed a way to list the full path.  Thankfully, I found a Function written by Luc Dekens (@LucD22 / that he called #BlueFolderPath that solved my problem.

After that, I was able to connect to the 4.1 vCenter, export my list, shutdown the VM, remove it from inventory, then connect to my 5.5 vCenter, browse that same datastore, add the VM to inventory on the other side, move the VM to its original folder location, set the proper network portgroup, upgrade the virtual hardware, power the VM on, and finally upgrade the VMware tools.


# Define Variables
$vcenter41 = “your existing vcenter”
$vcenter55 = “your new vcenter”
$vsphere55host = “one of the vSphere 5.5 hosts to migrate to”
$datacenter = “datacenter name”
$csvfile = “path to csv”

#Build the BlueFolderPath function
New-VIProperty -Name 'FullPath' -ObjectType 'VirtualMachine' -Value {

$current = Get-View $vm.ExtensionData.Parent
$path = ""
do {
$parent = $current
if($parent.Name -ne "vm"){$path =  $parent.Name + "/" + $path}
$current = Get-View $current.Parent
} while ($current.Parent -ne $null)
} -Force | Out-Null

#Build the Get-folderbypath function
function Get-FolderByPath {
.SYNOPSIS  Retrieve folders by giving a path
.DESCRIPTION The function will retrieve a folder by it's
path. The path can contain any type of leave (folder or
.NOTES  Author:  Luc Dekens
The path to the folder.
This is a required parameter.
.PARAMETER Separator
The character that is used to separate the leaves in the
path. The default is '/'
PS> Get-FolderByPath -Path "Folder1/Datacenter/Folder2"
PS> Get-FolderByPath -Path "Folder1>Folder2" -Separator '>'

[parameter(Mandatory = $true)]
[char]${Separator} = '/'

if((Get-PowerCLIConfiguration).DefaultVIServerMode -eq "Multiple"){
$vcs = $defaultVIServers
$vcs = $defaultVIServers[0]

foreach($vc in $vcs){
foreach($strPath in $Path){
$root = Get-Folder -Name Datacenters -Server $vc
$strPath.TrimStart($Separator).Split($Separator) | %{
$root = Get-Inventory -Name $_ -Location $root -Server $vc -NoRecursion
if((Get-Inventory -Location $root -NoRecursion | Select -ExpandProperty Name) -contains "vm"){
$root = Get-Inventory -Name "vm" -Location $root -Server $vc -NoRecursion
$root | where {$_ -is [VMware.VimAutomation.ViCore.Impl.V1.Inventory.FolderImpl]}|%{
Get-Folder -Name $_.Name -Location $root.Parent -Server $vc

# Enable connections to multiple vCenters
Set-PowerCLIConfiguration -DefaultVIServerMode Multiple -Scope AllUsers -Confirm:$false

# Connect to 4.1 vCenter
connect-viserver vsphere41

# export list of VMs to Migrate to CSV
Get-Datacenter -name "datacenter" | Get-VM |
Select Name, @{N="Datastore";E={Get-Datastore -VM $_ | Select -ExpandProperty Name}},
@{N="Network";E={Get-VirtualPortgroup -VM $_ | Select -ExpandProperty Name}},
@{N="Parent";E={$_.FullPath}} |
Export-Csv "c:\migrate.csv" -NoTypeinformation -UseCulture

# Get VMs to Migrate
$migrate = Get-Datacenter -name "datacenter"

# Shutdown VMs (cleanly)
$migrate | Get-VM | Shutdown-VMGuest -Confirm:$false

# Wait for VMs to shutdown
start-sleep -s 60

# Remove VMs from Inventory
Get-datacenter -name "datacenter" | Get-Inventory | Remove-Inventory -Confirm:$false

# Connect to 5.5 vCenter
connect-viserver vsphere55

# Set a host in vcenter5.5 to add them to.
$esxhost = "vsphere01.domain.local"

## Add backto inventory & Change network for VMs
foreach ($row in (Import-Csv $csvfile)) {
$vmName = $row.Name
$vmxfile = "[$($row.Datastore)] $($vmName)/$($vmName).vmx"
$vmNewVM = New-VM -VMFilePath $vmxfile -VMhost $esxhost

# Move VM to existing folder locaiton
Move-VM -VM $row.Name -Destination (get-folderbypath $row.Parent)

# Change Network Portgroup
$vm = get-vm -Name $row.Name
Get-NetworkAdapter -VM $vm | Set-NetworkAdapter -NetworkName $row.Network -Confirm:$false

# Upgrade Virtual Hardware
Set-VM -VM $vmName -Version v10

# Poweron VMs
Start-VM -VM $row.Name -Confirm:$false | wait-tools
Get-VMQuestion -VM $vm | Set-VMQuestion –Option "I moved it" -confirm:$false

# Update VMware Tools
update-tools $vmName -Confirm:$false
start-sleep -s 300

} ## end foreach



Resolving .NET path issues when installing vRA App Services bootstrap

Posted by Matt Liebowitz


Much as I tried to get this to work with Windows Server 2012 R2, it won't.  You need to install .NET 2.0/3.0 on Windows Server 2012 R2 in order to get the bootstrap service to work.  It will install everything properly but I was unable to get the Windows service to actually start without .NET 2.0/3.0.

See screenshot to show the .NET version that is required.


As I continue on my vRealize Automation Application Services journey, I thought I’d share the solution to another issue I ran into.  While preparing a Windows guest to be used as a tempate for vRA Application Services, I ran into trouble installing the Application Services agent bootstrap.

With the agent bootstrap downloaded and extracted to c:\temp, I tried to follow the documentation and execute the install.bat with the appropriate parameters. Here is the output that I received:

  VMware vCloud Application Director agent services (vcd/vcac) installation script.
* Install vCAC VRM agent.
* Install Application Director agent bootstrap as a windows service.
* Create darwin user.

Look for InstallUtil.exe...
Attempting to use C:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe
for installing the bootstrap executable as a Windows service.
ERROR: C:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe not found.

Agent bootstrap installation aborted. Please address errors and run this installation again.

I bolded the error to make it obvious.  Since I’m using a Windows Server 2012 R2 template, it comes preinstalled with a newer version of the .NET Framework (4.5.1) than what it is expecting (2.0).  The folder it’s looking for (C:\Windows\Microsoft.NET\Framework\v2.0.50727) is present on Windows Server 2012 R2, but the InstallUtil.exe file is not there.  If this were Windows Server 2008 R2 then this script would work as is but it doesn’t work with Windows Server 2012 or 2012 R2.

To fix it, I simply modified the install.bat file and modified the following line to point it to the right folder (see bolded piece):

REM Util for installing the bootstrap executable as a Windows service.
set installutilexe=%SystemDrive%\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe

..and changed it to read the following:

REM Util for installing the bootstrap executable as a Windows service.
set installutilexe=%SystemDrive%\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe

Once I did this, I was able to get the bootstrap installation script to run without an issue.  I couldn’t find anything in VMware’s documentation or other blogs that told me to do this so I figured I’d blog about it.  If you have other workarounds or can point me to where this is documented, leave me a comment.

Hope this helps someone out there!

Go to top ↑