0

I am trying to get volume name from Iscsi target. But i can get only nodeaddress.

Get-IscsiTarget | select NodeAddress

NodeAddress is having volume name plus some unique identification strings.

Is it possible to get the volume name alone from IScsi target?

Samselvaprabu
  • 16,830
  • 32
  • 144
  • 230
  • Use `Get-Member` on it and find out? According to [the documentation](https://technet.microsoft.com/en-us/library/hh826102(v=wps.630).aspx), it returns a CIM-wrapped object – Maximilian Burszley Jan 02 '18 at 13:50

1 Answers1

1

I'm guessing here, but you might be able to just do this:

Get-IscsiTarget | Get-iSCSISession | Get-Disk -iSCSISession | Get-Partition | Get-Volume

Otherwise, the iSCSI documentation suggests something like this might get you a MSFT_Disk from the MSFT_iSCSITarget that Get-IscsiTarget returns, and the Storage Management documentation suggests you can get to volumes from that.

Get-IscsiTarget | 
    Get-CimAssociatedInstance -Association MSFT_iSCSITargetToiSCSISession -Namespace 'root\microsoft\windows\storage' -KeyOnly |
    Get-CimAssociatedInstance -Association MSFT_iSCSISessionToDisk  -Namespace 'root\microsoft\windows\storage' -KeyOnly |
    Get-CimAssociatedInstance -Association MSFT_DiskToPartition -Namespace 'root\microsoft\windows\storage' -KeyOnly |
    Get-CimAssociatedInstance -Association MSFT_PartitionToVolume -Namespace 'root\microsoft\windows\storage'

That should return the MSFT_Volume. I'm not 100% sure about the namespaces above.

Bacon Bits
  • 30,782
  • 5
  • 59
  • 66