Just a quick example on how you can create an auto picker to create two teams from a list.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[System.Collections.ArrayList]$userList = 'Colleen', 'Namoli', 'Maura', 'John', 'Charlotte'

$teams = @()
while ($userList)
{
  $player1 = Get-Random -InputObject $userList
  $userList.Remove($player1)
  if ($userList)
  {
    $player2 = Get-Random -InputObject $userList
    $userList.Remove($player2)
    $teams += New-Object -TypeName psobject -Property @{
      'Blue Team' = ('{0}' -f $player1)
      'Red Team' = ('{0}' -f $player2)
    }
  }
  else
  {
    $teams += New-Object -TypeName psobject -Property @{
      'Blue Team' = ('{0}' -f $player1)
      'Red Team' = ''
    }
  }
}

$teams
Categories: Powershell