How to unmap "ghost" network drive

From: Ilya Evseev (ilya_evseev_at_mail.ru)
Date: 03/02/05


Date: Wed, 02 Mar 2005 14:07:43 +0300


    Hi!
There is a script calling by System Agent that maps external network share to drive letter.
When this script fails without unmapping network drive,
I don't have any possibility to release drive letter.
Only rebooting has effect, but this is absolutely impossible on server box.

Scheduled script performs safe checking as following:
-----------------------------
     if not exist z:\nul goto mapdrive
     net use z: /delete /yes
     if not exist z:\nul goto mapdrive
     echo Error: cannot unmap Z: drive, abort.
     goto done
     :mapdrive
     net use z: \\server\share
     ...
     :done
-----------------------------
All output is redirected to file using >>logfile.txt 2>&1
and contain "Error: cannot unmap" lines preceding by error output of "net use z: /delete":
-----------------------------
     The network connection could not be found.
     More help is available by typing NET HELPMSG 2250.
-----------------------------

Drive Z: is not visible in "My Computer" nor in "net use" output.
However, "Start->Programs->Administrative Tools->Computer Management->Logical drives"
contains record of network drive Z: with "Information not available" hint,
but this record cannot be deleted anyway.

Script is running under Administrator account, but HKCU\Network does not contain "Z" subkey.

So, my question is very simple: how to unmap this drive???
My Windows is 2000 Server SP4 with Terminal Services.

Long live Linux,
Ilya



Relevant Pages

  • Re: Updating the HomeFolder Attribute
    ... The last time I wrote a script like this I only put "H" in the drive letter field because the colon ":" in the UI isn't part of the drop down in the field, ... When a user logs in using their newID, the home folder doesn't map. ... If I check the information stored in the users profile it contains the ...
    (microsoft.public.scripting.vbscript)
  • RE: Windows Log
    ... a savvy user would be able to create problems with a script based method of recording user logons and logoffs. ... ' Choose a drive letter and enter your share name below. ... >>> education and the case study affords you unmatched consulting experience. ... >>> Computer Emergency Response Teams, ...
    (Security-Basics)
  • Re: Change the Drive Letter of a Volume
    ... We have prepared Windows XP SP2 computer ... How could I change CD-ROM drive letter from command prompt or script? ...
    (microsoft.public.windows.server.scripting)
  • Re: Login script and drive mappings
    ... I have this login script that maps 2 groups to the same drive letter ... Here is a pasting of the script. ... there is no need for the Sleep statements. ...
    (microsoft.public.windows.server.general)
  • Re: NTbackup Scheduled tasks do not run unless console is logged in
    ... script is about to run - then disconnect the drive at the end of the ... "The media was created by a differnt application - do you want to ... The next best solution is to use a different drive letter, ... Using mapped drive letters in a scheduled task is never a ...
    (microsoft.public.win2000.general)