我試着寫了一個腳本,會發現(並在以後添加預訂)的DHCP設備。我遇到的問題有一個範圍,在這個範圍內,我們手動劃分了不同的IP範圍,應該添加某些類型的設備。的Windows,DHCP服務器保留 - 尋找免費的IP地址
E.g.範圍10.92.0.0/24和我們指定範圍爲
10.92.0.10-20的iPhone等 10.92.0.10.50 Android手機等
我已經得到的地步腳本通過我提供給它的IP範圍,以及GET GET保留或顯示錯誤。我一直在想,第一個錯誤可以被視爲免費的IP。
任何想法的人? :)
# Get DHCP Scope
$Start = 100
$End = 140
$DHCPServer = "dhcpserver.company.com"
# Find Free IP address
#It can use to get DHCP reservation by IP and find the one which returns error - which can be used as the free one - loop done
#Now how to tell it to stop when the error occures?
While ($Start -le $End) {
$IP = "10.92.0.$Start"
Write-Host "Reservation for: $IP" -ForegroundColor Cyan
Get-DhcpServerv4Reservation -ComputerName $DHCPServer -IPAddress $IP
$Start++
}
詹姆斯它的工作,謝謝! –
沒有爲獲得免費的DHCP服務器租用一個專用的cmdlet:'GET-DhcpServerv4FreeIPAddress'。 – Adamar