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
    Posts

  • Pdog
    Member
    #156214

    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.

Download this eBook!

External Sharing and Guest User Access in Microsoft 365 and Teams

his eBook will dive into policy considerations you need to make when creating and managing guest user access to your Teams network, as well as the different layers of guest access and the common challenges that accompany a more complicated Microsoft 365 infrastructure. The eBook will also outline some of the major decision points across four general-purpose guest access policy scenarios for how an organization can set this up with standard licensing.

Download Now

Sponsored By