Well, that is just bonkers! The value changes in the MMC but it's lost after restarting the service. Looks like a bug to me!
You can try this as a work-around. The Remove-DhcpServerv4OptionValue will fail in the 1st iteration because I didn't bother to set it outside the loop, but it's just a demo so don't let it bother you:
#Ensure that you have a IP-Scope with 192.168.10.0
$ipscope = "192.168.10.0"
$ipscope_start = "192.168.10.1"
$ipscope_end = "192.168.10.254"
$ipscope_subnetmask = "255.255.255.0"
[ipaddress]$ip = "192.168.10.18" #Mention your IP-Adress you want to test
$DHCPServer = "SRV02" #Mention the Servername of your testserver
Add-DhcpServerv4Scope -ComputerName $DHCPServer -StartRange $ipscope_start -EndRange $ipscope_end -Name $ipscope -SubnetMask $ipscope_subnetmask
Add-DhcpServerv4Reservation -ComputerName $DHCPServer -ScopeId $ipscope -IPAddress $ip -ClientId "11-22-33-44-55-66" -Name "Initialname"
For ($i = 0; $i -le 5; $i++) {
Remove-DhcpServerv4OptionValue -ComputerName $DHCPServer -OptionID 12 -ReservedIP $ip
Remove-DhcpServerv4Reservation -ComputerName $DHCPServer -ReservedIP $IP
$reservationname = "Name$i"
Add-DhcpServerv4Reservation -ComputerName $DHCPServer -ScopeId $ipscope -IPAddress $ip -ClientId "11-22-33-44-55-66" -Name $reservationname -Description $reservationname -Type Dhcp
Set-DhcpServerv4OptionValue -ReservedIP $ip -OptionId 12 -Value $reservationname -ComputerName $DHCPServer
$OptionValue1 = Get-DhcpServerv4OptionValue -ReservedIP $Ip -ComputerName $DHCPServer # may return options 12 and 81
Write-Host "Current Option: $($OptionValue1.Value)"
Read-Host "Restart DHCP-Service?"
Restart-Service DHCPServer
sleep -Seconds 5
$OptionValue2 = Get-DhcpServerv4OptionValue -ReservedIP $Ip -ComputerName $DHCPServer
Write-Host "Option12 we want to set: $reservationname"
Write-Host "Option12 after restart: $($OptionValue2.Value)"
Read-Host "Next try?"
}