Share permission

  • Thread starter Thread starter Harry Jega Nathan
  • Start date Start date
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
 
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
 
Back
Top