Thursday, February 13, 2020

Powershell Script for add “everyone, except external users” to the visitors group

Dear Reader,

PS script to  add “everyone, except external users” to the visitors' group.

And finding the display name and login Name for users.

Just Replace Tenant name, organizations name, admin credentials

PS C:\WINDOWS\system32> $adminUPN="girishkumar@{Tenant}.onmicrosoft.com"

PS C:\WINDOWS\system32> $orgName="{Tenant name}"

PS C:\WINDOWS\system32> $userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."

PS C:\WINDOWS\system32> Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential

Get-SPOUser -Site https://$orgName.sharepoint.com/sites/SiteName | Select DisplayName, LoginName

PS C:\WINDOWS\system32> Add-SPOUser -Site https://$orgName.sharepoint.com/sites/Coronavirus -LoginName "c:0-.f|rolemanager|spo-grid-all-users/{GUID}" -Group "Site Visitors"

Display Name                   Login Name                                              Groups                 User Type
------------                   ----------                                              ------                 ---------
Everyone except external users spo-grid-all-users/{GUID} {Site Visitors} Member


All the Best! Thanks for reading my blog, please do comment and share if you feel helpful.


Kind Regards,

Girish Kumar M S

No comments:

Update or edit status filed in JIRA issue

the status field is a special case and can't be updated directly, which is the second problem here. Changing a status in Jira is called ...