0

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 
192.168.1.2  | 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

shallrise
  • 89
  • 1
  • 13

1 Answers1

0

Slow working script with output like:

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

Script:

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}},
@{N='Datastore';E={$ds.Name}},
ScsiLun,LunPath,SanId

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

shallrise
  • 89
  • 1
  • 13