;; 
;;=====================================================================================----- 
;; 
;;FUNCTION       MappedDrives() 
;; 
;;ACTION         returns a list of drive mappings via WSH 
;; 
;;AUTHOR         Glenn Barnas 
;; 
;;VERSION        1.0  - 4/17/2008 
;; 
;;HISTORY        1.0  - 4/17/2008 
;; 
;;SYNTAX         MappedDrives() 
;; 
;;PARAMETERS     None 
;; 
;;REMARKS        None 
;; 
;;RETURNS        Array of 2-element arrays. Each sub-array contains the drive letter 
;;               that is mapped, and the UNC path it is mapped to. One  
;; 
;;DEPENDENCIES   windows net.exe command 
;; 
;;TESTED WITH    W2K, WXP, W2K3, Vista 
;; 
;;EXAMPLES       $aMapped = MappedDrives() 
;;               For Each $Map in $aMapped 
;;                 $Map[0] ' is mapped to ' $Map[1] 
;;               Next 
; 
Function MappedDrives()
 
  Dim $oExec, $Output, $aTmp, $Tmp, $aOut, $I
 
  $oExec = CreateObject("WScript.Shell").Exec('%COMSPEC% /c net use | %SYSTEMROOT%\System32\find.exe "\\"')
  If Not VarType($oExec)=9 $MappedDrives="WScript.Shell Exec Unsupported" Exit 10 EndIf
  $Output = $oExec.StdOut.ReadAll
  $aTmp = Split($Output, @CRLF)
  $I = -1
  For Each $Tmp in $aTmp
    If $Tmp
      $I = $I + 1
      ReDim Preserve $aOut[$I]
      $aOut[$I] = SubStr($Tmp, 14, 2),  Split(SubStr($Tmp, 24), 'Micro')[0]
    EndIf
  Next
 
  $MappedDrives = $aOut
  Exit($oExec.ExitCode)
 
EndFunction