Disable powershell for users on Microsoft 365

Copper Contributor

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

@DeepakRandhawa, Thanks, I already tried this but does not seem to impact the MSol module

 

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...

@DeepakRandhawa, yes I have tried this. However, it negatively affects the users ability to add participants to a meeting, Team etc., as searching for a user is not possible.