I need to turn off one of the FC switch for maintenance. To turn off the switch smoothly, I want to set the manual path selection mode and switch all datastores to the second switch. I have a lot of datastores, so I wanted to create a csv file in which I could see invofrmation to be sure that I did not miss anything: For example:

Host         | Datastore | Active Target  | DS-01     | 21:00:00:1b:32:8f:d0:a5 

Unfortunately, all that I found on the Internet and tried to do it myself is to get HBAName, Target and State. I dont know how to comapre HBAName like "vmhba1:C0:T4:L1" with Identifier of Datastore and convert this to Datastore Name in one csv file.

I tried to rewrite these examples:

https://code.vmware.com/forums/2530/vsphere-powercli#569333 https://communities.vmware.com/thread/462782


Slow working script with output like:

VMHost    :
Datastore : Datastore1-lun01
ScsiLun   : eui.6635646538633463
LunPath   : vmhba2:C0:T1:L1
SanId     : 21:00:00:1B:32:8F:D0:A5


Get-Datastore -PipelineVariable ds |
where{$_.Type -eq 'VMFS' -and $_.ExtensionData.Summary.MultipleHostAccess } |
Get-ScsiLun -PipelineVariable lun |
Get-ScsiLunPath | 
where{$_.Preferred} |
Select @{N='VMHost';E={$lun.VMHost.Name}},

By LucD via: https://code.vmware.com/forums/2530#602860|4488474

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.