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

Re: How to remove Shares selectively if they exist by jp

jp
Wed Feb 23 03:24:35 CST 2005

Actually resolved the issue by turning off the Server service and thus
shares are gone.


Jm

On Sun, 20 Feb 2005 23:49:10 +0100, jp <paulm@kcbbs.gen.nz> wrote:

>
>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
>