Page 1 of 1

Pass form text in quotes to cmdlet

Posted: Tue Mar 18, 2014 6:48 pm
by island_guy
I might be looking at this wrong but here is what I want to do.

In powershell:

Get-MailboxPermission -Identity user-name@domain.com -User "domain\first middel last"
| Format-Wide -Property "AccessRights" -Column 2 | Out-String

It request me to pass the user name in quotes "domain\first middle last"

I built a very simply hello world form that request the account and a user name to check access for. Then output that to a text box on the form. It seems I having problems with the user name needing to be in quotes.


$GetAccess_Click={
#TODO: Place custom script here



$textboxresults = Get-MailboxPermission -Identity $EmailAccount.Text -User $adaccount.text | Format-Wide -Property "AccessRights" -Column 2 | Out-String

}

Thanks for the help.

Re: Pass form text in quotes to cmdlet

Posted: Wed Mar 19, 2014 10:55 am
by jerrisheaton
I'm not understanding what exactly you're trying to do. Are you basically prompting for an email account and then returning the permissions (like who has full mailbox access) to that email account?

Re: Pass form text in quotes to cmdlet

Posted: Wed Mar 19, 2014 4:36 pm
by jvierra
Quotes are unnecessary.

You are being asked for either an identity. The email address is one form of identity.

Get-MailboxPermission -Identity user-name@domain.com
Get-MailboxPermission -Identity user-name
Get-MailboxPermission user-name@domain.com
Get-MailboxPermission user-name

Look up the definition of Identity.

-User is the user for whom you want permissions checked on that mailbox.

You will get back a collection of objects.

Get-MailboxPermission mailbox -User user_to_check |
Select Access |
Format-List |
Out-String