Share permission

H

Harry Jega Nathan

I want to create a VBScript (vbs) to create a share
folder and then set permission on for user access.

My code goes like this.

Set FS = CreateObject("Scripting.FileSystemObject")
If Not FS.FolderExists("E:\Users\harryj") Then
FS.CreateFolder("E:\Users\harryj")
End If

Set ShareSrvObj = GetObject
("WinNT://myserver1/LANMANSERVER")
Set NewShareObj = ShareSrvObj.Create("fileshare", "harryj")
NewShareObj.Path = "D:\Users\harryj"
NewShareObj.MaxUserCount = 1
NewShareObj.SetInfo

Now I don't know how to set the permission on this folder.
I want to remove 'everyone' group from this share and give
permission to user 'harryj' fullaccess
Please help me
Thanks
Harry
 
C

Chuck Sabol

Have you looked at the Xcacls.exe utility from Microsoft?
It is a command line tool that allows you to set all file
system security options that are accessible in Windows
Explorer. It does this by displaying and modifying the
access control lists (ACL) of files.

By the way, can a call to CreateObject
("Scripting.FileSystemObject") be used as a way of
determiing if Active Directory is being used on a server?

Chuck
 
H

Harry Jega Nathan

Can you please sample vbscript that uses xcalcs.exe to set
permission.
Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top