Trying to get the following data and the error I’m getting below is referring to the manager column.
My Code-
get-aduser -SearchBase "OU=Users,OU=leaped,DC=leaped,DC=local" -Filter {Enabled -eq $true} -Properties * | select displayname, state, $Manager.Manager.split(',')[0] -replace 'CN=','', EmailAddress, telephonenumber | export-csv -path c:tempexport-allxyz.csv
The error
You cannot call a method on a null-valued expression.
At line:1 char:1
- get-aduser -SearchBase “OU=Users,OU=leaped,DC=leaped,DC=local” -Filter {Ena …
-
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull
Any help or pointers will be appreciated