How do I get list of all network drives mapped to my system?

3

I mapped a network drive under local system account, I mean I login to my machine using local sytem account. Now I logged off and logged into the machine again using some other valid user account, but I couldn't find that mapped drive in my computer explorer, though am able to use that mapped drive in my application. Is this normal?

Is there any way to see all mapped network drives on my system?

I am on a Windows XP machine.

AMIT

Posted 2011-02-22T07:51:14.653

Reputation: 499

1How – and more importantly, *why* – did you log in as Local System? – user1686 – 2011-02-22T14:05:39.573

Answers

3

> net use

is what you need. See this for more info.

fretje

Posted 2011-02-22T07:51:14.653

Reputation: 10 524

yaa i already done that but could n't find mapped drive that i able to use... – AMIT – 2011-02-22T08:31:12.473

net view lists available shares on a server, not active connections. – user1686 – 2011-02-22T14:09:46.290

@grawity: Of course, you're right... I meant the net use command (I updated my answer) – fretje – 2011-02-22T15:52:44.360

3

Yes, it's normal. Network connections and drive letters assigned to them are session-local. Normally they disappear upon logout (when the session itself is destroyed) and are re-created by Winlogon when you log in again.

With Local System it gets confusing, though.

Log in as Local System again (psexec -desi cmd may be useful), then run net use to list all connections or net use * /delete to disconnect them.

user1686

Posted 2011-02-22T07:51:14.653

Reputation: 283 655

0

I grab mapped drives from a remote machine using powershell as part of a script to move their settings to a persons' new machine: (set $OldComputer to the name or IP of the old computer) It goes through the list of all drives on the remote system, and if they are not local drives, it will attempt to remove that drive mapping on the current computer (in case its used by something else) then remap it. Comment out the second to last line (the one above foreach, and add your own line to log or msgbox if you want.)

$netObj = New-Object -com wscript.Network
$WMI1 = [WMISearcher] "Select Name, Providername from win32_mappedLogicalDisk"
$WMI1.Scope.path="\\" + $oldComputer + "\root\cimv2"
$WMI1.Options.ReturnImmediately
$ColDrives = $WMI1.Get()

foreach ($objDrive in $colDrives) {
      $TestLocal = get-wmiObject Win32_LogicalDisk | ? {$_.DeviceID -eq $objDrive.Name} | % {$_.Providername}
      If ($TestLocal) {
        Net Use /Delete $objDrive.Name >> $LogFile
      }#If
      #Map the drive
      Net use $objDrive.Name $objDrive.ProviderName  >> $LogFile
}#foreach 

Brian

Posted 2011-02-22T07:51:14.653

Reputation: 2 934