Site icon TOSS

Set-DhcpServerv4OptionValue

powershell

Set-DhcpServerv4OptionValue is accessible with the help of DHCPServer module. To configure DHCPServer, go through this link.

Synopsis

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

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 Windows Server 2008 R2 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

Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete. The cmdlet immediately returns an object that represents the job and then displays the command prompt. You can continue to work in the session while the job completes. To manage the job, use the *-Job cmdlets. To get the job results, use the Receive-Job cmdlet. For more information about Windows PowerShell background jobs, see about_Jobs.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-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.

Type:CimSession[]
Aliases:Session
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-ComputerName

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

Type:String
Aliases:Cn
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

-DnsDomain

Specifies the value for the DNS domain option.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False

-DnsServer

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

Type:IPAddress[]
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False

-Force

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

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-OptionId

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

Type:UInt32
Position:1
Default value:None
Accept pipeline input:True
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.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-PolicyName

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

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False

-ReservedIP

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

Type:IPAddress
Aliases:IPAddress
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False

-Router

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

Type:IPAddress[]
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False

-ScopeId

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

Type:IPAddress
Position:3
Default value:None
Accept pipeline input:True
Accept wildcard characters:False

-ThrottleLimit

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.

Type:Int32
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-UserClass

Sets the option value for the specified user class.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False

-Value

Specifies one or more values to be set for the option. Use the following formats:

Type:String[]
Position:2
Default value:None
Accept pipeline input:True
Accept wildcard characters:False

-VendorClass

Sets the option value for the specified vendor class.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

-WinsServer

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

Type:IPAddress[]
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False

-Wpad

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

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False

Syntax

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

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

—————EXAMPLE 1—————
PS C:>Set-DhcpServerv4OptionValue -ComputerName dhcpsrv.TOSSolution.com -DnsServer 192.168.1.2 -WinsServer 192.168.1.3 -DnsDomain TOSSolution.com -Router 192.168.1.1 -Wpad http://proxy.TOSSolution.com/wpad.dat
This example sets the server level option values for DNS server, WINS server, DNS domain, router, and WPAD.

—————EXAMPLE 2—————
PS C:\>Set-DhcpServerv4OptionValue -ComputerName dhcpsrv.TOSSolution.com -ScopeId 10.10.10.0 -DnsServer 192.168.1.2 -WinsServer 192.168.1.3 -DnsDomain TOSSolution.com -Router 192.168.1.1 -Wpad http://proxy.TOSSolution.com/wpad.dat
This example sets the option values for DNS server, WINS server, DNS domain, router, and WPAD for scope 10.10.10.0.

—————EXAMPLE 3—————
PS C:\>Set-DhcpServerv4OptionValue -ComputerName dhcpsrv.TOSSolution.com -ReservedIP 10.10.10.5 -DnsServer 192.168.1.2 -WinsServer 192.168.1.3 -DnsDomain TOSSolution.com -Router 192.168.1.1 -Wpad http://proxy.TOSSolution.com/wpad.dat
This example sets the option values for DNS server, WINS server, DNS domain, router, and WPAD for reserved IP address 10.10.10.5.

—————EXAMPLE 4—————
PS C:\>Set-DhcpServerv4OptionValue -ComputerName dhcpsrv.TOSSolution.com -ScopeId 10.10.10.0 -PolicyName LabComputers -DnsServer 192.168.1.2 -WinsServer 192.168.1.3 -DnsDomain TOSSolution.com -Router 192.168.1.1 -Wpad http://proxy.TOSSolution.com/wpad.dat
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.

—————EXAMPLE 5—————
PS C:\>Set-DhcpServerv4OptionValue -ComputerName dhcpsrv.TOSSolution.com -OptionId 6 -Value 192.168.1.1
This example sets the server-wide DHCPv4 option value for option ID 6, or DNS server.

—————EXAMPLE 6—————
PS C:\>Set-DhcpServerv4OptionValue -ComputerName dhcpsrv.TOSSolution.com -ScopeId 10.10.10.0 -OptionId 6 -Value 192.168.1.1
This example sets the DHCPv4 option value for option ID 6, or DNS server, for the scope 10.10.10.0.

—————EXAMPLE 7—————
PS C:\>Set-DhcpServerv4OptionValue -ComputerName dhcpsrv.TOSSolution.com -ReservedIP 10.10.10.5 -OptionId 6 -Value 192.168.1.1
This example sets the DHCPv4 option value for option ID 6, or DNS server, for the specified reservation.

—————EXAMPLE 8—————
PS C:\>Set-DhcpServerv4OptionValue -ComputerName dhcpsrv.TOSSolution.com -ScopeId 10.10.10.0 -VendorClass MSUCClient -OptionId 5 -Value 6874747073
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.

—————EXAMPLE 9—————
PS C:\>Set-DhcpServerv4OptionValue -ComputerName dhcpsrv.TOSSolution.com -ScopeId 10.10.10.0 -PolicyName PrinterPolicy -OptionId 6 -Value 192.168.1.10
This example sets the DHCPv4 option value for option ID 6, or DNS server, on the specified scope for the specified policy.

—————EXAMPLE 10—————
PS C:\>Set-DhcpServerv4OptionValue -ComputerName dhcpsrv.TOSSolution.com -ScopeId 10.10.10.0 -UserClass LabComputer -OptionId 6 -Value 192.168.1.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.

You can check the Version, CommandType and Source of this cmdlet by giving below command.

Get-Command Set-DhcpServerv4OptionValue

You can also read about

To know more PowerShell cmdlets(Commands) on DHCPServer click here

Click on this Link for an Single place where you get all the PowerShell cmdlet sorted based on the modules.

You can also refer other blogs on PowerShell at link

You can also refer other blogs on Microsoft at link

And also if you required any technology you want to learn, let us know below we will publish them in our site http://tossolution.com/

Like our page in Facebook and follow us for New technical information.

References are taken from Microsoft

Exit mobile version