Re: Looking for a VB Script to set share permissions

From: Torgeir Bakken (MVP) (Torgeir.Bakken-spam@hydro.com)
Date: 02/21/03


From: "Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com>
Date: Fri, 21 Feb 2003 04:05:09 +0100


kajaa wrote:

> please write (or find) a VB Script sample to share the folder C:\, and
> permit READONLY to Administrators,

Hi

See "Create a Network Share" in the section "Files and Folders" at TechNet
Script Center
http://www.microsoft.com/technet/scriptcenter

To set rights on shares/folders (I recommend using the command line utility
SetACL for this):

===========================================================
ADSI:

You can use IADsSecurityUtility's SetSecurityDescriptor method to set the
security descriptor on a specified file, file share, or registry key object.
http://msdn.microsoft.com/library/en-us/netdir/adsi/iadssecurityutility_setsecuritydescriptor.asp

===========================================================
WMI:

Platform SDK: Windows Management Instrumentation
SetSecurityDescriptor Method in Class Win32_LogicalShareSecuritySetting
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/setsecuritydescriptor_method_in_class_win32_logicalsharesecuritysetting.asp

From: [MS] Tim Chen (timchen2000@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?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3d08f9d7%241%40news.microsoft.com

From: Max L. Vaughn (maxvonline@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?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=ejzoroubBHA.253%40cppssbbsa01.microsoft.com

===========================================================
Command line, you can shell out from a vbscript with e.g. the Run method

SETACL at http://www.helge.mynetcologne.de/setacl/ , a nice freeware
app that adds a lot to cacls and xcacls.

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

Be sure to add permissions, and not replace them.

>From the "Windows NT/2000 FAQ" site at http://www.windows2000faq.com/

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

Q. How do I create a network share?
http://www.windows2000faq.com/Articles/Index.cfm?ArticleID=14842

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and a ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter


Relevant Pages

  • Re: Looking for a VB Script to set share permissions
    ... > SetSecurityDescriptor Method in Class Win32_LogicalShareSecuritySetting ... > Local or remote directories ... > Be sure to add permissions, ... > Microsoft MVP Scripting and WMI, ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Printer Admin Object
    ... Thanks but what I'm looking for is info on the printer admin object on the ... > and ports on local and remote computers. ... > Add and delete a local or remote printer. ... > torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.scripting.vbscript)
  • Re: Printer Admin Object
    ... and ports on local and remote computers. ... Add and delete a local or remote printer. ... Instrumentation scripts in Windows Server 2003, ... -- 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: Shutdown remote server
    ... > How can I do a clean shut down of a remote server with VBScript? ... If you run it without any input arguments, it will reboot ... Const EWX_SHUTDOWN = 1 ... -- 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: Script needed: Users with Remote Access permissions on a server
    ... Remote Access permissions on a server? ... Microsoft's "Scripting guy" archive has a script that lists all users with ... I need to query a particular server or list of servers. ... Microsoft MVP Scripting and ADSI ...
    (microsoft.public.scripting.vbscript)