Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Hidden Network Share

139 views
Skip to first unread message

I alfaro

unread,
Sep 2, 2003, 4:01:57 PM9/2/03
to
Can anyone give me a start on how to script creating a
hidden network share?

Torgeir Bakken (MVP)

unread,
Sep 2, 2003, 4:22:10 PM9/2/03
to
I alfaro wrote:

> Can anyone give me a start on how to script creating a
> hidden network share?

Hi

Add a $ behind the share name to make it hidden.


You can use the net.exe command to create the share:

net share /?


With WMI, take a look at "Create a Network Share" here:
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/filefolder/default.asp

and to set permissions, you can use setacl.exe:


F:\>SetACL.exe \\%COMPUTERNAME%\Tst$ /share /set Everyone /read

SUCCESS: Specified permissions set on object <\\A425220\Tst$>.

Finished. All operations completed successfully.

SetACL.exe: SetACL - Windows permission management: Set permissions on
virtually anything
http://setacl.sourceforge.net/

SetACL can set permissions on:

Local or remote directories
Local or remote files
Local or remote printers
Local or remote registry keys
Local or remote Win32 services
Local or remote network shares

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter


i alfaro

unread,
Sep 2, 2003, 5:00:21 PM9/2/03
to
I was wanting to do this through VB Script. I have
referenced the link you gave, but it does not create the
share it says its suppose to.

>.
>

Torgeir Bakken (MVP)

unread,
Sep 2, 2003, 5:27:11 PM9/2/03
to
i alfaro wrote:

> I was wanting to do this through VB Script. I have
> referenced the link you gave, but it does not create the
> share it says its suppose to.

Hi

The "Create a Network Share" script at
http://www.microsoft.com/technet/scriptcenter/filefolder/ScrFF13.asp works fine
for me (Win2k). Note that the folder you want to share out needs to exist
before you run the script (the first parameter in the objNewShare.Create
method).

When you ran the script, what number did the command "Wscript.Echo errReturn"
return?

You can use "net.exe share" from a vbscript as well:

Set oShell = CreateObject("Wscript.Shell")

sShareFolder = "c:\some path"
sShareName = "My hidden share$"

oShell.Run "net.exe share " & Chr(34) & sShareName & Chr(34) _
& "=" & Chr(34) & sShareFolder & Chr(34), 0, True

i alfaro

unread,
Sep 2, 2003, 6:45:18 PM9/2/03
to
it returns a value of 2. So i first need to create the
folder then share...gotcha...i thought this script would
do it all..
>.
>
0 new messages