none
DHCP : change the value of option 12 "hostname" RRS feed

  • Question

  • Hello,

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

    Thank you for your help

    Jeremy HEBERT

    Monday, April 1, 2019 8:53 AM

All replies

  • 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:

    https://docs.microsoft.com/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 tnmff@microsoft.com

    Tuesday, April 2, 2019 2:14 AM
    Moderator
  • 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

    Tuesday, April 2, 2019 11:02 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 tnmff@microsoft.com

    Wednesday, April 3, 2019 1:21 AM
    Moderator
  • 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 tnmff@microsoft.com

    Thursday, April 4, 2019 7:15 AM
    Moderator