Hi All,
not sure whether am posting at the right place.
I want to create a script for sharing a folder for a particular user group.
The below given script shares the folder in all the user groups available.
Please suggest the required modification or provide me with a script to restrict it to a particular user group.
Const FILE_SHARE = 0
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objNewShare = objWMIService.Get("Win32_Share")
errReturn = objNewShare.Create _
("C:\Finance", "FinanceShare", FILE_SHARE, _

Thanx in advance.
0 Comments   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity


Hi, Shilpi.

- There is a 'Scripting' forum for this type of question;
- The CreateShare method does just that - it creates a share. If you want to add permissions to it, you need an appropriate tool. I believe our friend SetACL can apply permissions to shares, but don't quote me. Failing that, there is a WMI method. See http://cwashington.netreach.net/depo/view.asp?Index=1068 for details. A Google for 'VBScript +share +permissions' turned up that link, BTW.
Answered 05/06/2008 by: VBScab
Red Belt

Please log in to comment