Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Extract data from "fullaccess" and pull additional AD User info

$
0
0

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

 

Get-MailboxPermission mailbox |
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.

 

$pos=$a.IndexOf("\")
$b=$a.SubString($pos+1)
$b

 

However this gives an error of 

 

Method invocation failed because [CSV:Selected.Microsoft.Exchange.Management.RecipientTasks.MailboxAcePresentationObject] doesn't contain a method named 'SubString'.
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

 

Method invocation failed because [CSV:Selected.Microsoft.Exchange.Management.RecipientTasks.MailboxAcePresentationObject] doesn't contain a method named 'TrimStart'.
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.


Viewing all articles
Browse latest Browse all 6937

Trending Articles