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.
Pass form text in quotes to cmdlet
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- jerrisheaton
- Posts: 19
- Last visit: Tue Mar 09, 2021 6:35 pm
Re: Pass form text in quotes to cmdlet
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
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
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