magnify
Home IpUcu Bir dizinde (folder) everyone için auditing’i aktif eden örnek PowerShell scripti
formats

Bir dizinde (folder) everyone için auditing’i aktif eden örnek PowerShell scripti

Tarih 13 Ocak 2010 yazar içinde IpUcu

$computer = gc env:computername
$path = “C:\New Folder”
$user = “everyone”
$path = $path.replace(“\”, “\\”)
$SD = ([WMIClass] “Win32_SecurityDescriptor”).CreateInstance()
$ace = ([WMIClass] “Win32_ace”).CreateInstance()
$Trustee = ([WMIClass] “Win32_Trustee”).CreateInstance()
$SID = (new-object security.principal.ntaccount $user).translate([security.principal.securityidentifier])
[byte[]] $SIDArray = ,0 * $SID.BinaryLength
$SID.GetBinaryForm($SIDArray,0)
$Trustee.Name = $user
$Trustee.SID = $SIDArray
$ace.AccessMask = [System.Security.AccessControl.FileSystemRights]”Modify”
$ace.AceFlags = “0x67″
$ace.AceType = 2
$ace.Trustee = $trustee
$SD.SACL = $ace
$SD.ControlFlags=”0x10”
$wPrivilege = gwmi Win32_LogicalFileSecuritySetting -computername $computer -filter “path=’$path'”
$wPrivilege.psbase.Scope.Options.EnablePrivileges = $true
$wPrivilege.setsecuritydescriptor($SD)

 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
Bir dizinde (folder) everyone için auditing’i aktif eden örnek PowerShell scripti için yorumlar kapalı  comments 
© Hakan Uzuner
credit