Share via


DHCP : change the value of option 12 "hostname"

Question

Monday, April 1, 2019 8:53 AM

Hello,

Is it possible to change the value of DHCP option 12 "hostname" in powershell?

Thank you for your help

Jeremy HEBERT

All replies (4)

Tuesday, April 2, 2019 2:14 AM

Hi,

You can use command Set- Dhcp Serverv4Option Value to change the option.

**Set-DhcpServerv4OptionValue -ComputerName "dhcpserver.contoso.com" -ScopeId 10.10.10.0 -OptionId 12 -Value "hostname" **

Please refer to the link below:

/en-us/powershell/module/dhcpserver/set-dhcpserverv4optionvalue?view=win10-ps

Best regards,

Travis

Please remember to mark the replies as an answers if they help.
If you have feedback for TechNet Subscriber Support, contact [email protected]


Tuesday, April 2, 2019 11:02 AM

I get an error

Set-DhcpServerv4OptionValue -ComputerName "dhcpserver.contoso.com" -ScopeId 10.10.10.0 -OptionId 12 -Value "hostname"

"computerName" is the name of the reservation of my computer?

I have reservations in which I would like to enter the HOSTNAME for all my reservations, obviously they all have different names.

PS C:\Windows\system32> Set-DhcpServerv4OptionValue -ComputerName "DELL_3040.upn.parisnanterre.fr" -ScopeId 172.28.0.0 -OptionId 12 -Value "PIPO"
Set-DhcpServerv4OptionValue : Échec de l’obtention de la version du serveur DHCP DELL_3040.upn.parisnanterre.fr.
Au caractère Ligne:1 : 1
+ Set-DhcpServerv4OptionValue -ComputerName "DELL_3040.upn.parisnanterre.fr" -Scop ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*    + CategoryInfo          : NotSpecified: (DELL_3040.upn.parisnanterre.fr:root/Microsoft/...erv4OptionValue) [Set-DhcpServerv4OptionValue], CimException*
*    + FullyQualifiedErrorId : WIN32 1722,Set-DhcpServerv4OptionValue*

 

Jeremy HEBERT


Wednesday, April 3, 2019 1:21 AM

Hi,

"computerName" is your DNS server name.

Set option value for DNS server for a reservation:

Set-DhcpServerv4OptionValue -ComputerName "dhcpserver.contoso.com" -ReservedIP 10.10.10.5 -OptionId 12 -Value "hostname"

Best regards,

Travis

Please remember to mark the replies as an answers if they help.
If you have feedback for TechNet Subscriber Support, contact [email protected]


Thursday, April 4, 2019 7:15 AM

Hi,

Just checking in to see if the information provided was helpful.

Please let us know if you would like further assistance.

Best Regards,

Travis

Please remember to mark the replies as an answers if they help.
If you have feedback for TechNet Subscriber Support, contact [email protected]