COMMAND EVERYTHING.
Adds a policy for query resolution to a DNS server.
Microsoft DnsServer reference: Adds a policy for query resolution to a DNS server. The syntax and selected example below are adapted from the pinned Windows Server 2025 reference. Module availability, target configuration and delegated permissions determine whether it can run in your environment. Documentation and parameter text: Microsoft, CC BY 4.0; formatting adapted by Cmdlet World. No execution testing is claimed.
Use an account with the target resource permissions documented for Add-DnsServerQueryResolutionPolicy. Modifying administrative cmdlets may require elevation or delegated administration. This catalog does not assert that ordinary users can execute the command.
Windows / DnsServer · Windows Server 2025 documentation; feature/module prerequisites apply
-Action- Specifies the action to take if a query matches this policy. The acceptable values for this parameter are: - ALLOW. - DENY. Respond with SERV_FAIL. - IGNORE. Do not respond.
-ApplyOnRecursion- Indicates that this policy is a server level recursion policy. Recursion policies are special class of server level policies that control how the DNS server performs recursion for a query. Recursion policies apply only when query processing reaches the recursion path.
-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.
-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.
-ClientSubnet- Specifies the client subnet criterion. This is a client subnet from which the query was sent. For more information, see Add-DnsServerClientSubnet. Specify a criterion in the following format: operator, value01, value02, . . . ; operator, value03, value04, . . . The operator is either EQ or NE. You can specify no more than one of each operator in a criterion. The policy treats values that follow the EQ operator as multiple assertions which are logically combined (OR'd). The policy treats values that follow the NE operator as multiple assertions which are logically differenced (AND'd). The criterion is satisfied if the subnet of the request matches one of the EQ values and does not match any of the NE values. Example criterion: "EQ,NorthAmerica,Asia,NE,Europe"
-ComputerName- Specifies a remote DNS server. You can specify an IP address or any value that resolves to an IP address, such as an FQDN, host name, or NETBIOS name.
-Condition- Specifies how the policy treats multiple criteria. The acceptable values for this parameter are: - OR. The policy evaluates criteria as multiple assertions which are logically combined (OR'd). - AND. The policy evaluates criteria as multiple assertions which are logically differenced (AND'd). The default value is AND.
-Confirm- Prompts you for confirmation before running the cmdlet.
-Disable- Indicates that this cmdlet disables the policy. If you do not specify this parameter, the cmdlet creates the policy and enables it.
-ECS- This parameter is reserved for internal use.
-Fqdn- Specifies the FQDN criterion. This is the FQDN of record in the query. Specify a criterion in the following format: operator, value01, value02, . . . ; operator, value03, value04, . . . The operator is either EQ or NE. You can specify no more than one of each operator a criterion. The policy treats values that follow the EQ operator as multiple assertions which are logically combined (OR'd). The policy treats values that follow the NE operator as multiple assertions which are logically differenced (AND'd). The criterion is satisfied if the FQDN of the request matches one of the EQ values and does not match any of the NE values. You can include the asterisk (*) as the wildcard character. For example, EQ,*.contoso.com,NE,*.fabrikam.com.
-InputObject (required)- Specifies the input to this cmdlet. You can use this parameter, or you can pipe the input to this cmdlet.
-InternetProtocol- Specifies the Internet Protocol criterion. This is the IP version of the query. Valid values are: IPv4 and IPv6. Specify a criterion in the following format: operator, value01, value02, . . . ; operator, value03, value04, . . . The operator is either EQ or NE. You can specify no more than one of each operator in a criterion. The policy treats values that follow the EQ operator as multiple assertions which are logically combined (OR'd). The policy treats values that follow the NE operator as multiple assertions which are logically differenced (AND'd). The criterion is satisfied if the IP address of the request matches one of the EQ values and does not match any of the NE values. Example criteria: "EQ,IPv4" and "EQ,IPv6"
-Name (required)- Specifies a name for the new policy.
-PassThru- Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.
-ProcessingOrder- Specifies the precedence of the policy. Higher integer values have lower precedence. By default, this cmdlet adds a new policy as the lowest precedence.
-QType- Specifies the query type criterion. This is the type of record that is being queried. Specify a criterion in the following format: operator, value01, value02, . . . ; operator, value03, value04, . . . The operator is either EQ or NE. You can specify no more than one of each operator in a criterion. The policy treats values the follow the EQ operator as multiple assertions which are logically combined (OR'd). The policy treats values that follow the NE operator as multiple assertions which are logically differenced (AND'd). The criterion is satisfied if the type of query of the request matches one of the EQ values and does not match any of the NE values. Example criterion: "EQ,TXT,SRV;NE,MX"
-RecursionScope- Specifies the scope of recursion. If the policy is a recursion policy, and if a query matches it, the DNS server uses settings from this scope to perform recursion for the query.
-ServerInterfaceIP- Specifies the IP address of the server interface on which the DNS server listens. Specify a criterion in the following format: operator, value01, value02, . . . ; operator, value03, value04, . . . The operator is either EQ or NE. You can specify no more than one of each operator in the criterion. The policy treats values the follow the EQ operator as multiple assertions which are logically combined (OR'd). The policy treats values that follow the NE operator as multiple assertions which are logically differenced (AND'd). The criterion is satisfied if the IP address of the interface matches one of the EQ values and does not match any of the NE values. Example criteria: "EQ,10.0.0.1" and "NE,192.168.1.1"
-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.
-TimeOfDay- Specifies the time of day criterion. This is when the server receives the query. Specify a criterion in the following format: operator, value01, value02, . . . ; operator, value03, value04, . . . The operator is either EQ or NE. You can specify no more than one of each operator in the criterion. The policy treats values the follow the EQ operator as multiple assertions which are logically combined (OR'd). The policy treats values that follow the NE operator as multiple assertions which are logically differenced (AND'd). The criterion is satisfied if the time of day of the request matches one of the EQ values and does not match any of the NE values. Example criterion: "EQ,10:00-12:00,22:00-23:00"
-TransportProtocol- Specifies the transport protocol criterion. This is the transport protocol of the query. Valid values are: TCP and UDP. Specify a criterion in the following format: operator, value01, value02, . . . ; operator, value03, value04, . . . The operator is either EQ or NE. You can specify no more than one of each operator in the string. The policy treats values the follow the EQ operator as multiple assertions which are logically combined (OR'd). The policy treats values that follow the NE operator as multiple assertions which are logically differenced (AND'd). The criterion is satisfied if the transport protocol of the request matches one of the EQ values and does not match any of the NE values. Example criteria: "EQ,TCP" and "NE,UDP"
-WhatIf- Shows what would happen if the cmdlet runs. The cmdlet is not run.
-ZoneName (required)- Specifies the name of a DNS zone on which this cmdlet creates a zone level policy. The zone must exist on the DNS server.
-ZoneScope- Specifies a list of scopes and weights for the zone. Specify the value as a string in this format: Scope01, Weight01; Scope02, Weight02;
Windows with the DnsServer module and the Windows feature or management tools that provide it. Confirm target connectivity and version compatibility using the linked Microsoft reference.
This cmdlet changes system state. Review every target and parameter in the official reference, test outside production, and prepare an appropriate backup or rollback. Do not execute the example automatically.