DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: IDEA: Re-establish connection on connected windows network shares/mapped drives  (Read 7,839 times)

GSz

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 30
Hi all,

I can't seem to find a simple command line solution for the issue.

I use 3 "endpoints" on my home network:
- a desktop
- a laptop
- a Networked Media Tank (media streamer)

I have mapped network drive on both desktop and laptop pointing to the other computer and the NMT.
Sometimes the mapped drives get to a disconnected/unavilable state (when running "net use" from command line) and can't be accessed from certain application or the command line.

The only way to "refresh" the connection - without removing it and re-establishing it - is either to open Windows Explorer and click on the drive (I also use Total Commander, which works also).
But I can't find a good command line solution where I give it the drive letter, and it makes sure it's connected.

What I'm looking for is a command line tool that will act as described above, for example:
  refresh-smb-drive T:

will make sure T: is connected and active before returning control.

Hope this is simple enough for you excellent and bright guys.

Thanks in advance
Gal Szkolnik
- Sincerely
    Lockszmith

skwire

  • I eat Coding Snacks for breakfast...
  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,297
    • Participated in NANY Challenge Seventeen Times
    • Coding Snacks
    • Superboy Coder
    • Cody Award
    • Volunteers/Staff
    • Gathering Badge
You could write a simple ahk script (or even a batch file) that will delete and re-add the drive.

Innuendo

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,266
Sometimes the mapped drives get to a disconnected/unavilable state (when running "net use" from command line) and can't be accessed from certain application or the command line.

If this is what I am thinking of then this has always been a very irritating bug. If you have plans to upgrade to Windows 7 you'll be pleased to know that this irritation has finally been fixed.

The cause and work-around for anything before Windows 7 is that when Windows tries to connect to a mapped drive the first thing it usually tries to do is connect using the credentials of the user logged on to Windows at the time. If the credentials don't match then you get the disconnected behavior you have experienced. The work-around is to have the log-ons for your mapped devices match your Windows logon. It's a pain, but it works.

GSz

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 30
Thanks for all the suggestions.

I have found this Shareware solution, which seems like exactly what I was looking for.

It's a replacement management console for controlling network mounts - with an added value of re-mounting TrueCrypt drives which are avilable on network mounts.

A bit of overkill for what I wanted, but as of now it's the only solution I found that keeps the network mounted drive live.

Check it out here: http://www.suncross.nl/ndm/

I wonder if there is a DonationCoder out there who can make a simpler/smaller (maybe better suited) solution instead of NDM.

I'll test-drive the new software, and let you know if it does what it should.

Gal Szkolnik
- Sincerely
    Lockszmith

Original address: https://www.donationcoder.com/forum/index.php?topic=20386.0