Re: Need script to create shares and assign securities



Byron Kendrick wrote:

I currently have the folders for new users residing on a server but need to create the shares, assign the new users rights to their home directories, and remove "everyone" from them. I used a script to create the users and it created the folders in the proper location but not the shares. I need to have this call up a list from a .txt file. If somewone can help me out or point me to one I would certainly appreciate it.
Hi,

Some options:

A)
Use RMTShare.exe:

Sadly, Microsoft's ftp server is gone (where RMTShare.exe was previously
available for download), but a copy is to be found here (I did a binary
compare with the RMTShare.exe that previously available on the FTP
server, and it is the same file):

http://tech.cuip.net/logins/programs/nt4/expanded-copy-to-winntsys32/

Take a look here for a vbscript that creates a share and sets
share rights with RMTShare.exe:

http://groups.google.co.uk/groups?threadm=3FCB15B4.C5B11D6C%40hydro.com

And:

Q. How can I modify share permissions from the command line?
http://www.windows2000faq.com/Articles/Index.cfm?ArticleID=14459


B) WMI (from e.g. VBScript)

http://msdn.microsoft.com/library/en-us/wmisdk/wmi/create_method_in_class_win32_share.asp?frame=true

For some examples:

See "Create a Network Share" and "Modify a Network Share" here:
http://www.microsoft.com/technet/scriptcenter/scripts/storage/shares/default.mspx

http://groups.google.co.uk/group/microsoft.public.scripting.vbscript/msg/aed18f4e3a968dea

You can set the security descriptor for the shares with WMI as well..

SetSecurityDescriptor
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/setsecuritydescriptor_method_in_class_win32_logicalsharesecuritysetting.asp

Here is a couple of examples on the SetSecurityDescriptor method in Class
Win32_LogicalShareSecuritySetting (disregard that they use
wbemscripting.swbemlocator instead of winmgmts:, the rest will be the same):

From: Max L. Vaughn (maxvonl...@xxxxxxxxxxxxx)
Subject: RE: Add User to sharefolder
Newsgroups: microsoft.public.platformsdk.adsi
Date: 2001-11-16 14:01:51 PST
http://groups.google.co.uk/group/microsoft.public.platformsdk.adsi/msg/e888d7df9cc4abaf

From: [MS] Tim Chen (timchen2...@xxxxxxxxxxx)
Subject: Re: Folder Security
Newsgroups: microsoft.public.win32.programmer.wmi
Date: 2002-06-13 13:06:05 PST
http://groups.google.co.uk/group/microsoft.public.win32.programmer.wmi/msg/8d0807584f300f2c


C) ADSI (from e.g. VBScript)

http://groups.google.co.uk/group/microsoft.public.scripting.vbscript/msg/282458292c1f458a




-- 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/default.mspx .



Relevant Pages

  • Re: Share disk
    ... Microsoft's ftp server is gone (where RMTShare.exe was previously ... WMI (from e.g. VBScript) ... Newsgroups: microsoft.public.win32.programmer.wmi ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.scripting.vbscript)
  • Re: command line to call dialer
    ... Using rasdial.exe from a command line or a VBScript is an ... Subject: dial a connection ... Newsgroups: microsoft.public.scripting.wsh ... Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.win2000.general)
  • Re: Is there a way to obtain Share Permissions & ACLs.
    ... want a tool that I can run on all the servers which will show me the Shares the server has, the Permissions to the Shares, & the Folder & File security ACL's so that I can get a good feel for where we're starting from. ... 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/default.mspx. ...
    (microsoft.public.windows.server.general)
  • Re: WMI - how to get shares permissions info
    ... > I'd like to create something, what allows me to see all shares in the ... > computer and their ACLs. ... For Win2k/WinXP/Win2k3, WMI can be used: ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.win32.programmer.wmi)
  • Re: How do I change default permissions for shares?
    ... > creating new shares. ... Example on using SetACL to set permission on a share: ... Q. How can I modify share permissions from the command line? ... Microsoft MVP Scripting and WMI, ...
    (microsoft.public.windowsxp.security_admin)