Archive

Posts Tagged ‘DHCP’

Error Deactivating DHCP Scope

October 21, 2014 Leave a comment

On Windows Server 2008 R2 when using netsh to deactivate a DHCP scope you get an error that says, “The command needs a valid Scope IP Address”.

1 Error

Try again using an elevated PowerShell prompt.

2 Working

Categories: Computers Tags: , , ,

Error Renaming Network Card

July 26, 2011 3 comments

After installing KB2521220 on a server I noticed that my NICs no longer had static IP addresses & were picking up IP addresses from DHCP. Digging a little deeper I noticed that the NICs were all identified as new devices. Kind of like if you were to move a NIC from one slot to the other. It’s the same NIC but the OS identified it as a new device.


Before


After

I open Network Connections (ncpa.cpl) & see that the two NICs I had renamed are back to the default (Local Area Connection, Local Area Connection 2, etc.). I right click to rename the first one & get an error that says, “Cannot rename this connection. A connection with the name you specified already exists. Specify a different name.”

I do a little Binging (yeah, I said it) & come across KB269155. It basically talks about orphaned devices & how to remove them. Following Method 1 in the article I see the six orphaned NICs.

  • From a command prompt type set devmgr_show_nonpresent_devices=1
  • Open Device Manager (devmgmt.msc).
  • Click View>Show hidden devices.


I right click each of the orphaned NICs & select Uninstall. (Do not uninstall the driver!!!) After that I’m able to go back & rename my NICs.

Backup DHCP with PowerShell Script

March 1, 2011 10 comments

I found this script a while back on Jason Carter’s blog but it’s no longer active so I figured I’d post it here for reference. Be sure to change any paths to fit your environment.

#*****************************************************************
#
#   Script Name:  dhcpBackup.ps1
#   Version:  1.0
#   Author:  Jason Carter
#
#   Description:  Used to backup DHCP logs from the DHCP server
#   to another location for archiving purposes.
#
#***************************************************************** 

#Get Yestedays Date In Month, Day, Year format
$yesterday=(get-date (get-date).AddDays(-1) -uformat %Y%m%d)

#Get the first 3 letters of the day name from yesterday
$logdate=([string]((get-date).AddDays(-1).DayofWeek)).substring(0,3)

#Change path to DHCP log folder, copy yesterdays log file to backup location
cd C:\Windows\System32\dhcp
copy "DhcpSrvLog-$logdate.log" \\SERVER\SHARE\DHCParchive

#Rename log file with yesterdays date
cd \\SERVER\SHARE\DHCParchive
rename-item "DhcpSrvLog-$logdate.log" "$yesterday.log"

#Dump DHCP database
$today=(get-date -uformat %Y%m%d)
$dumpfile="DHCP_DUMP-$today.txt"
netsh dhcp server \\DC dump > \\SERVER\SHARE\DHCParchive\$dumpfile
Categories: Computers Tags: ,