Fix CED ConfigMgr notification connectivity and verify online status

This commit is contained in:
alexrg committed 2026-10-01 10:30:18 -06:00
1 parent 46c0be732a
commit 11d49dc245
3 files changed
+80 -3

No files matched your search

@@ -0,0 +1,31 @@
[CmdletBinding()]
param()
$ErrorActionPreference = 'Stop'
if ($env:COMPUTERNAME -ine 'SGU-DC02') {
throw 'Run this site-specific firewall configuration on SGU-DC02.'
}
$address = '192.168.54.211'
if (-not (Get-NetIPAddress -AddressFamily IPv4 -IPAddress $address -ErrorAction SilentlyContinue)) {
throw 'The CED management-point address is not assigned to this server.'
}
$listener = @(Get-NetTCPConnection -LocalPort 10123 -State Listen -ErrorAction SilentlyContinue)
if (-not $listener.Count) { throw 'The Configuration Manager notification listener is not running.' }
$program = Join-Path $env:windir 'System32\dllhost.exe'
foreach ($connection in $listener) {
if ((Get-Process -Id $connection.OwningProcess).Path -ine $program) {
throw 'TCP 10123 is owned by an unexpected process; inspect it before opening the firewall.'
}
}
$settings = @{
Name = 'CED-ConfigMgr-Notification-TCP'
Direction = 'Inbound'; Action = 'Allow'; Enabled = 'True'; Profile = 'Domain'
Protocol = 'TCP'; LocalPort = 10123; LocalAddress = $address
RemoteAddress = '192.168.54.0/24'; Program = $program
Description = 'Allow CED clients to the Configuration Manager notification server; no public or other-subnet access.'
}
if (Get-NetFirewallRule -Name $settings.Name -ErrorAction SilentlyContinue) {
Set-NetFirewallRule @settings
} else {
New-NetFirewallRule @settings -DisplayName 'CED - ConfigMgr client notification TCP 10123' | Out-Null
}
Get-NetFirewallRule -Name $settings.Name | Select-Object Name,Enabled,Action,Profile
+21 -3
View File
@@ -3,12 +3,30 @@ param(
[Parameter(Mandatory)][PSCredential]$Credential,
[string]$TargetOuDn = 'OU=Centro de Experiencia Digital,OU=Laboratorio,DC=lci,DC=lasalle,DC=mx',
[string]$Ssid = 'Centro de Experiencia Digital',
[ValidatePattern('^[A-Za-z0-9]{3}$')][string]$SiteCode = 'LCI',
[string]$WacThumbprint = 'CF2B7C6899885BF9EB0E59054F8E8AB2D4390513'
)
$ErrorActionPreference = 'Stop'
Import-Module ActiveDirectory
Clear-DnsClientCache
$computers = @(Get-ADComputer -SearchBase $TargetOuDn -Filter 'Enabled -eq $true' -Properties DNSHostName)
$notification = @{}
$notificationError = $null
try {
foreach ($resource in (Get-CimInstance -Namespace ("root\SMS\site_"+$SiteCode) -ClassName SMS_CombinedDeviceResources)) {
$notification[$resource.Name] = $resource
}
} catch { $notificationError = $_.Exception.Message }
function Add-NotificationStatus($result) {
$resource = $notification[$result.Name]
# Null means no provider data, not a confirmed offline client.
$result | Add-Member -NotePropertyMembers @{
NotificationOnline = $(if ($resource) { $resource.CNIsOnline } else { $null })
NotificationMP = $(if ($resource) { $resource.CNAccessMP } else { $null })
NotificationLastOnlineTime = $(if ($resource) { $resource.CNLastOnlineTime } else { $null })
NotificationQueryError = $notificationError
} -PassThru
}
$online = @()
foreach ($computer in $computers) {
$client = [Net.Sockets.TcpClient]::new()
@@ -17,7 +35,7 @@ foreach ($computer in $computers) {
$available = $connect.AsyncWaitHandle.WaitOne(1000) -and $client.Connected
} catch { $available = $false } finally { $client.Dispose() }
if ($available) { $online += $computer.DNSHostName }
else { [pscustomobject]@{Name=$computer.Name;Reachable=$false;WifiConnected=$false;ClientRunning=$false;Error='No WinRM TCP connection at current DNS address.'} }
else { Add-NotificationStatus ([pscustomobject]@{Name=$computer.Name;Reachable=$false;WifiConnected=$false;ClientRunning=$false;Error='No WinRM TCP connection at current DNS address.'}) }
}
$options = New-PSSessionOption -OpenTimeout 10000 -OperationTimeout 60000
if ($online.Count) {
@@ -46,10 +64,10 @@ if ($online.Count) {
WacRootTrusted=(Test-Path ("Cert:\LocalMachine\Root\"+$thumbprint));Error=$null
}
})
$reported
foreach ($result in $reported) { Add-NotificationStatus $result }
foreach ($hostname in $online) {
if ($reported.PSComputerName -inotcontains $hostname) {
[pscustomobject]@{Name=$hostname.Split('.')[0];Reachable=$false;WifiConnected=$false;ClientRunning=$false;Error='WinRM session or client verification failed after TCP probe.'}
Add-NotificationStatus ([pscustomobject]@{Name=$hostname.Split('.')[0];Reachable=$false;WifiConnected=$false;ClientRunning=$false;Error='WinRM session or client verification failed after TCP probe.'})
}
}
}