Configure CED Wi-Fi policy and scoped management enrollment
This commit is contained in:
1 parent
b07dbe17d0
commit
46c0be732a
14 files changed
+921
-6
No files matched your search
@@ -0,0 +1,32 @@
|
||||
[CmdletBinding()]
|
||||
param()
|
||||
$ErrorActionPreference = 'Stop'
|
||||
# Invoked by the CED computer startup policy, after the native WLAN CSE.
|
||||
$destination = 'C:\ProgramData\LCI-Admin\CED-WiFi'
|
||||
New-Item $destination -ItemType Directory -Force | Out-Null
|
||||
$dnsBackup = 'C:\ProgramData\LCI-Admin\CED-dns-before.json'
|
||||
if (-not (Test-Path $dnsBackup)) {
|
||||
Get-DnsClientServerAddress -AddressFamily IPv4 | Select-Object InterfaceAlias,InterfaceIndex,ServerAddresses |
|
||||
ConvertTo-Json -Depth 3 | Set-Content -LiteralPath $dnsBackup
|
||||
}
|
||||
# Keep public DNS available through the router if the domain DNS server is
|
||||
# offline. The separate CED NRPT GPO still pins internal names to domain DNS.
|
||||
$wifi = @(Get-NetAdapter | Where-Object { $_.NdisPhysicalMedium -eq 9 -and $_.Status -eq 'Up' })
|
||||
foreach ($adapter in $wifi) {
|
||||
Set-DnsClientServerAddress -InterfaceIndex $adapter.InterfaceIndex -ServerAddresses '192.168.54.211','192.168.54.1'
|
||||
}
|
||||
$acl = [Security.AccessControl.DirectorySecurity]::new()
|
||||
$acl.SetAccessRuleProtection($true,$false)
|
||||
foreach ($sid in 'S-1-5-18','S-1-5-32-544') {
|
||||
$acl.AddAccessRule([Security.AccessControl.FileSystemAccessRule]::new(
|
||||
[Security.Principal.SecurityIdentifier]::new($sid),'FullControl','ContainerInherit,ObjectInherit','None','Allow'))
|
||||
}
|
||||
Set-Acl -LiteralPath $destination -AclObject $acl
|
||||
Copy-Item (Join-Path $PSScriptRoot 'Connect-SguCedWifi.ps1') $destination -Force
|
||||
$helper = Join-Path $destination 'Connect-SguCedWifi.ps1'
|
||||
$arguments = '-NoProfile -NonInteractive -ExecutionPolicy Bypass -File "{0}" -RequireGroupPolicy -TimeoutMinutes 2 -StatusPath "{1}"' -f $helper,(Join-Path $destination 'status.json')
|
||||
$action = New-ScheduledTaskAction -Execute "$env:WINDIR\System32\WindowsPowerShell\v1.0\powershell.exe" -Argument $arguments
|
||||
$triggers = @((New-ScheduledTaskTrigger -AtStartup),(New-ScheduledTaskTrigger -Once -At (Get-Date).AddMinutes(1) -RepetitionInterval (New-TimeSpan -Minutes 15)))
|
||||
$settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -MultipleInstances IgnoreNew -ExecutionTimeLimit (New-TimeSpan -Minutes 5)
|
||||
Register-ScheduledTask -TaskName 'CED WiFi policy connection' -Action $action -Trigger $triggers -Settings $settings -User SYSTEM -RunLevel Highest -Force | Out-Null
|
||||
Start-ScheduledTask 'CED WiFi policy connection'
|
||||
Reference in new issue
Block a user