Web Admin
2012-12-04 04:40:54 UTC
Hi all,
I have to create 150 new SP groups and populate them so decided to use
PowerShell to help automate.
I have two string arrays representing the group/user pairing. What's the PS
equivalent of Python's zip function? Or the C# equivalent for that matter?
:)
$groups = "groupA","groupB"...
$users = "userA","userB"...
foreach (*$group* in $groups)
{
if ($web.SiteGroups[*$group*] -eq $null)
{
#If the SharePoint group doesn't exist already
$newGroup = $web.SiteGroups.Add(*$group*, *$user*, $null, "")
}
}
Regards,
Paul
I have to create 150 new SP groups and populate them so decided to use
PowerShell to help automate.
I have two string arrays representing the group/user pairing. What's the PS
equivalent of Python's zip function? Or the C# equivalent for that matter?
:)
$groups = "groupA","groupB"...
$users = "userA","userB"...
foreach (*$group* in $groups)
{
if ($web.SiteGroups[*$group*] -eq $null)
{
#If the SharePoint group doesn't exist already
$newGroup = $web.SiteGroups.Add(*$group*, *$user*, $null, "")
}
}
Regards,
Paul