Forum Discussion

Molerat's avatar
Molerat
Copper Contributor
Jul 24, 2020

Disable powershell for users on Microsoft 365

Hi

Is it possible to block user's access to powershell in Microsoft 365. We would like to block our students from being able to run cmdlets like Get-MSolRole, GetMSolRoleMember or retrieving a full list of users.

 

Regards

Andrew

4 Replies

  • https://docs.microsoft.com/en-us/powershell/exchange/disable-access-to-exchange-online-powershell?view=exchange-ps
      • DeepakRandhawa's avatar
        DeepakRandhawa
        Iron Contributor
        Have you tried below already:-

        Set-MsolCompanySettings -UsersPermissionToReadOtherUsersEnabled $false

        It should prevent users from retrieving a full list of users, however Get-MsolRole still seem to work.
        This cmdlet disable users' ability to use the Azure AD module for Windows PowerShell to access user information for their organization.
        https://docs.microsoft.com/en-us/powershell/module/msonline/set-msolcompanysettings?view=azureadps-1.0

Resources