NinjaRMM/Check-IsDHCPServer.ps1

15 lines
316 B
PowerShell
Raw Normal View History

2023-12-18 18:18:15 +00:00
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"
}