Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Getting WWN from VMGuest names using PowerCLI script

Posted on 2016-10-12
11
46 Views
Last Modified: 2016-11-02
Can anyone help me with pulling WWN based on VMguest?
I can do it based on VMHost but this is not exactly what is being asked of me.

I have a list of several hundred VM guests and was asked for their DataStore info and WWN info, I was able to get the DataStore info, but am not sure how to get the WWN per VMguest name.

Any help?
0
Comment
Question by:alexr54
  • 6
  • 5
11 Comments
 
LVL 21

Expert Comment

by:Mazdajai
ID: 41841750
Does all those VMs have Raw Disk Mapping (rdm)?
0
 
LVL 2

Author Comment

by:alexr54
ID: 41842171
Yes I believe they all are.
0
 
LVL 2

Author Comment

by:alexr54
ID: 41842183
I was using this script to pull the WWN and other info from the VMhost. However I was not able to tie this to a list of VMguests.

   $report = Get-Datacenter | % {    

      $datacenter=$_  

      foreach($esx in Get-VMhost -Location $datacenter){  

        $esxcli = Get-EsxCli -VMHost $esx  

        $nic = Get-VMHostNetworkAdapter -VMHost $esx | Select -First 1 | select -ExpandProperty Name  

        $hba =Get-VMHostHBA -VMHost $esx -Type FibreChannel | where {$_.Status -eq "online"} |  Select -First 1 |select -ExpandProperty Name  

        Get-VMHostHBA -VMHost $esx -Type FibreChannel | where {$_.Status -eq "online"} |  

        Select @{N="Datacenter";E={$datacenter.Name}},  

                @{N="VMHost";E={$esx.Name}},  

                @{N="HostName";E={$($_.VMHost | Get-VMHostNetwork).HostName}},  

                @{N="version";E={$esx.version}},  

                @{N="Manufacturer";E={$esx.Manufacturer}},  

                @{N="Hostmodel";E={$esx.Model}},  

                @{Name="SerialNumber";Expression={$esx.ExtensionData.Hardware.SystemInfo.OtherIdentifyingInfo |Where-Object {$_.IdentifierType.Key -eq "Servicetag"} |Select-Object -ExpandProperty IdentifierValue}},  

                @{N="Cluster";E={  

                    if($esx.ExtensionData.Parent.Type -ne "ClusterComputeResource"){"Stand alone host"}  

                    else{  

                        Get-view -Id $esx.ExtensionData.Parent | Select -ExpandProperty Name  

                    }}},  

                Device,Model,Status,  

                @{N="WWPN";E={((("{0:X}"-f $_.NodeWorldWideName).ToLower()) -replace "(\w{2})",'$1:').TrimEnd(':')}},  

                @{N="WWN";E={((("{0:X}"-f $_.PortWorldWideName).ToLower()) -replace "(\w{2})",'$1:').TrimEnd(':')}},  

              # @{N="Fnicvendor";E={$esxcli.software.vib.list() | ? {$_.Name -match ".*$($hba.hbadriver).*"} | Select -First 1 -Expand Vendor}},  

                @{N="Fnicvendor";E={$esxcli.hardware.pci.list() | where {$hba -contains $_.VMKernelName} |Select -ExpandProperty VendorName }},  

                @{N="fnicdriver";E={$esxcli.system.module.get("fnic").version}},  

                @{N="enicdriver";E={$esxcli.system.module.get("enic").version}},  

               # @{N="Enicvendor";E={$esxcli.software.vib.list() | ? {$_.Name -match ".net.*"} | Select -First 1 -Expand Vendor}}  

                 @{N="Enicvendor";E={$esxcli.hardware.pci.list() | where {$nic -contains $_.VMKernelName} |Select -ExpandProperty VendorName }}  

                 #@{N="Enicvendor";E={$esxcli.network.nic.list() | where {$vmnic.name -eq $_.vmnic1} | select -First 1 -ExpandProperty Description }}  

      }  

}

$report | Export-Csv WWNreport.csv -NoTypeInformation -UseCulture

Open in new window

0
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 
LVL 21

Expert Comment

by:Mazdajai
ID: 41842243
It is very unlikely to have RDM on "several hundred" virtual machines as RDM is a special configuration that allow vm to attach to the raw storage.

Only vm with RDM would have WWN needed -

https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2001823
0
 
LVL 2

Author Comment

by:alexr54
ID: 41842305
I suppose I fall in that rare category.
For the VMguests with RDM, anyway to get the WWN?
0
 
LVL 2

Author Comment

by:alexr54
ID: 41842540
I guess what I am hoping for is a way to gather the VMFS info per VMGuest, which includes any and all possible datastore information.
LUN, DatastoreName, Capacity, guestname are most important.
0
 
LVL 21

Expert Comment

by:Mazdajai
ID: 41843012
Yes I believe they all are.
Do you have access to login and check? Again, having several hundred vms with RDM is unlikely. I am very interested to know, and perhaps you can prove me I am wrong.

I am not aware there is a powercli to query WWN on guest. But you can use get-harddisk cmdlet to determine if is a RDM disk, then it has WWN.

https://www.vmware.com/support/developer/PowerCLI/PowerCLI41/html/Get-HardDisk.html
0
 
LVL 2

Author Comment

by:alexr54
ID: 41843639
I am in a very large company. So like I said I probably fall in that very rare category.
I did some more research and I cant find a way to pull the information I need without some sort of storage plugin.
0
 
LVL 21

Accepted Solution

by:
Mazdajai earned 500 total points (awarded by participants)
ID: 41844556
It has nothing to do with the size the company.

RDM disks has it limitation therefore it normally be "all" of your  
vms. You can query the WWNs within the guest (windows or Linux) , you don't need s storage plugin to accomplish it.
0
 
LVL 21

Expert Comment

by:Mazdajai
ID: 41844559
Can you post one of screen shot  in vsphere that is running rdm?
0
 
LVL 2

Author Comment

by:alexr54
ID: 41844564
Yes on Monday when I get to the office I'll take a screen shot
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
Giving access to ESXi shell console is always an issue for IT departments to other Teams, or Projects. We need to find a way so that teams can use ESXTOP for their POCs, or tests without giving them the access to ESXi host shell console with a root …
This Micro Tutorial steps you through the configuration steps to configure your ESXi host Management Network settings and test the management network, ensure the host is recognized by the DNS Server, configure a new password, and the troubleshooting…
This video shows you how easy it is to boot from ISO images for virtual machines with the ISO images stored on a local datastore on the ESXi host.

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question