48 lines
1.3 KiB
PowerShell
48 lines
1.3 KiB
PowerShell
|
<#
|
||
|
.SYNOPSIS
|
||
|
Personio Sync Script (Personio -> MEHRKANAL AD)
|
||
|
.DESCRIPTION
|
||
|
Dieses Script übernimmt Personenbezogene Daten aus Personio in die Active Directory
|
||
|
.EXAMPLE
|
||
|
PS C:\POSTV>.\mk.ps1
|
||
|
<Startet den Sync für alle User>
|
||
|
.NOTES
|
||
|
Author: Sebastian Mendyka <mendyka@mehrkanal.com>
|
||
|
Date: Sep 13, 2017
|
||
|
.Link
|
||
|
URL: https://developer.personio.de/v1.0/reference
|
||
|
#>
|
||
|
|
||
|
# 288 = 24 Stunden ( 288 x 5 (minuten) )
|
||
|
$MAXCOUNTER = "288"
|
||
|
|
||
|
$LOGDATE = Get-Date -Format "yyyy-MM-dd_"
|
||
|
$OWNPID = $([System.Diagnostics.Process]::GetCurrentProcess()).ID
|
||
|
$ScriptDir = [System.IO.Path]::GetDirectoryName($myInvocation.MyCommand.Definition)
|
||
|
$ini = .\functions\functions.ps1 "$ScriptDir\config.ini"
|
||
|
|
||
|
if (!( Test-Path "$ScriptDir\tmp\counter.txt" )){
|
||
|
New-Item -ItemType File "$ScriptDir\tmp\counter.txt"
|
||
|
$COUNTER = 0
|
||
|
$COUNTER | Out-File "$ScriptDir\tmp\counter.txt"
|
||
|
} else {
|
||
|
|
||
|
[int]$COUNTER = Get-Content "$ScriptDir\tmp\counter.txt"
|
||
|
}
|
||
|
|
||
|
$COUNTER ++
|
||
|
switch ( $COUNTER )
|
||
|
{
|
||
|
{$_ -le $MAXCOUNTER } {
|
||
|
Write-Output "$COUNTER ist kleiner"
|
||
|
& "$PSScriptRoot\sync_diff.ps1"
|
||
|
}
|
||
|
{$_ -gt $MAXCOUNTER } {
|
||
|
Write-Output "$COUNTER ist größer"
|
||
|
& "$PSScriptRoot\sync_full.ps1"
|
||
|
& "$PSScriptRoot\sync_adpicture.ps1"
|
||
|
$COUNTER = 0
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$COUNTER | Out-File "$ScriptDir\tmp\counter.txt"
|