-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathItGlueEntry_Folder.ps1
28 lines (24 loc) · 1.11 KB
/
ItGlueEntry_Folder.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
#Requires -Modules @{ModuleName="Devolutions.PowerShell"; ModuleVersion="2023.2.0.1"} -Version 7
# BKM-Orange
# JAAL - 06/06/2023
# Recovering the default ItGlue entry
Set-RDMCurrentRepository (Get-RDMRepository -Name 'Template_Vault')
$ItGlue = Get-RDMSession -Name 'IT Glue [To be configured]'
# Recovering existing credential entries
Set-RDMCurrentRepository (Get-RDMRepository -Name 'Default')
$Sessions = Get-RDMSession
$Folders = $Sessions | Where-Object{$_.ConnectionType -eq 'Group' -and $_.Name -eq $_.Group}
# Verifying if ItGlue credentials already exist
$ExistingCredentials = ($Sessions | Where-Object{$_.ConnectionType -eq 'Credential' -and $_.Credentials.ITGlueSafeApiKey}).Group
foreach($Folder in $Folders){
$Test = $ExistingCredentials | Where-Object{$_ -match $Folder.Name}
if(!$Test){
# Creating the entry
$ItGl = Copy-RDMSession $ItGlue
$ItGl.Group = $Folder.Group
# Adding mark in order to note further configuration
$ItGl.Name = "$($Folder.Name) [To be configured]"
Set-RDMSession $ItGl
Write-Host "Session created for: $($Folder.Name)"
}
}