-
Notifications
You must be signed in to change notification settings - Fork 7
/
Get-ICWorkgroup.ps1
42 lines (37 loc) · 1.01 KB
/
Get-ICWorkgroup.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 Get-ICWorkgroup() # {{{2
{
# Documentation {{{3
<#
.SYNOPSIS
Gets a workgroup
.DESCRIPTION
Gets a workgroup
.PARAMETER ICSession
The Interaction Center Session
.PARAMETER ICWorkgroup
The Interaction Center Workgroup
#> # }}}3
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)] [Alias("Session", "Id")] [ININ.ICSession] $ICSession,
[Parameter(Mandatory=$true)] [Alias("Workgroup")] [string] $ICWorkgroup
)
$headers = @{
"Accept-Language" = $ICSession.language;
"ININ-ICWS-CSRF-Token" = $ICSession.token;
}
$response = '';
try {
$response = Invoke-RestMethod -Uri "$($ICsession.baseURL)/$($ICSession.id)/configuration/workgroups/$ICWorkgroup" -Method Get -Headers $headers -WebSession $ICSession.webSession -ErrorAction Stop
}
catch [System.Net.WebException] {
# If user not found, ignore the exception
if (-not ($_.Exception.message -match '404')) {
Write-Error $_
}
}
[PSCustomObject] $response
} # }}}2