-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathGet-ICUserByNtUserId.ps1
More file actions
39 lines (31 loc) · 1.07 KB
/
Get-ICUserByNtUserId.ps1
File metadata and controls
39 lines (31 loc) · 1.07 KB
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
<#
# AUTHOR : Paul McGurn, based on Pierrick Lozach's original work
#>
function Get-ICUserByNtUserId()
{
# Documentation
<#
.SYNOPSIS
Gets an IC User by lookup of their NT user ID
.DESCRIPTION
Gets an IC User by lookup of their NT user ID
.PARAMETER ICSession
The Interaction Center Session
.PARAMETER NtUserId
The NT User ID for the user, ex. MyDomain\jsmith
#>
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)] [Alias("Session", "Id")] [ININ.ICSession] $ICSession,
[Parameter(Mandatory=$true)] [Alias("NtUserId", "User")] [String] $ICNtUserId
)
$headers = @{
"Accept-Language" = $ICSession.language;
"ININ-ICWS-CSRF-Token" = $ICSession.token;
}
$uri = $ICsession.baseURL + '/' + $ICSession.id + '/configuration/users?where='
$whereclause = 'ntDomainUser eq ' + [System.Web.HttpUtility]::UrlEncode($ICNtUserId)
$encodeduri = $uri + $whereclause
$response = Invoke-RestMethod -Uri $encodeduri -Method Get -Headers $headers -WebSession $ICSession.webSession -ErrorAction Stop
return [PSCustomObject]$response.items.configurationid
}