Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
Have you tried Net Use * /Del? –  Ƭᴇcʜιᴇ007 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'. :) –  Ƭᴇcʜιᴇ007 Aug 25 '11 at 17:37

2 Answers 2

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

EDIT: To cause the credentials to get flushed:

net use \\server\IPC$ /delete
share|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
1  
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
1  
I tried net use \\server\IPC$ /delete and it gives the error The network connection could not be found. –  druciferre Sep 23 '13 at 15:16
net use \\server\sharename /delete

See the full net use command here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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