I have a small script that runs on each workstation which runs defrag and chkdsk and connect each workstation temporarily to a network share that they, normally, do not have access to. The command I use to connect to them is:

net use \\server\sharename [password] /USER:domain\username P:No

Is there a command to log that user out of the drive share without restarting the computer?

Workstations run on Windows XP SP3

EDIT: I've used:

net use \\server\sharename /delete

but the command returns "The network connection cannot be found". However, I can still navigate to \\server\sharename in MyComputer address line and have full access to it still.

EDIT2: Assume I've read through the help files for net use ;D

EDIT3: Would a reboot suffice? Yes... however it is more convenient to log the user out of the share instead =D. I know I'm difficult.

link|improve this question

Have you tried Net Use * /Del? – techie007 Aug 25 '11 at 17:20
we other user shares associated to the login, and we do not wish to remove all of them. Just the one that we've temporarily allowed the user access to. – Mechaflash Aug 25 '11 at 17:22
I (mostly) meant for testing purposes. But I think I see what's going on here, so I've added an 'answer'. :) – techie007 Aug 25 '11 at 17:37
feedback

2 Answers

up vote 3 down vote accepted
net use \\server\sharename /delete

EDIT: To cause the credentials to get flushed:

net use \\server\IPC$ /delete
link|improve this answer
hmm, usually SU notifies me sooner if an answer is added when I'm typing, +1 for being first. – MaQleod Aug 25 '11 at 16:02
I've tried this, but the command returns "The network connection cannot be found." However, I can still access the network share freely.\ – Mechaflash Aug 25 '11 at 17:02
I'm so dumb... double checked my code this morning and found I had a trailing \ on after the sharename... tested it and yep the trailing slash makes a difference. Sorry for my n00bizm – Mechaflash Aug 26 '11 at 13:08
feedback
net use \\server\sharename /delete

See the full net use command here.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.