I'm attempting to write a script that I can extract a list of users who have "FullAccess" rights on a Mailbox, and then pass this through for a general ADUser query to obtain additional information on the user.
IE:
Name and Description.
What I have so far which nets me a list of users in the format of domain\user
where-object {$_.accessrights-like"*FullAccess*"} |
select-object user
This is good and I DO get a list, however I cannot see to pass this through to general AD queries, either via an array or export to csv and then running a seperate command to import and do text manipulation to remove the domain prefix.
$b=$a.SubString($pos+1)
$b
However this gives an error of
At line:3 char:1
+ $b = $a.SubString($pos+1)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (SubString:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
When attempting to use TrimStart functions I get
At line:2 char:1
+ $b = $a.TrimStart("domain\")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (TrimStart:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
I even attempted to pass the results through via a CSV and running two seperate commands but get the same results.