If you have a very active share and need to disconnect users to do some maintenance, you could:
• Disconnect the share in Server Manager - but users can
reconnect.
• You could delete the share - but you have to reset permissions
when you recreate it.
I use either of the following methods:
1. Locally, I disconnect the users from the share in Server Manager and set the number of connections to 1, which I consume with the following batch file:
net share %1 /users:1
net use z: /delete
net use z: \\%2\%1 /persistent:NO
exit
where %1 is the ShareName and %2 is the ServerName.
When I am finished, I use:
net use Z: /delete
net share %1 /unlimited
exit
2. If the entire process must be scripted or run remotely,
I use the following batch with the
Resource Kit RMTSHARE and PERMCOPY:
permcopy \\%1 %2 \\ServerName
DummyShare
net send %1 /DOMAIN "%2 is
temporarily out of service."
rmtshare \\%1\%2 /delete
... other stuff ...
rmtshare \\%1\%2=%3 /unlimited
permcopy \\ServerName DummyShare \\%1 %2
net send %1 /DOMAIN "%2 is now
available."
exit
Where %1 is the Server, %2 is the ShareName and %3 is the Drive:\Path