Files
SGU-CredentialProvider/scripts/Invoke-SguCedClientEnrollment.ps1

18 lines
1.1 KiB
PowerShell

[CmdletBinding()]
param([switch]$InstallTask)
$ErrorActionPreference='Stop'
# Compatibility entry point for cached WLAN startup registrations.
# The global SYSTEMCENTER GPO owns installation, repair and version selection.
$canonical=Get-ScheduledTask -TaskName 'LCI-ConfigMgr2509-ClientRegistration' -ErrorAction SilentlyContinue
if(-not $canonical -or -not $canonical.Settings.Enabled -or $canonical.Actions.Arguments -notmatch 'SYSTEMCENTER\.lci\.lasalle\.mx.+Ensure-CMCurrentClient\.ps1'){
Write-Warning 'Apply the global Configuration Manager policy with gpupdate /target:computer /force. The retired CED installer task is not recreated.'
return
}
foreach($name in 'CED Configuration Manager enrollment','CED Configuration Manager policy enrollment'){
$old=Get-ScheduledTask -TaskName $name -ErrorAction SilentlyContinue
if($old -and $old.Settings.Enabled -and $old.State -ne 'Running'){Disable-ScheduledTask -InputObject $old|Out-Null}
}
if($InstallTask -and -not(Get-Service CcmExec -ErrorAction SilentlyContinue)){
Start-ScheduledTask -InputObject $canonical
}