start-sync.psm1
<#
.NOTES ======================================================================== Created by: Byran Schomburg Website: www.schomburg.dev Copyright: (c) 2024 Byran Schomburg. All rights reserved. ======================================================================== .SYNOPSIS Runs the Start-ADSyncSyncCycle command .DESCRIPTION This module runs the Start-ADSyncSyncCycle command. With the -server parameter you can also specify a server where the Sync Service is running. With the -policy parameter you can specify which policytype should be user. If you leave this parameter empty, the standard "delta" will be used. .EXAMPLE PS> start-sync .EXAMPLE PS> start-sync -server "SERVERNAME" .EXAMPLE PS> start-sync -policy "POLICYTYPE" .EXAMPLE PS> start-sync -server "SERVERNAME" -policy "POLICYTYPE" #> #TODO: Located in Azure/start-sync/ function start-sync { param ( [string] $server, [string] $policy ) if ($server) { if($policy){ invoke-command -computername $server -scriptblock { Import-Module -Name "C:\Program Files\Microsoft Azure AD Sync\Bin\ADSync" start-ADSyncSyncCycle -policytype $policy } } else { invoke-command -computername $server -scriptblock { Import-Module -Name "C:\Program Files\Microsoft Azure AD Sync\Bin\ADSync" start-ADSyncSyncCycle -policytype delta } } } else { if ($policy) { Import-Module -Name "C:\Program Files\Microsoft Azure AD Sync\Bin\ADSync" start-ADSyncSyncCycle -policytype $policy } else { Import-Module -Name "C:\Program Files\Microsoft Azure AD Sync\Bin\ADSync" start-ADSyncSyncCycle -policytype delta } } } Export-ModuleMember -Function * |