Windows – Can’t disconnect a mapped drive on a server

I was running into a frustrating issue where I had mapped a drive using a script and I could not disconnect anymore ? Sad smile


Problem was that I could not open the mapped drive because in the background it was not available anymore ?


But when I tried to run a script to disconnect the drive. I saw a different message


So I now knew that the Z: drive was being locked by an other process.

Error : The device is in use by an active process and cannot be disconnected.

Firing up the Process Explorer revealed after searching on the keyword “Z:” the process ID 7936 was locking the drive ?


Pulling up a bit more details said that the WebClient service was involved.

Restarting the service gave me back the drive letter Smile




I could then map the Z: drive again via a script and disconnect again, without having to restart the server each time.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: