This is the bit I run
get-adcomputer -SearchBase "OU=Department,DC=Company,DC=de,DC=us" -filter "Passwordlastset -lt '2/7/2013'" -properties *| Select name,distinguishedName,passwordlastset | Export-Csv "C:\Report.csv" -notypeinformation
Using DistinguishedName it returns something like
CN=ZJIC-8VZQPC1,OU=Department,OU=Company,DC=My,DC=domain |
Is it possible to to have it only return the OU's and not the DC's and CN? Or even better have it pull only the department OU information into the CSV?
I'm very new to PowerShell so any advice would be greatly appreciated.