Networking Forums

Networking Forums > Computer Networking > Windows Networking > How to unmap "ghost" network drive

Reply
Thread Tools Display Modes

How to unmap "ghost" network drive

 
 
Ilya Evseev
Guest
Posts: n/a

 
      03-02-2005, 10:07 AM
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
 
Reply With Quote
 
 
 
 
Pegasus \(MVP\)
Guest
Posts: n/a

 
      03-02-2005, 11:21 AM

"Ilya Evseev" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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


Your share is probably mapped to a drive letter by a background
process, e.g. by a scheduled task or by a spawned command
processor. You must ensure that all such tasks unmap all
mapped drives before they terminate.


 
Reply With Quote
 
Ilya Evseev
Guest
Posts: n/a

 
      03-02-2005, 11:39 AM
Pegasus (MVP) wrote:
> Your share is probably mapped to a drive letter by a background
> process, e.g. by a scheduled task or by a spawned command
> processor. You must ensure that all such tasks unmap all
> mapped drives before they terminate.


I understand and agree your idea, but my question was in another:
what to do when background task is terminated abnormally and drive still mapped?
How to unmap it from outer environment without rebooting?

Ilya
 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a

 
      03-02-2005, 12:21 PM

"Ilya Evseev" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Pegasus (MVP) wrote:
> > Your share is probably mapped to a drive letter by a background
> > process, e.g. by a scheduled task or by a spawned command
> > processor. You must ensure that all such tasks unmap all
> > mapped drives before they terminate.

>
> I understand and agree your idea, but my question was in another:
> what to do when background task is terminated abnormally and drive still

mapped?
> How to unmap it from outer environment without rebooting?
>
> Ilya


This little experiment might give you a pointer. Here is what I typed on my
machine:

1. runas /user:config cmd
2. net use p: \\fnlhome\c$
3. exit
4. net use
C:\Temp\Radio>net use
New connections will not be remembered.
Status Local Remote Network
--------------------------------------------------------------------------
Disconnected \\ipex2000\d$ Microsoft Windows Network
The command completed successfully.

As you see, drive P: does not show.

5. runas /user:config cmd
6. net use
New connections will be remembered.
Status Local Remote Network
----------------------------------------------------------------------------
---
Unavailable P: \\fnlhome\c$ Microsoft Windows Network

Now drive P: is visible but unavailable
7. net use P: /del
P: was deleted successfully.
8. exit

In other words: I spawned a command processor under the same
credentials as the original command processor. I was then able to
delete the mapped drive. However, this will NOT work if you have
any open handles on that drive.


 
Reply With Quote
 
Ilya Evseev
Guest
Posts: n/a

 
      03-02-2005, 02:54 PM
Pegasus (MVP) wrote:
> In other words: I spawned a command processor under the same
> credentials as the original command processor. I was then able to
> delete the mapped drive. However, this will NOT work if you have
> any open handles on that drive.


In your example, Z: is created using ordinal user account.
My script is called under Administrator credentials. Try so:

net use ...does not contain Z:
runas /user:dom\administrator cmd
net use z: \\serv\mydata
net use ...contains Z:!
exit
net use ...does not contain Z:
net use z: \\serv\mydata ...displays error: Device is already in use
runas /user:dom\administrator cmd
net use ...does not contain Z:
net use z: \\serv\mydata ...displays error: Device is already in use

WBR, Ilya
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with "Map network drive" during VPN connection bildos Windows Networking 1 01-24-2007 10:40 PM
"not enough server storage available"-message when i copy large files to a network drive bogus Windows Networking 1 06-22-2005 12:05 PM
can't "map to network drive" missing from TOOLS dave jak Windows Networking 3 08-20-2004 06:50 PM
cant find "Map Network Drive" under tools dave jac Windows Networking 0 08-20-2004 12:20 PM
Windows 98SE and red "X" on mapped network drive Mega Windows Networking 0 09-20-2003 08:34 PM



1 2 3 4 5 6 7 8 9 10 11