Hi
Not really fluent in Python, so I just googled for what zip does. If I
undestood correctly, all you need is to index the second array. Like this:
$groups = "groupA","groupB";
$users = "userA","userB";
$index = 0
foreach ($group in $groups)
{
Write-Host("Adding " + $users[$index++] + " to group " + $group);
}
Does this resolve your issue?
On Tue, Dec 4, 2012 at 3:40 PM, Web Admin <[email protected]>wrote:
> 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
>
> _______________________________________________
> ozmoss mailing list
> [email protected]
> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
>
>
_______________________________________________
ozmoss mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss