Automation

 View Only
  • 1.  Gettting all Networkt Adapter info from all our VMs

    Posted Jun 10, 2011 08:29 PM

    Hi Guys,

    I'm playing with this script trying to get all the network info from our VMs, i can find that info but from one vm at a time, can i have something to get that info from all my VMs in the cluster ??

    Here the script: Get-NetworkAdapter -VM "VM_NAME"

    Thanks in advance.



  • 2.  RE: Gettting all Networkt Adapter info from all our VMs

    Posted Jun 10, 2011 08:41 PM

    You can get the network adapters of all VM's with:

    Get-VM | Get-NetworkAdapter | Select-Object -Property *

    Regards, Robert



  • 3.  RE: Gettting all Networkt Adapter info from all our VMs

    Posted Jun 10, 2011 10:35 PM

    For all VMs in a cluster, you can do

    Get-Cluster -Name MyCluster | Get-VM | Get-NetworkAdapter


  • 4.  RE: Gettting all Networkt Adapter info from all our VMs

    Posted Jun 11, 2011 07:42 PM

    Hi Guys,

    Thanks for your reply.

    Any way to modify the script to get this info and exported to a .csv format?, few VMs in our cluster have more than one NIC card.

    VM NameNIC Name : NIC Type : Network Name : Connection State : MAC Address : WakeOnLine Enable

    Thanks in advance LucD and Robert.



  • 5.  RE: Gettting all Networkt Adapter info from all our VMs

    Posted Jun 11, 2011 09:29 PM

    The next script lists the required properties of the network adapters of all VM's of cluster MyCluster to a csv file called NetworkAdapters.csv.

    Get-Cluster -Name MyCluster | Get-VM | Get-NetworkAdapter | `
    Select-Object -Property `
    @{N="VM Name";E={$_.Parent}},
    @{N="NIC Name";E={$_.Name}},
    @{N="NIC Type";E={$_.Type}},
    @{N="Network Name";E={$_.NetworkName}},
    @{N="Connection State";E={$_.ConnectionState}},
    @{N="MAC Address";E={$_.MacAddress}},
    @{N="WakeOnLan Enabled";E={$_.WakeOnLanEnabled}} | `
    Export-Csv -Path NetworkAdapters.csv -NoTypeInformation -UseCulture
    
    



  • 6.  RE: Gettting all Networkt Adapter info from all our VMs

    Posted Jun 12, 2011 04:18 PM

    Thanks guys, exactly what I was looking for.

    Thanks.



  • 7.  RE: Gettting all Networkt Adapter info from all our VMs

    Posted Jun 13, 2011 03:11 PM

    The virtual machine names aren't coming through for me on this one:

    "VM Name","NIC Name","MAC Address"

    ,"Network adapter 1","00:50:56:99:78:53"

    ,"Network adapter 1","00:50:56:81:0d:b2"

    Script:

    Get-VM | Get-NetworkAdapter | `
    Select-Object -Property `
    @{N="VM Name";E={$_.Parent}},
    @{N="NIC Name";E={$_.Name}},
    @{N="MAC Address";E={$_.MacAddress}} | `
    Export-Csv -Path NetworkAdapters.csv -NoTypeInformation -UseCulture

    (I didn't need the extra info and needed it for each VM under the VC, so altered the script a bit).



  • 8.  RE: Gettting all Networkt Adapter info from all our VMs

    Posted Jun 13, 2011 04:14 PM

    Check your PowerCLI version.

    Do a

    Get-PowerCLIVersion


  • 9.  RE: Gettting all Networkt Adapter info from all our VMs

    Posted Jun 13, 2011 05:16 PM

    Looks like 4.0, U1.

    PowerCLI Version
    ----------------
    VMware vSphere PowerCLI 4.0 U1 build 208462

    I read the installation guides for newer versions of PowerCLI and saw this, which conflicts with some of our environment (Some ESX still at 3.5, U4).

    vSphere PowerCLI is compatible with the following VMware environments:

    vSphere PowerCLI is compatible with the following VMware environments:
     VMware ESX 4.1/vCenter Server 4.1
     VMware ESXi 4.1
     VMware ESX 4.0 Update 1/vCenter Server 4.0 Update 1
     VMware ESXi 4.0 Update 1
     VMware ESX 3.5 Update 5
     VMware ESXi 3.5 Update 5

    We have VC 4.1 managing ESX (3.5U4,4.0U1)



  • 10.  RE: Gettting all Networkt Adapter info from all our VMs

    Posted Jun 13, 2011 06:03 PM

    I replied in your other thread.