I am writing a powerscript that connects to a target through ISCSi. I need to find the new drive letters (F:
, G:
, …) that is created after connecting. Is there any direct way to find that? MY script would be
New-IscsiTargetPortal -TargetPortalAddress $VirtualDeviceIp
Connect-IscsiTarget -NodeAddress $VirtualDeviceIQN
#Get the drives newly attached
Though not straight I tried another way of doing it.
$initial=Get-Volume
New-IscsiTargetPortal -TargetPortalAddress $VirtualDeviceIp
Connect-IscsiTarget -NodeAddress $VirtualDeviceIQN
$final=Get-Volume
#Now compare $initial and $final to find the newly attached disks
But I dont know implement the second idea too :(