How to create a SPGroup in my site collection with no permission level assigned using PowerShell. I have created the below script. But it fails to create SPGroup.
foreach($groupName in $DisciplineGroups)
{
if ($mRootWeb.SiteGroups[$groupName] -ne $null)
{
Write-Host "Group "$($groupName)" already exists!"
Break;
}
else
{
$mRootWeb.SiteGroups.Add($groupName, $mWeb.SiteUsers
["domain\myidd.dev"], $null, $description)
Write-Host " group been created
on the root web $($mWeb.Title) with $($mWeb.url)"
$group = $mRootWeb.SiteGroups[$groupName]
$roleAssignment = new-object Microsoft.SharePoint.SPRoleAssignment
($group)
#$roleDefinition = $web.Site.RootWeb.RoleDefinitions
#[$permissionLevel]
$roleAssignment.RoleDefinitionBindings.Add($roleDefinition)
$mRootWeb.RoleAssignments.Add($roleAssignment)
$mRootWeb.Update()
}
or is this actually possible without a permission level?