You might like to look at COM objects to get the info you need, e.g.
$o_network = CreateObject("Wscript.Network")
$drivelist = $o_network.EnumNetworkDrives
;$drivelist is a collection i.e. an array that associates pairs of items - network drive local names (e.g. "j:") and their associated UNC names. Even-numbered items in the collection represent local names of logical drives. Odd-numbered items represent the associated UNC share names. The first item in the collection is at index zero (0).

$No_of_drives = $drivelist.count ;Count the no. of items in the drive list collection.
For $i= 0 to $No_of_drives -1 step 2
.....
Next