Pages: [1]
Print
Author Topic: show portgroups VM's are connected to  (Read 768 times)
pimmm
Newbie
*
Posts: 1


View Profile Email
« on: September 08, 2009, 04:04:05 AM »

hello,

is there a way to create a list of all vm's and the name of the vswitches they are connected to ?
i am new to the whole powershell thing Smiley

thanks,

Omar
Logged
esarakaitis
Administrator
Full Member
*****
Posts: 218


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« Reply #1 on: September 08, 2009, 08:18:07 AM »

yep... how far have you gotten?
Logged
esarakaitis
Administrator
Full Member
*****
Posts: 218


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« Reply #2 on: September 08, 2009, 08:26:56 AM »

try this:

Code:
$vms = Get-VM
foreach($vm in $vms){
  $pgvm = Get-VirtualPortGroup -VM $vm | select Name
  $pgsinfo = ""
  foreach($pg in $pgvm){
     $pgsinfo += ($pg.Name + " ")
  write-host $vm.Name $pgsinfo
  }
}
« Last Edit: September 08, 2009, 08:29:14 AM by esarakaitis » Logged
gurjit_d
Newbie
*
Posts: 5


View Profile Email
« Reply #3 on: September 29, 2009, 03:50:42 AM »

get the the list of Vm's connected to particular Vlan?
Logged
esarakaitis
Administrator
Full Member
*****
Posts: 218


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« Reply #4 on: September 29, 2009, 01:26:39 PM »

did that give you want you wanted?
Logged
gurjit_d
Newbie
*
Posts: 5


View Profile Email
« Reply #5 on: September 29, 2009, 09:58:03 PM »

sorry my above question got type mistake,
I want to ask is there any way we can find out the vlan Id and the vm attach to it.

Vlan 01
   |
Logged
gurjit_d
Newbie
*
Posts: 5


View Profile Email
« Reply #6 on: September 29, 2009, 10:00:35 PM »

sorry my above question got type mistake,
I want to ask is there any way we can find out the vlan Id and the vm attach to it. in the below sequence.

Vlan 01
   |
 Vm1
    |
 Vm2



Vlan 02
   |
 Vm1
   |
 Vm3
  |
 VM4
Logged
esarakaitis
Administrator
Full Member
*****
Posts: 218


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« Reply #7 on: September 30, 2009, 07:43:28 AM »

the above script does that, just import the data into excel and manipulate
Logged
KristianW
Newbie
*
Posts: 13


View Profile
« Reply #8 on: October 27, 2009, 09:39:47 AM »

I am looking for something like this, but cannot (as usual) get my head around the problem.

What I need is to list all VMs connected to specific VLAN (id or name)

This script lists ALL vms and corresponding VLAN. I would like it to just list vms in ex. VLAN 800
Is that possible?

Logged
esarakaitis
Administrator
Full Member
*****
Posts: 218


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« Reply #9 on: October 27, 2009, 04:50:04 PM »

dump them all, then sort using excel... make it easy.
Logged
Pages: [1]
Print
Jump to: