Configure CED Wi-Fi policy and scoped management enrollment

This commit is contained in:
alexrg committed 2026-10-01 10:16:24 -06:00
1 parent b07dbe17d0
commit 46c0be732a
14 files changed
+921 -6

No files matched your search

+17 -6
View File
@@ -3,6 +3,7 @@ param(
[Parameter(Mandatory)][uri]$Endpoint,
[Parameter(Mandatory)][PSCredential]$Credential,
[string]$DomainController = $env:COMPUTERNAME,
[string]$ComputerOuDn = '',
[string[]]$VerifyNodes = @()
)
$ErrorActionPreference = 'Stop'
@@ -54,7 +55,12 @@ $login = Invoke-WebRequest -Uri "$base/api/user/login" -Method Post -WebSession
if ($login.StatusCode -ne 200) { throw 'WAC rejected the supplied account.' }
$existing = Invoke-RestMethod -Uri "$base/api/connections" -WebSession $webSession
$computers = @(Get-ADComputer -Server $DomainController -Filter 'Enabled -eq $true' -Properties OperatingSystem,DNSHostName |
$search = @{Server=$DomainController; Filter='Enabled -eq $true'; Properties=@('OperatingSystem','DNSHostName')}
if ($ComputerOuDn) {
Get-ADOrganizationalUnit -Identity $ComputerOuDn -Server $DomainController | Out-Null
$search.SearchBase = $ComputerOuDn
}
$computers = @(Get-ADComputer @search |
Where-Object { $_.DNSHostName -and $_.OperatingSystem -like 'Windows*' })
$pending = @(
foreach ($computer in $computers) {
@@ -84,9 +90,14 @@ if ($missing.Count) { throw "WAC inventory verification failed: $($missing.Name
foreach ($node in $VerifyNodes) {
if ($node -notmatch '^[A-Za-z0-9.-]+$') { throw 'Invalid verification hostname.' }
$uri = "$base/api/services/WinREST/CIM/nodes/$node/namespaces/root.cimv2/classes/Win32_OperatingSystem/instances"
$response = Invoke-WebRequest -Uri $uri -WebSession $webSession -UseBasicParsing
$result = $response.Content | ConvertFrom-Json
$instances = @($result.value | Where-Object { $null -ne $_ })
if (-not $instances.Count) { throw "WAC returned no OS instances for $node." }
[pscustomobject]@{Node=$node;Status=$response.StatusCode;Instances=$instances.Count;ReturnedData=$true}
try {
$response = Invoke-WebRequest -Uri $uri -WebSession $webSession -UseBasicParsing
$result = $response.Content | ConvertFrom-Json
$instances = @($result.value | Where-Object { $null -ne $_ })
if (-not $instances.Count) { throw "WAC returned no OS instances for $node." }
[pscustomobject]@{Node=$node;Status=$response.StatusCode;Instances=$instances.Count;ReturnedData=$true;Error=$null}
} catch {
# An offline node must not prevent verification of the remaining nodes.
[pscustomobject]@{Node=$node;Status=$null;Instances=0;ReturnedData=$false;Error=$_.Exception.Message}
}
}