-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathGet-IPAProcess.ps1
38 lines (32 loc) · 1.06 KB
/
Get-IPAProcess.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
<#
# AUTHOR : Pierrick Lozach
#>
function Get-IPAProcess() # {{{2
{
# Documentation {{{3
<#
.SYNOPSIS
Gets an IPA process
.DESCRIPTION
Gets an IPA process
.PARAMETER ICSession
The Interaction Center Session
.PARAMETER DefinitionId
The process definition id of the process
#> # }}}3
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)] [Alias("Session", "Id")] [ININ.ICSession] $ICSession,
[Parameter(Mandatory=$true)] [Alias("ProcessId")] [string] $DefinitionId
)
$headers = @{
"Accept-Language" = $ICSession.language;
"ININ-ICWS-CSRF-Token" = $ICSession.token;
}
# Get date using ISO 8601 format
$currentdate = Get-Date -Format s
$aYearAgo = (Get-Date).AddYears(-1).ToString("s")
$query = "/?beginSearchWindow=$($aYearAgo)&endSearchWindow=$($currentDate)&where definitionId eq $($DefinitionId)"
$response = Invoke-RestMethod -Uri "$($ICsession.baseURL)/$($ICSession.id)/ipa/process-instances/$($query)" -Method Get -Headers $headers -WebSession $ICSession.webSession -ErrorAction Stop
[PSCustomObject] $response
} # }}}2