Advertisements

Virtualization, Cloud, Infrastructure and all that stuff in-between

My ramblings on the stuff that holds it all together

Posh1Liner – Add ESX Host to vCenter

#Connect to vCenter server
$vc = connect-viserver -name l2-mgt-vcsa01.theborg.int
Add-VMHost -server $vc -name L2-C1-N4.theborg.int -location theBORG -user root -Password YourPassword -force -RunAsync

#then add to cluster L2-C1
Move-VMHost L2-C1-N1.theborg.int -destination L2-C1

#Add a bunch of hosts to vCenter 1 liner
for($i=99; $i -le 102; $i++) {$runline= “L2-C2-N” + $i +”.theborg.int” ; Add-VMHost -server $vc -name $runline -location theBORG -user root -Password VMware1! -force -RunAsync}

#put hosts following a naming pattern into maintenance mode
get-vmhost -name L2-c2* | set-vmhost -state maintenance

#move ESX host called L2-C2-N$i to L2-C2 cluster

for($i=2; $i -le 8; $i++) {$runline= “l2-c2-n” + $i +”.theborg.int” ; move-VMHost $runline -server $vc -destination L2-C2}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: