;; 
;;=====================================================================================----- 
;; 
;;FUNCTION       MappedPrinters() 
;; 
;;ACTION         returns a list of print mappings via WSH 
;; 
;;AUTHOR         Glenn Barnas 
;; 
;;VERSION        1.0  - 4/17/2008 
;; 
;;HISTORY        1.0  - 4/17/2008 - Initial Release 
;; 
;;SYNTAX         MappedPrinters() 
;; 
;;PARAMETERS     none 
;; 
;;REMARKS        None 
;; 
;;RETURNS        Array of 2-element arrays. Each sub-array contains the printer 
;;               that is mapped, and the UNC path it is mapped to.  
;; 
;;DEPENDENCIES   windows net.exe command 
;; 
;;TESTED WITH    W2K, WXP, W2K3, Vista 
;; 
;;EXAMPLES       $aMapped = MappedPrinters() 
;;               For Each $Map in $aMapped 
;;                 $Map[0] ' is mapped to ' $Map[1] 
;;               Next 
; 
Function MappedPrinters()
 
  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