As part of trying to release some files locked by a remote user over an automatic Windows hidden share (which I used to do via the Server control panel in NT4), I decided to skip doing a bulk
net file /c
and did the nuclear option of doing
net share c$ /delete
.
Aside from rebooting, what's the correct procedure to restore the share (preferably via the command line) ?
(The net is full of articles explaining that
net share admin$
works implicitly and that there is a registry setting and that you reboot).
Bonus points for linking to a nice explanation of the best practice equivalents of
net file
and
net share
in PowerShell
Best Answer
In PowerShell:
Obviously you can get instances of Win32_Share and delete them, etc. if you need to. See Win32_Share documentation for error code explanations
Your other option is
but that's a bit heavy as it will obviously disconnect everyone attached to the server