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

Set Share Permission VBScript+ADSI+WMI

78 views
Skip to first unread message

Sanjay

unread,
Dec 18, 2003, 6:27:42 AM12/18/03
to

I want to add user to a Share Permission.
Also to remove default Permission to EVERYONE from that
share.

I can create user, create folder and create share.

Can someone Help.

Torgeir Bakken (MVP)

unread,
Dec 18, 2003, 6:51:09 AM12/18/03
to
Sanjay wrote:

Hi

Some options:

A)
You can use Microsoft's RMTShare.exe to set permission on a share:

Q. How can I modify share permissions from the command line?
http://www.windows2000faq.com/Articles/Index.cfm?ArticleID=14459
RMTShare.exe: http://www.jsiinc.com/asp/reghacks.asp?tipnumb=6353


B)
SETACL (freeware) at http://setacl.sourceforge.net/ is also an option.
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


C)
You can set the security descriptor for the shares with WMI..

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 (maxvo...@microsoft.com)
Subject: RE: Add User to sharefolder
Newsgroups: microsoft.public.platformsdk.adsi
Date: 2001-11-16 14:01:51 PST
http://groups.google.com/groups?selm=ejzoroubBHA.253%40cppssbbsa01.microsoft.com

From: [MS] Tim Chen (timch...@hotmail.com)
Subject: Re: Folder Security
Newsgroups: microsoft.public.win32.programmer.wmi
Date: 2002-06-13 13:06:05 PST
http://groups.google.com/groups?selm=3d08f9d7%241%40news.microsoft.com

--
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


0 new messages