Windows DHCP 筛选池同步
#DHCP Filter Replication
#配置主要DHCP服务器名,将引号中内容改为主要服务器名
$MasterServerHostname = "dc-1"
#获取本地过滤
$LocalFilters = Get-DhcpServerv4Filter
#从主要DHCP服务器上获取远程过滤
$RemoteFilters = Invoke-Command -ComputerName $MasterServerHostname {Get-DhcpServerv4Filter}
#删除本地过滤设置
foreach ($filter in $LocalFilters)
{
Remove-DhcpServerv4Filter -MacAddress $filter.MacAddress
}
#导入新的过滤设置
foreach ($filterNew in $RemoteFilters)
{
Write-Host $filterNew.List
Write-Host $filterNew.MacAddress
Write-Host $filterNew.Description
Add-DhcpServerv4Filter -List $filterNew.List -MacAddress $filterNew.MacAddress -Description $filterNew.Description
}
添加定时任务