mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-18 22:16:18 -05:00
19 lines
671 B
PowerShell
19 lines
671 B
PowerShell
$ErrorActionPreference = 'Stop'
|
|
$request = [Console]::In.ReadToEnd() | ConvertFrom-Json
|
|
switch ($request.operation) {
|
|
'add' {
|
|
Add-DnsClientNrptRule -Namespace ([string[]]$request.namespaces) -NameServers ([string[]]$request.servers) -Comment $request.tag | Out-Null
|
|
}
|
|
'remove' {
|
|
Get-DnsClientNrptRule | Where-Object { $_.Comment -eq $request.tag } | ForEach-Object {
|
|
Remove-DnsClientNrptRule -Name $_.Name -Force
|
|
}
|
|
}
|
|
'clear-stale' {
|
|
Get-DnsClientNrptRule | Where-Object { $_.Comment -like 'GPConnect:*' } | ForEach-Object {
|
|
Remove-DnsClientNrptRule -Name $_.Name -Force
|
|
}
|
|
}
|
|
default { throw 'Invalid DNS policy operation' }
|
|
}
|