forked from gildas/posh-ic
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Export-AttProfile.ps1
53 lines (45 loc) · 1.86 KB
/
Export-AttProfile.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
42
43
44
45
46
47
48
49
50
51
52
53
<#
# AUTHOR : Pierrick Lozach
#>
function Export-AttProfile() # {{{2
{
# Documentation {{{3
<#
.SYNOPSIS
Exports an Interaction Attendant profile
.DESCRIPTION
Exports All or specific Interaction Attendant profiles
.PARAMETER ProfileName
The Interaction Attendant profile to export. If not specified, all profiles will be exported.
#> # }}}3
[CmdletBinding()]
Param(
[Parameter(Mandatory=$false)] [Alias("Profile")] [string] $ProfileName
)
# Get Attendant Root registry key
$serverPath = (Get-ItemProperty 'HKLM:\SOFTWARE\Wow6432Node\Interactive Intelligence\EIC\Directory Services\Root').SERVER
$attendantRoot = "HKLM:\SOFTWARE\Wow6432Node\Interactive Intelligence\EIC\Directory Services\Root$serverPath\AttendantData"
$activeAttendant = (Get-ItemProperty $attendantRoot).ActiveConfig
$activeAttendantRoot = "$attendantRoot\$activeAttendant"
$filename = ''
if (-not [string]::IsNullOrEmpty($ProfileName)) {
# Export specific profile
$attendantProfiles = .\Search-Registry.ps1 -StartKey $activeAttendantRoot -Pattern $ProfileName -MatchData -ExactMatch
$attendantProfiles | ForEach-Object {
$filename = $_.Data + ".reg"
Reg Export $_.Key $filename /y
}
}
else {
# Export all profiles
$filename = $env:computername + ".reg"
Reg Export $activeAttendantRoot.Replace(':','') $filename /y
}
# Get local SITE & server name
$site = (Get-ItemProperty 'HKLM:\SOFTWARE\Wow6432Node\Interactive Intelligence\EIC\Directory Services\Root').SITE.Replace('\','')
$serverPath -match "\w+$" # Get end of string
$server = $matches[0]
# Replace Site and Server values with keywords (<SITE> AND <SERVER>) that will be used by Import-AttProfile
$regfilecontents = (Get-Content $filename).Replace($site, '<SITE>').Replace($server, '<SERVER>') | Out-File $filename -Force
Write-Output "Profile(s) exported to $filename"
} # }}}2