-
Notifications
You must be signed in to change notification settings - Fork 7
/
New-ICWorkgroups.ps1
41 lines (36 loc) · 1.32 KB
/
New-ICWorkgroups.ps1
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<#
# AUTHOR : Pierrick Lozach
#>
function New-ICWorkgroups() # {{{2
{
# Documentation {{{3
<#
.SYNOPSIS
Creates new IC workgroups
.DESCRIPTION
Creates new IC workgroups.
.PARAMETER ICSession
The Interaction Center Session
.PARAMETER ICWorkgroups
Hashtable of user data, including usernames and extensions
Sample:
{"randomstring":{"workgroupname":"testcicworkgroup1","extension":"6001"}, "anotherrandomstring":{"workgroupname":"testcicworkgroup2","extension":"6002","members":{"testuser1","testuser2"}}
#> # }}}3
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)] [Alias("Session", "Id")] [ININ.ICSession] $ICSession,
[Parameter(Mandatory=$true)] [Alias("Workgroups", "WorkgroupData")] [string] $ICWorkgroups
)
$workgroups = ConvertFrom-Json $ICWorkgroups
$workgroups
$workgroups | Get-Member -MemberType NoteProperty | ForEach-Object {
$currentWorkgroup = $workgroups."$($_.Name)"
if (![string]::IsNullOrEmpty($currentWorkgroup.workgroupname)) {
if ($currentWorkgroup.Members) {
New-ICWorkgroup $ICSession -ICWorkgroup $currentWorkgroup.workgroupname -Extension $currentWorkgroup.extension -Members $currentWorkgroup.members
} else {
New-ICWorkgroup $ICSession -ICWorkgroup $currentWorkgroup.workgroupname -Extension $currentWorkgroup.extension
}
}
}
} # }}}2