The Get-Random cmdlet is worth knowing about – as well as getting you a random integer number (you can set a range), it can also randomly choose one of a number of objects.
How is this useful? Let’s say you’ve set up paired Lync Server 2013 pools and want to move a batch of users to them, keeping a fairly even split between the pools. There are plenty of ways to achieve this, but a really effective, simple way is to use Get-Random to pick a pool for you. It’s compact enough to use in one-liners as well as scripts.
We specify the options to pick from with the -InputObject parameter, and separate the options with commas.
For example, we’ll move the Lync users in the Accounting OU to our new paired pools:
Get-CsUser -OU "ou=Accounting,dc=contoso,dc=com" | Move-CsUser -Target (Get-Random -InputObject "ukpool1.contoso.com","ukpool2.contoso.com") -Confirm:$false