ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    M365 Migration - helpful scripts

    IT Discussion
    m365 exchange script dashrender
    2
    8
    616
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DashrenderD
      Dashrender
      last edited by Dashrender

      I'm migrating from on-premise Exchange to M365. I'm doing a cutover process.

      One of issues I've run into is M365 doesn't work well with group permissions to get users to access other people's calendars. As such I need to remove all the new useless groups from my select users, then script in access for all the users.

      These scripts require you to made modifications for your own use.

      First script here is listing all the permissions on a list of mailboxes in a give group.

      $Group = 'name of your group here'
      ForEach ($User_Mailbox in (get-azureadgroup -Filter "Displayname eq '$Group'" | get-azureadgroupmember -All $true))
      {
       Get-MailboxFolderPermission -Identity "$($User_Mailbox.Displayname):\Calendar"
      }
      

      Next is deleting a specific user/group from the calendar permission

      $Group = 'your group name here'
      ForEach ($User_Mailbox in (get-azureadgroup -Filter "Displayname eq '$Group'" | get-azureadgroupmember -All $true))
      {
       Remove-MailboxFolderPermission -Identity "$($User_Mailbox.Displayname):\Calendar" -User "name of user/group to remove"
      }
      

      With the remove command, you can add -Confirm:$false to have it skip confirming each removal.

      Export a full list of users from Azure AD

      $FilePath = 'the path where you want your CSV file saved'
      get-azureaduser -All $true | Select-Object -Property UserPrincipalName,Displayname | Export-Csv -Path $FilePath
      
      JaredBuschJ 1 Reply Last reply Reply Quote 1
      • DashrenderD
        Dashrender
        last edited by Dashrender

        My real time saver

        This will import a list of users, and grant them PublishingEditor to all members of the desired group.

        $Group = 'NPP'
        $ImportCsvFile = 'c:\esd\tuc-users-clean1.csv'
        $employee_list = Import-Csv $ImportCsvFile
        ForEach ($employee in $employee_list) {
          ForEach ($User_Mailbox in (get-azureadgroup -Filter "Displayname eq '$Group'" | get-azureadgroupmember -All $true))
          {
           add-mailboxfolderpermission -Identity "$($User_Mailbox.displayname):\Calendar" -User $employee.UserPrincipalName -AccessRights PublishingEditor
           $User_Mailbox.Displayname
           $employee.UserPrincipalName
          }
        }
        
        1 Reply Last reply Reply Quote 0
        • JaredBuschJ
          JaredBusch @Dashrender
          last edited by

          @dashrender You used $group but did not define it in your first example.

          DashrenderD 1 Reply Last reply Reply Quote 0
          • DashrenderD
            Dashrender @JaredBusch
            last edited by

            @jaredbusch said in M365 Migration - helpful scripts:

            @dashrender You used $group but did not define it in your first example.

            it's not defined on purpose - several of these have undefined, it's expected that you will define/replace them yourself.

            JaredBuschJ 1 Reply Last reply Reply Quote 0
            • JaredBuschJ
              JaredBusch @Dashrender
              last edited by JaredBusch

              @dashrender said in M365 Migration - helpful scripts:

              @jaredbusch said in M365 Migration - helpful scripts:

              @dashrender You used $group but did not define it in your first example.

              it's not defined on purpose - several of these have undefined, it's expected that you will define/replace them yourself.

              That is a very poor guide. You posted a script. I expect to copy and paste it and see something work.

              DashrenderD 2 Replies Last reply Reply Quote 0
              • DashrenderD
                Dashrender @JaredBusch
                last edited by

                @jaredbusch said in M365 Migration - helpful scripts:

                @dashrender said in M365 Migration - helpful scripts:

                @jaredbusch said in M365 Migration - helpful scripts:

                @dashrender You used $group but did not define it in your first example.

                it's not defined on purpose - several of these have undefined, it's expected that you will define/replace them yourself.

                That is a very poor guide. You posted a script. I expect to copy and paste it and see something work.

                How could I possibly know the names of your groups?

                1 Reply Last reply Reply Quote 0
                • DashrenderD
                  Dashrender @JaredBusch
                  last edited by

                  @jaredbusch said in M365 Migration - helpful scripts:

                  @dashrender said in M365 Migration - helpful scripts:

                  @jaredbusch said in M365 Migration - helpful scripts:

                  @dashrender You used $group but did not define it in your first example.

                  it's not defined on purpose - several of these have undefined, it's expected that you will define/replace them yourself.

                  That is a very poor guide. You posted a script. I expect to copy and paste it and see something work.

                  Jared is right to a point.

                  I've now gone back and added variables to all of my scripts making it easier for someone using these to see that they need to enter their own information into the variables to make it work.
                  I could take it a step further and prompt for that data - but one thing at a time.

                  JaredBuschJ 1 Reply Last reply Reply Quote 1
                  • JaredBuschJ
                    JaredBusch @Dashrender
                    last edited by

                    @dashrender said in M365 Migration - helpful scripts:

                    @jaredbusch said in M365 Migration - helpful scripts:

                    @dashrender said in M365 Migration - helpful scripts:

                    @jaredbusch said in M365 Migration - helpful scripts:

                    @dashrender You used $group but did not define it in your first example.

                    it's not defined on purpose - several of these have undefined, it's expected that you will define/replace them yourself.

                    That is a very poor guide. You posted a script. I expect to copy and paste it and see something work.

                    Jared is right to a point.

                    I've now gone back and added variables to all of my scripts making it easier for someone using these to see that they need to enter their own information into the variables to make it work.
                    I could take it a step further and prompt for that data - but one thing at a time.

                    1ac5e2e9-a96b-4311-b299-0cd34fcc7b14-image.png

                    1 Reply Last reply Reply Quote 0
                    • 1 / 1
                    • First post
                      Last post