Preserve machine identity for initial WLAN policy retrieval

This commit is contained in:
alexrg committed 2026-10-14 21:54:25 -06:00
1 parent 5cda541e3d
commit 656f1dd3bb
2 files changed
+33 -1

No files matched your search

+4 -1
View File
@@ -58,7 +58,10 @@ if(-not $profileState.MachineProfileReady){
# the primary DC; the signed and sealed machine binding protects the read.
$domainDn=($computer.Domain.Split('.')|ForEach-Object{'DC='+$_}) -join ','
$authentication=[DirectoryServices.AuthenticationTypes]::Secure -bor [DirectoryServices.AuthenticationTypes]::Signing -bor [DirectoryServices.AuthenticationTypes]::Sealing
$searchRoot=[DirectoryServices.DirectoryEntry]::new("LDAP://$primaryDomainController/CN=Policies,CN=System,"+$domainDn,$null,$null,$authentication)
# PowerShell converts null string constructor arguments to empty credentials.
# The path-only constructor retains the scheduled task's computer identity.
$searchRoot=[DirectoryServices.DirectoryEntry]::new("LDAP://$primaryDomainController/CN=Policies,CN=System,"+$domainDn)
$searchRoot.psbase.AuthenticationType=$authentication
$searcher=[DirectoryServices.DirectorySearcher]::new($searchRoot)
$searcher.ClientTimeout=[TimeSpan]::FromSeconds(10)
$searcher.ServerTimeLimit=[TimeSpan]::FromSeconds(10)