-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdepartments.ps1
28 lines (23 loc) · 997 Bytes
/
departments.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
#######################################
# HelloID-Conn-Prov-Source-Foederis-Departments
#
# Version: 1.0.0
#######################################
# Initialize default value's
$WarningPreference = "SilentlyContinue"
$config = ConvertFrom-Json $configuration
$WorkingPath = $config.WorkingPath
$CsvName = $config.CsvNameHID
$CsvFilePath = $WorkingPath + "\" + $CsvName
Start-sleep 10
# Importing the departments
$departments = Import-CSV -Path $CsvFilePath -Delimiter ";" -Header Matricule, Nom, Prenom, Direction,CodeDirection,UF,CodeUF,Emploi,CodeEmploi,MangerNomAffiche,ManagerMatricule,DatePasBesoin,DateSortie,DateEntree | Select-Object -SkipLast 3 | where-object {$_."Direction" -ne ''} | select-object CodeDirection, Direction -Unique
foreach($item in $departments)
{
$department = @{
ExternalId=$item.CodeDirection
DisplayName=$item.Direction
Name=$item.Direction
}
Write-Output ($department | ConvertTo-Json -Depth 50)
}