How can I selectively remove shares and then reassign them to a
certain group in one script.
I have run the Net Share > Share.lst and this is what I found
Share name Resource Remark
-------------------------------------------------------------------------------
E$ E:\ Default share
P$ P:\ Default share
IPC$ Remote IPC
D$ D:\ Default share
I$ I:\ Default share
K$ K:\ Default share
G$ G:\ Default share
O$ O:\ Default share
M$ M:\ Default share
F$ F:\ Default share
ADMIN$ C:\WINDOWS Remote Admin
H$ H:\ Default share
N$ N:\ Default share
C$ C:\ Default share
J$ J:\ Default share
L$ L:\ Default share
The command completed successfully.
I want to remove all but the IPC$ and ADMIN$ shares plus D$.
I thought using a manual approach as shown below for all the located
mappings might do it.
wscript.run "net share f$ /delete"
wscript.run "net share e$ /delete"
But how can I validate the existence of a share if it doesn't exist as
may be the case.
Any guidance is most welcome.
jm