#At first open the Powershell ISE as Administartor
# then run the command Set-location AD:
Import-module Active*
Set-Location AD:
$Objec = New-Object -TypeName PSObject
$a=Get-ChildItem -Properties * | Select pspath
foreach($b in $a.pspath)
{
$Folders=Get-ChildItem $b -recurse | where {$_.psiscontainer}
foreach ($Folder in $Folders)
{
$ACLs = get-acl $Folder.pspath | ForEach-Object {$_.Access}
foreach($acl in $ACLs)
{
$Objec | Add-Member -MemberType NoteProperty -Name Name -Value $Folders.name -Force
$Objec | Add-Member -MemberType NoteProperty -Name TYPE -Value $Folders.objectclass -Force
$Objec | Add-Member -MemberType NoteProperty -Name IdentityReference -Value $ACL.IdentityReference -Force
$Objec | Add-Member -MemberType NoteProperty -Name AccessControlType -Value $ACL.AccessControlType -Force
$Objec | Add-Member -MemberType NoteProperty -Name IsInherited -Value $ACL.IsInherited -Force
$Objec | Add-Member -MemberType NoteProperty -Name InheritanceFlags -Value $ACL.InheritanceFlags -Force
$Objec | Add-Member -MemberType NoteProperty -Name PropagationFlags -Value $ACL.PropagationFlags -Force
$objec | OUT-FILE c:/temp/test_ACL1.TXT -Append
}
}
}
# then run the command Set-location AD:
Import-module Active*
Set-Location AD:
$Objec = New-Object -TypeName PSObject
$a=Get-ChildItem -Properties * | Select pspath
foreach($b in $a.pspath)
{
$Folders=Get-ChildItem $b -recurse | where {$_.psiscontainer}
foreach ($Folder in $Folders)
{
$ACLs = get-acl $Folder.pspath | ForEach-Object {$_.Access}
foreach($acl in $ACLs)
{
$Objec | Add-Member -MemberType NoteProperty -Name Name -Value $Folders.name -Force
$Objec | Add-Member -MemberType NoteProperty -Name TYPE -Value $Folders.objectclass -Force
$Objec | Add-Member -MemberType NoteProperty -Name IdentityReference -Value $ACL.IdentityReference -Force
$Objec | Add-Member -MemberType NoteProperty -Name AccessControlType -Value $ACL.AccessControlType -Force
$Objec | Add-Member -MemberType NoteProperty -Name IsInherited -Value $ACL.IsInherited -Force
$Objec | Add-Member -MemberType NoteProperty -Name InheritanceFlags -Value $ACL.InheritanceFlags -Force
$Objec | Add-Member -MemberType NoteProperty -Name PropagationFlags -Value $ACL.PropagationFlags -Force
$objec | OUT-FILE c:/temp/test_ACL1.TXT -Append
}
}
}
No comments:
Post a Comment