Reputation: 31
I keep on getting the following error when trying to run the Add-DhcpServerv4Reservation
command in PowerShell:
+ CategoryInfo : NotSpecified: (xxx.xxx.42.234:root/Microsoft/...erv4Reservation) [Add-DhcpServerv4Reservation], CimException + FullyQualifiedErrorId : WIN32 1753,Add-DhcpServerv4Reservation
(The xxx has actual numbers of an IP address)
I get this error when I try run the command on its own so:
Add-DhcpServerv4Reservation -Name test -ScopeId xxx.xxx.40.0 -IPAddress xxx.xxx.42.234 -ClientId 01-01-01-01-01-01 -Description computer -Type DHCP
As well as in the following script:
Import-Module DHCPServer
clear
$IP = Read-Host "Please type in the IP Address of the computer you would like to add"
clear
try {
$ReservationObj = Get-DhcpServerv4Reservation -ComputerName xxx.xxx.40.4 -IPAddress $IP -ErrorAction Stop
$Person = New-Object PSOBJECT
$Person | Add-Member "Device Name" $ReservationObj.GetCimSessionComputerName
$Person | Add-Member User $ReservationObj.Description
$MAC = $ReservationObj.ClientId
$MAC = $MAC -replace "-", ":"
$Person | Add-Member "MAC Address" $MAC
$Person | Add-Member "IP Address" $IP
Write-Output $Person | Format-List
} catch {
Write-Host "This IP address is not currently reserved and is available for use."
$Response = Read-Host "Would you like to add a new reservation for this IP address (yes)/(no)?"
if ($Response -eq "yes") {
$Description = Read-Host "Please enter the Manufacturer and Model of the device as well as it's owner (i.e its description)"
$MAC = Read-Host "Enter the computers MAC address (xx-xx-xx-xx-xx-xx)"
$Computer = Read-Host "Enter in the computer name."
Add-DhcpServerv4Reservation -Name $Computer -ScopeId xxx.xxx.40.0 -IPAddress $IP -ClientId $MAC -Description $Description -Type DHCP
Write-Host $Computer "has been added"
} else {
Write-Host "Nothing has been added"
}
}
Again the xxx would have been replaced with actual numbers, I have just not included the actual numbers in this post.
Anyone know why this error is happening?
Upvotes: 3
Views: 4139
Reputation: 81
I know this answer comes a little late, but I found that in the -ClientID parameter, the MAC Address must be lowercase and should only contain letters and numbers (no hyphens).
Example of a good MAC Address: 00155D36C906
Command example:
Add-DhcpServerv4Reservation -ScopeId 10.10.10.0 -IPAddress 10.10.10.2 -ClientId 00155D36C906 -Description "Test device" -Name "Test"
Upvotes: 0
Reputation: 173
According to https://technet.microsoft.com/en-us/library/jj590690(v=wps.630).aspx the parameter "ComputerName" specifies the DHCP-Server, where you want to create the reservation. If you're passing the clients name here, it will result in this error. Happened to me just a few minutes ago, as I got "Computername" and "Description" mixed up.
Upvotes: 1