NinjaRMM/Check-IsDHCPServer.ps1
2023-12-18 18:18:15 +00:00

15 lines
316 B
PowerShell

try {
$DHCP = Get-DhcpServerInDC
}
catch {
$DHCP = $null
Write-Host "False"
Ninja-Property-Set isdhcpserver "False"
}
$DNSName = ([system.net.dns]::GetHostByName("localhost")).hostname
if ($DNSName -in $DHCP.DnsName){
Write-Host "True"
Ninja-Property-Set isdhcpserver "True"
}