question

tarouchabi-7271 avatar image
0 Votes"
tarouchabi-7271 asked tarouchabi-7271 commented

how to get member of "All users except external users".

Please teach me of "All users except external users" of Share point online.
With PowerShell or API, Can I get the members of "All users except external users".
And I want to remove the one members of "All users except external users".

office-sharepoint-online
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ChelseaWu-MSFT avatar image
0 Votes"
ChelseaWu-MSFT answered tarouchabi-7271 commented

Please note that “Everyone except external users” (All users except external users) is a group built into the SharePoint codebase rather than a modifiable object.

We cannot modify the membership of “Everyone except external users” as it does not actually have memberships.


Currently, there is no PowerShell script to get only tenant-wide internal users.

As a workaround, you can get the report for all user (including external users) using the "Export Users" feature via Microsoft 365 admin center > Users > Active users > Ellipsis (More actions) > Export Users. Then you can filter out the internal users in the exported CSV file, for example, by filtering "User principal name" field.

77038-screenshot-2021-03-12-142958.png

In addition, if you want to control which users can have access to SharePoint Online, consider using Conditional Access Policies to control user access instead.


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 12
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks a lot. Can I check the user of “Everyone except external users” by Get-SpoUser?
Now, I want to know about "Users of Get-SpoUser".
Because, After I ran "Set-SPOUser -Site $Site.URL -LoginName $Admin -IsSiteCollectionAdmin $false", $Admin remains as a member.
Occurs on 2 out of 1000 sites.

I checked.
After the $Admin connects with powershell, I could get $Admin with get-spouser.
Maybe, It is related “Everyone except external users”.

0 Votes 0 ·

No. Get-SPOUser returns the SharePoint Online user or security group accounts that match a given search criteria. For example, you can get the users in a specific site by running:

 Get-SPOUser -Site <SiteURL>

And if this site has granted permission for “Everyone except external users”, you will see it returned as member in the result.

77100-screenshot-2021-03-12-163940.png

The thing is, although “Everyone except external users” is a built-in domain group that represents “all internal users”, it is better to be considered as one object. It does not have the same function as a SharePoint group, so we will not get a list of users out of it.

Reference: Get-SPOUser.

0 Votes 0 ·

After I ran "Set-SPOUser -Site $Site.URL -LoginName $Admin -IsSiteCollectionAdmin $false", $Admin remains as a member. Only 2 sites in 1000 sites.
Do you know why? I want to remove admin from list.

And this admin user isn't showing up in the user gui "https://-my.sharepoint.com/personal/* /_layouts/15/people.aspx?MembershipGroupId=0".
So, I can't ask the user to remove the admin.

Get-SPOUser -Site https://-my.sharepoint.com/personal/ -LoginName admin@*** | fl

DisplayName : Admin
LoginName : admin@
IsSiteAdmin : False
IsGroup : False
Groups : {}
UserType : Member

0 Votes 0 ·

To answer your questions:

  1. The command Set-SPOUser -Site $Site.URL -LoginName $Admin -IsSiteCollectionAdmin $false is used to remove the user $Admin from the Site Collection Administrators list. It does not remove the user from the site.

    To remove a user from the site and also from the user information list, use the following command instead: Remove-SPOUser -Site $Site.URL -LoginName $Admin
    References: Set-SPOUser. / Remove-SPOUser.

  2. The site URL you refer to https://-my.sharepoint.com/personal/* is the link to user’s personal OneDrive site.
    This is the default outcome when you run this command on global administrators, it does not necessarily mean the user has access to the site.

0 Votes 0 ·

If you cannot find the Admin account in the site user information list, then there is no need to remove it.

0 Votes 0 ·

Why is “Everyone except external users” added without user operation?

0 Votes 0 ·
Show more comments