Saturday 24 February 2018

HOW TO REMOVE MULTIPLE SCOPE ON DHCP USING POWERSHELL


HOW TO REMOVE MULTIPLE SCOPE ON DHCP USING POWERSHELL


Hey all,

I accidentally created lots of scope by mistake !!
it was not possible to delete all of the scope physically so I used simple poweshell script to do my job.

Edit as you according to your needs

For ($i=1; $i-lt 255;$i++)
{
$i= $i + 1

$scpID = "192.$i.0.0"
Write-host $scpID 

Remove-dhcpserverv4scope -computername "youcomputername.domain.local" -scopeid $scpID

}



Edit the IPaddress range and your FQDN name.
Save the above on notepad using .ps1 extenstion.

No comments:

Post a Comment