Tuesday, May 12, 2015

POWERSHELL | Comparing File ACL



#Generate the Base line acl

$TheACL=Get-Acl \\$server\$testpath\LCFSTEST\test.txt
$TheACL|Export-Clixml $logfolder\'base_'$testpath.xml

#ACTION - Modify permissions

$TheACL=Get-Acl \\$server\$testpath\LCFSTEST\test.txt

#Import the BASE ACL

$BaseACL=Import-Clixml $logfolder\'base_'$testpath.xml
If (diff $($TheACL.Access) $($BaseACL.Access) -Property Filesystemrights) { Write-Host Different Check $testpath Permissions}

No comments: