Powershell Mailbox For-Each query

Home Forums Messaging Software Exchange 2007 / 2010 / 2013 Powershell Mailbox For-Each query

Viewing 1 post (of 1 total)
  • Author
  • Avatar

    Hi Peeps,

    I am attempting to add a mailbox permission to a bunch of users via the shell.

    This is what I have established so far:

    I have a text file of the SMTP addresses of the users. (c:users.txt)

    [email protected]
    [email protected]
    [email protected]
    [email protected]

    I ran the command $users = get-content “C:users.txt” | get-mailbox

    I know I want to use this command:

    $Users | add-mailboxpermission -user “Domainfirstnamelastname -AccessRights FullAcccess

    The problem is the add-mailboxpermission requires the -identity switch first, how do I reference $users?

    I tried a foreach-object but it didn’t work, any ideas?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.