Pages: [1]
Print
Author Topic: New portgroup one-liner  (Read 1209 times)
esarakaitis
Administrator
Sr. Member
*****
Posts: 256


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« on: July 07, 2009, 09:26:43 AM »

get-cluster "Cluster" | Get-VMHost | Get-VirtualSwitch -name "vSwitch0" | New-VirtualPortGroup "VLAN" -vlanid 123
Logged
tteller
Newbie
*
Posts: 3


View Profile
« Reply #1 on: July 13, 2009, 11:39:39 AM »

I like this one-liner....  I have a question or a request:

If I have a few ESX hosts that have the portgroup already defined, how can I use this one-liner to add the new VLAN to the remaining ESX Servers.  I tried to run this script and it errors out on the first esx host that already had the VLAN defined.

Thanks,
Tim T
Logged
esarakaitis
Administrator
Sr. Member
*****
Posts: 256


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« Reply #2 on: July 13, 2009, 12:27:14 PM »

did it stop at the error? could always try using:

trap [Exception] {continue}

or

$erroractionpreference = "SilentlyContinue"

« Last Edit: July 13, 2009, 12:33:51 PM by esarakaitis » Logged
Pages: [1]
Print
Jump to: