Script to share a folder in a particular user group!
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
Const MAXIMUM_CONNECTIONS = 25
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objNewShare = objWMIService.Get("Win32_Share")
errReturn = objNewShare.Create _
("C:\Finance", "FinanceShare", FILE_SHARE, _
MAXIMUM_CONNECTIONS)
-----------------------------------------------------------------------------
Thanx in advance.
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
Const MAXIMUM_CONNECTIONS = 25
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objNewShare = objWMIService.Get("Win32_Share")
errReturn = objNewShare.Create _
("C:\Finance", "FinanceShare", FILE_SHARE, _
MAXIMUM_CONNECTIONS)
-----------------------------------------------------------------------------
Thanx in advance.
0 Comments
[ + ] Show comments
Answers (1)
Please log in to answer
Posted by:
anonymous_9363
15 years ago
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.
- 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.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.