Create the default groups via PowerShell

Create the default groups via PowerShell

If your site is missing the three default groups “Visitors”, “Members” and “Owners”, you can create them easily with PowerShell or the Object Model.





thanks very much,.
May i know how to provide a custom permission level to a group based on the permissions levels [ read, view only,contribute, contributenodelete] using powershell.
if you can tell some code snipttes, then its will be great help!


Rishi Sharma


Thank you so much for posting the above scripts to create a Group but here i want to mention something which is:

The above command is only to create Groups if the site already been created. But if we want all the groups to be created at once at the time of creating a Site Collection, we need to type below script along with it.

PFB the complete script to create a site collections along with its Groups:

Add-PSSnapin Microsoft.SharePoint.PowerShell

New-SPSite -Url http://srtekbox55466:1111 -OwnerAlias $currentUser -Name NextGensmartContract -Language 1033 -Template


$web = Get-SPWeb http://srtekbox55466:1111
if ($web.AssociatedVisitorGroup -eq $null) {
Write-Host ‘loading…’ -ForegroundColor DarkYellow
$currentLogin = $web.CurrentUser.LoginName

if ($web.CurrentUser.IsSiteAdmin -eq $false){
Write-Host (‘The user ‘+$currentLogin+’ needs to be a SiteCollection administrator, to create the default

groups.’) -ForegroundColor Red

$web.CreateDefaultAssociatedGroups($currentLogin, $currentLogin, [System.String].Empty)
Write-Host ‘The default Groups have been created.’ -ForegroundColor Green
} else {
Write-Host ‘Enter all the values.’ -ForegroundColor Green


tristian o’brien


thaniks for this. this is for on-premise SharePoint. wont work for SharePoint online for anyone else that needs to know.


Leave a Reply