Hi.
Please help me to create a share folder with these permissions (in Domain invironment):
Just:
Everyone Read
CurrentUser Read and Write
I use a code such this : (But it is not that i want)
The Share permissions is not important for me, but the Security permissions is my weakness.
#include <Permissions.au3>
#include <Process.au3>
#include <Misc.au3>
#include <GUIConstantsEx.au3>
_InitiatePermissionResources()
If DirCreate("d:\"&@ComputerName) Then
$mypath = "d:\"&@ComputerName
ElseIf DirCreate("E:\"&@ComputerName) Then
$mypath = "E:\"&@ComputerName
ElseIf DirCreate("F:\"&@ComputerName) Then
$mypath = "F:\"&@ComputerName
ElseIf DirCreate(@DocumentsCommonDir&"\"&@ComputerName) Then
$mypath = @DocumentsCommonDir&"\"&@ComputerName
EndIf
Runwait(@ComSpec & " /c net share "&@ComputerName&"="&$mypath )
$TI = TimerInit()
$ret = _myGrantReadAccess($mypath,$SE_FILE_OBJECT,'Administrators')
$ret = _myGrantAllAccess($mypath)
$TD = TimerDiff($TI)
_ClosePermissionResources()
Func _myGrantReadAccess($oName, $_SE_OBJECT_TYPE = $SE_FILE_OBJECT, $SetOwner ='Administrators', $Recurse = 1)
Local $aPerm[6][3]
$aPerm[0][0] = 'Everyone'
$aPerm[0][1] = 1
$aPerm[0][2] = $GENERIC_WRITE
;$aPerm[1][0] = $regloginuser
$aPerm[1][0] = 'Administrators'
$aPerm[1][1] = 1
$aPerm[1][2] = $GENERIC_ALL
$aPerm[2][0] = 'System'
$aPerm[2][1] = 1
$aPerm[2][2] = $GENERIC_ALL
Return _SetObjectPermissions($oName, $aPerm, $_SE_OBJECT_TYPE, $SetOwner, 1, $Recurse)
EndFunc ;==>_GrantReadAccess
Func _myGrantAllAccess($oName, $_SE_OBJECT_TYPE = $SE_FILE_OBJECT, $SetOwner = 'Administrators', $Recurse = 1)
Local $aPerm[1][3]
$aPerm[0][0] = 'Everyone'
$aPerm[0][1] = 1
$aPerm[0][2] = $GENERIC_ALL
Return _SetObjectPermissions($oName, $aPerm, $_SE_OBJECT_TYPE, $SetOwner, 1, $Recurse)
EndFunc ;==>_GrantAllAccess