Wednesday, December 10, 2014

Elevate'd Privilege - ACLs of Folders - Backup operator

Using PSCX powershell module to give backup operator rights (also might need to do a file server level)
ipmo pscx
$priv=get-privilege
$priv.Enable("SeRestorePrivilege")
$priv.Enable("SeBackupPrivilege")
$priv.Enable("SeSecurityPrivilege")
$priv.Enable("SeTakeOwnershipPrivilege")
set-privilege $priv;
$report=$null
$Report=@()
$InputFile = "C:\temp\Folders.txt"
$OutputFile = "C:\temp\FolderPermissions.csv"
$FolderList = Get-Content $InputFile

ForEach ($Folder in $FolderList)
{
# Get access list items of the folder
$Permissions = (Get-Acl -Path $Folder).Access | 
# Add the path property and assign its value, -PassThru so the object is assigned to $Permissions
forEach-Object { $_ | Add-Member -MemberType NoteProperty -Name Path -Value $Folder -PassThru }

$Report += $Permissions
}

$Report | Select-Object path,IdentityReference,FileSystemRights,IsInherited | Export-CSV $OutputFile -NoTypeInformation 
thanks to whoever's code source I used... so much internet so little time.

No comments: