Set-DhcpServerv4OptionValue

Set-DhcpServerv4OptionValue

Sets an IPv4 option value at the server, scope, or reservation level.

Syntax

Parameter Set: OptionIds
Set-DhcpServerv4OptionValue [-OptionId] <UInt32> [-Value] <String[]> [[-ScopeId] <IPAddress> ] [-AsJob] [-CimSession <CimSession[]> ] [-ComputerName <String> ] [-Force] [-PassThru] [-PolicyName <String> ] [-ReservedIP <IPAddress> ] [-ThrottleLimit <Int32> ] [-UserClass <String> ] [-VendorClass <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: CommonOptions
Set-DhcpServerv4OptionValue [[-ScopeId] <IPAddress> ] [-AsJob] [-CimSession <CimSession[]> ] [-ComputerName <String> ] [-DnsDomain <String> ] [-DnsServer <IPAddress[]> ] [-Force] [-PassThru] [-PolicyName <String> ] [-ReservedIP <IPAddress> ] [-Router <IPAddress[]> ] [-ThrottleLimit <Int32> ] [-UserClass <String> ] [-WinsServer <IPAddress[]> ] [-Wpad <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Set-DhcpServerv4OptionValue cmdlet sets an IPv4 option value at the server, scope, or reservation level. The definition for the option must already exist. This cmdlet will fail if the option definition does not exist in the Dynamic Host Configuration Protocol (DHCP) server service. If only the ReservedIP parameter is specified, then the option values are set at the reservation level. If only the ScopeId parameter is specified, then the option values are set at the scope level. If neither the ScopeId nor ReservedIP parameter is specified, then the option values are set at the server level. If the VendorClass parameter is specified, then the option value is set for that vendor class. If the UserClass parameter is specified, then the option value is set for that user class. If the PolicyName parameter is specified, then the option values are set for that policy. The UserClass and PolicyName parameters cannot both be specified. The ScopeId and ReservedIP parameters cannot both be specified.

The PolicyName and ReservedIP parameters cannot both be specified.

Note: The option values for policies can only be set for a DHCP server service running on Windows Server® 2012. Setting user class options for a DHCP server service running on Windows Server 2012 creates of a policy with the policy name set to the name of the user class. For a DHCP server service running on or earlier, only option values based upon the user class can be set.

To set options based upon legacy user classes, then the UserClass parameter must be specified.

Parameters

-AsJob

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CimSession<CimSession[]>

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ComputerName<String>

Specifies the DNS name, or IPv4 or IPv6 address, of the target computer running the DHCP server service.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DnsDomain<String>

Specifies the value for the DNS domain option.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-DnsServer<IPAddress[]>

Specifies one or more values for the DNS server option, in the IPv4 address format.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-Force

Specifies that the DNS server validation will be skipped. This parameter is only applicable if the DnsServer parameter is specified.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-OptionId<UInt32>

Specifies the numeric identifier (ID) of the option for which one or more values are set.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-PassThru

Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PolicyName<String>

Specifies the name of the policy for which one or more option values are set.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-ReservedIP<IPAddress>

Specifies the IPv4 address of the reservation for which one or more option values are set.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-Router<IPAddress[]>

Specifies one or more values for the router or default gateway option, in IPv4 address format.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-ScopeId<IPAddress>

Specifies the scope ID, in IPv4 address format for which one or more option values are set.

Aliases

none

Required?

false

Position?

3

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-ThrottleLimit<Int32>

Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0 is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-UserClass<String>

Sets the option value for the specified user class.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-Value<String[]>

Specifies one or more values to be set for the option. The format that the values need to be specified is specified per the data type of the options as follows:
-- Byte, Word, DWord, DWordDword: The values need to be specified as decimal or hexadecimal strings
-- IPAddress, IPv6Address: The values will need to be specified as strings
-- String: The values will need to be specified as strings
-- BinaryData, EncapsulatedData: The values will need to be specified as hexadecimal strings

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-VendorClass<String>

Sets the option value for the specified vendor class.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-WinsServer<IPAddress[]>

Specifies the values for the WINS server option, in IPv4 address format.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-Wpad<String>

Specifies the value for the web proxy auto detection option. The value for this option is specified as a URL.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DHCP/DhcpServerv4OptionDefinition

    The Microsoft.Management.Infrastructure.CimInstance object is a wrapper class that displays Windows Management Instrumentation (WMI) objects. The path after the pound sign (#) provides the namespace and class name for the underlying WMI object.

  • Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DHCP/DhcpServerv4OptionValue

    The Microsoft.Management.Infrastructure.CimInstance object is a wrapper class that displays Windows Management Instrumentation (WMI) objects. The path after the pound sign (#) provides the namespace and class name for the underlying WMI object.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DHCP/DhcpServerv4OptionValue

    The Microsoft.Management.Infrastructure.CimInstance object is a wrapper class that displays Windows Management Instrumentation (WMI) objects. The path after the pound sign (#) provides the namespace and class name for the underlying WMI object.

Examples

EXAMPLE 1

This example sets the server level option values for DNS server, WINS server, DNS domain, router, and WPAD.

PS C:\> Set-DhcpServerv4OptionValue -ComputerName dhcpserver.contoso.com -DnsServer 192.168.1.2 -WinsServer 192.168.1.3 -DnsDomain contoso.com -Router 192.168.1.1 -Wpad http://proxy.contoso.com/wpad.dat

EXAMPLE 2

This example sets the option values for DNS server, WINS server, DNS domain, router, and WPAD for scope 10.10.10.0.

PS C:\> Set-DhcpServerv4OptionValue -ComputerName dhcpserver.contoso.com -ScopeId 10.10.10.0 -DnsServer 192.168.1.2 -WinsServer 192.168.1.3 -DnsDomain contoso.com -Router 192.168.1.1 -Wpad http://proxy.contoso.com/wpad.dat

EXAMPLE 3

This example sets the option values for DNS server, WINS server, DNS domain, router, and WPAD for reserved IP address 10.10.10.5.

PS C:\> Set-DhcpServerv4OptionValue -ComputerName dhcpserver.contoso.com -ReservedIP 10.10.10.5 -DnsServer 192.168.1.2 -WinsServer 192.168.1.3 -DnsDomain contoso.com -Router 192.168.1.1 -Wpad http://proxy.contoso.com/wpad.dat

EXAMPLE 4

This example sets the option values for DNS server, WINS server, DNS domain, router, and WPAD for policy named LabComputers in the scope 10.10.10.0.

PS C:\> Set-DhcpServerv4OptionValue -ComputerName dhcpserver.contoso.com -ScopeId 10.10.10.0 -PolicyName LabComputers -DnsServer 192.168.1.2 -WinsServer 192.168.1.3 -DnsDomain contoso.com -Router 192.168.1.1 -Wpad http://proxy.contoso.com/wpad.dat

EXAMPLE 5

This example sets the server-wide DHCPv4 option value for option ID 6, or DNS server.

PS C:\> Set-DhcpServerv4OptionValue -ComputerName dhcpserver.contoso.com -OptionId 6 -Value 192.168.1.1

EXAMPLE 6

This example sets the DHCPv4 option value for option ID 6, or DNS server, for the scope 10.10.10.0.

PS C:\> Set-DhcpServerv4OptionValue -ComputerName dhcpserver.contoso.com -ScopeId 10.10.10.0 -OptionId 6 -Value 192.168.1.1

EXAMPLE 7

This example sets the DHCPv4 option value for option ID 6, or DNS server, for the specified reservation.

PS C:\> Set-DhcpServerv4OptionValue -ComputerName dhcpserver.contoso.com -ReservedIP 10.10.10.5 -OptionId 6 -Value 192.168.1.1

EXAMPLE 8

This example sets the vendor-class-specific DHCPv4 option value for option ID 5 on the specified scope for the specified vendor class named MSUCClient.

PS C:\> Set-DhcpServerv4OptionValue -ComputerName dhcpserver.contoso.com -ScopeId 10.10.10.0 -VendorClass MSUCClient -OptionId 5 -Value 6874747073

EXAMPLE 9

This example sets the DHCPv4 option value for option ID 6, or DNS server, on the specified scope for the specified policy.

PS C:\> Set-DhcpServerv4OptionValue -ComputerName dhcpserver.contoso.com -ScopeId 10.10.10.0 -PolicyName PrinterPolicy -OptionId 6 -Value 192.168.1.10

EXAMPLE 10

This example sets the user-class-specific DHCPv4 option value for option ID 6, or DNS server, on the specified scope for the specified user class.

PS C:\> Set-DhcpServerv4OptionValue -ComputerName dhcpserver.contoso.com -ScopeId 10.10.10.0 -UserClass LabComputer -OptionId 6 -Value 192.168.1.10

Get-DhcpServerv4OptionValue

Remove-DhcpServerv4OptionValue