William said:
I need to automate the creation of a share
and the addition of a user to the share, the
equivalent mouse clicks to:
[Sharing] [Permissions] [Add] (add user) then =>> r,rw,rwx
[Security] [Add] (add user) then =>> r,rw,rwx
Does anyone have samples of this?
Hi
E.g. RMTShare.exe (command line), WMI or ADSI can be used:
A)
RMTShare.exe
RMTSHARE is available for download here:
ftp://ftp.microsoft.com/bussys/winnt/winnt-public/reskit/nt40/i386/RMTSHAR.EXE
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.com/groups?selm=#[email protected]
You can set the security descriptor for the shares with WMI as well..
SetSecurityDescriptor
http://msdn.microsoft.com/library/e...n_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 (
[email protected])
Subject: RE: Add User to sharefolder
Newsgroups: microsoft.public.platformsdk.adsi
Date: 2001-11-16 14:01:51 PST
http://groups.google.com/[email protected]
From: [MS] Tim Chen (
[email protected])
Subject: Re: Folder Security
Newsgroups: microsoft.public.win32.programmer.wmi
Date: 2002-06-13 13:06:05 PST
http://groups.google.com/[email protected]
C)
ADSI (from e.g. VBScript)
http://groups.google.com/[email protected]
--
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