I have a question, i'm adding users from a csv file to some groups, in this ex. it's MAX. 3 users/group.But what I want is, that I have 10 groups and then adding the random users from the csv file to the groups, then maybe i got 7 groups with 4 users and then last 3 with 3 users and thats OK.
But how do I changes this script, from just adding 3 users/group, to adding users to the "hardcoded" 10 groups, from the csv file?
ATM. I got this:
$deltager = Import-Csv C:\Users\Desktop\liste.csv
$holdstr = 3
$maxTeams = [math]::ceiling($deltager.Count/$holdstr)
$teams = @{}
$shuffled = $deltager | Get-Random -Count $deltager.Count
$shuffled | ForEach-Object { $i = 1 }{
$teams["$([Math]::Floor($i / $holdstr))"] += @($_.Navn)
$i++
}
$Grupper = $teams | Out-String
Write-Host $Grupper
Aucun commentaire:
Enregistrer un commentaire