Views:

To build a large number of Call queues from a list, start with a text file with all of the call queue names. There should be no spaces in the names, and for simplicity use a text file.  The names do not need to be formatted in any specific way. This is the recommended method, for more advanced powershell methods engage a senior resource. 

List example with a text file.



Variables to Create. 
$a=get-content "c:\temp\list.txt" or $a = Import-Csv -Path "C:\list.csv”
$domain = "@<domainname>" (insert the domain upn suffix being used) ie $domain = "@contoso.com"

Either from text or list to build the variable for a.

The application instance creates the CQ user, sets the usage location, and finally sets the virtual phone system license.  

New-CsOnlineApplicationInstance (SkypeForBusiness) | Microsoft Docs

foreach ($b in $a) {New-CsOnlineApplicationInstance -ApplicationId "11cd3e2e-fccb-42ad-ad00-878b93575e07" -DisplayName $b.DisplayName -UserPrincipalName "$b$domain" }
foreach ($b in $a){Set-MsolUser -UserPrincipalName "$b$domain" -UsageLocation "US"}
$sku=Get-MsolAccountSku | where{$_.accountskuid -like "*PHONESYSTEM_VIRTUALUSER"}
foreach ($b in $a){Set-MsolUserLicense -UserPrincipalName "$b$domain" -AddLicenses $sku.accountskuid}

Create the call queue, options may vary, New-CsCallQueue (SkypeForBusiness) | Microsoft Docs
This is the recommended options for general call queues. 

 

foreach ($b in $a) {New-CsCallQueue -name $b -UseDefaultMusicOnHold $true -RoutingMethod Attendant  -AllowOptOut $true -AgentAlertTime 30 -OverflowThreshold 50 -OverflowAction DisconnectWithBusy -TimeoutThreshold 1200 -TimeoutAction Disconnect}

Join the CQ App and CQ User
Get the User Application IDs for the apps created
 

$appid=foreach ($b in $a) {(get-csonlineuser "$b$domain").objectid}
$cqid=foreach ($b in $a){get-cscallqueue -NameFilter $b}

Build the call queue association
Foreach ($c in $appid) {New-CsOnlineApplicationInstanceAssociation -Identities @($c.objectid) -ConfigurationId ($cqid | Where-Object {$_.name -EQ $c.displayname}).identity -ConfigurationType CallQueue}