Showing posts with label compare. Show all posts
Showing posts with label compare. Show all posts
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}
Saturday, January 25, 2014
Comparing AD object security
$tango=(Get-Acl "AD:$((Get-ADUser tango).distinguishedname)").access | select identityreference, accesscontroltype $cash=(Get-Acl "AD:$((Get-ADUser cash).distinguishedname)").access | select identityreference, accesscontroltype compare $tango $cashstill couldn't get to root cause of the issue.(automated system cant update account)
Monday, November 4, 2013
powershell filtering two arrays and using text and variables
Comparing two list/Array/ and work from that...
# # Active FPS list # $OUName= 'OU=File and Print,OU=Servers,OU=MOE Servers,DC=Kool,DC=Kids' $TheComputers = Get-ADComputer -filter * -searchbase $OUName # # Exclude File and Print Server #Variables in text.. so I can remember sometimes need brackets othertimes not... @#$@#, , # $ExcludedFPs="PANDA" Write-host Excluded File and Print Server - $ExcludedFPs #Filter the List of objects $AcutalFPStargets=Compare-Object $TheComputers.name $ExcludedFPs | where {$_.sideindicator -eq "<="} | % {$_.inputobject} #now... do stuff foreach ($server in $AcutalFPStargets){
if(!($user.homedirectory -like '*'+($server).name+'*')) $path = "\\"+$server.Name+"\users"
Labels:
array,
compare,
filtering,
powershell,
variables
Subscribe to:
Posts (Atom)