Set-Dns Server Cache

Modifies cache settings for a DNS server.

Syntax

Set-DnsServerCache
   [-StoreEmptyAuthenticationResponse <Boolean>]
   [-MaxKBSize <UInt32>]
   [-PollutionProtection <Boolean>]
   [-ComputerName <String>]
   [-LockingPercent <UInt32>]
   [-MaxNegativeTtl <TimeSpan>]
   [-MaxTtl <TimeSpan>]
   [-PassThru]
   [-IgnorePolicies <Boolean>]
   [-CimSession <CimSession[]>]
   [-ThrottleLimit <Int32>]
   [-AsJob]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Set-DnsServerCache cmdlet modifies cache settings for a Domain Name System (DNS) server.

Examples

Example 1: Set the maximum cache size on a DNS server

PS C:\> Set-DnsServerCache -MaxKBSize 10240 -ComputerName "Win12S-05.DNSServer-01.Contoso.com"

This command sets the maximum cache size to 10,240 KB on a DNS server that has an FQDN of Win12S-05.DNSServer-01.Contoso.com.

Optional 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 a DNS server. The acceptable values for this parameter are: an IPv4 address, an IPv6 address, and any other value that resolves to an IP address, such as fully qualified domain name (FQDN), host name, or NETBIOS name.

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

Indicates whether to ignore policies for this cache.

Type: Boolean
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-LockingPercent

Specifies a percentage of the original Time to Live (TTL) value that caching can consume.

Cache locking is configured as a percent value. For example, if the cache locking value is set to 50, the DNS server does not overwrite a cached entry for half of the duration of the TTL. By default, the cache locking percent value is 100. This value means that the DNS server will not overwrite cached entries for the entire duration of the TTL.

Type: UInt32
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-MaxKBSize

Specifies the maximum size, in kilobytes, of the memory cache of a DNS server.

Type: UInt32
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-MaxNegativeTtl

Specifies how many seconds (0x1-0xFFFFFFFF) an entry that records a negative answer to a query remains stored in the DNS cache. The default setting is 0x384 (900) seconds

Type: TimeSpan
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-MaxTtl

Specifies how many seconds (0x0-0xFFFFFFFF) a record is saved in cache. If you use the 0x0 setting, the DNS server does not cache records. The default setting is 0x15180 (86,400 seconds, or one day).

Type: TimeSpan
Position: Named
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.

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

Specifies whether DNS filters name service (NS) resource records that are cached. Valid values are zero, which caches all responses to name queries and is the default value; and one, which caches only the records that belong to the same DNS subtree.

When you set this parameter value to False, cache pollution protection is disabled. A DNS server caches the Host (A) record and all queried NS resources that are in the DNS server zone. In this case, DNS can also cache the NS record of an unauthorized DNS server. This event causes name resolution to fail or to be appropriated for subsequent queries in the specified domain.

When you set the value for this parameter to True, the DNS server enables cache pollution protection and ignores the Host (A) record. The DNS server performs a cache update query to resolve the address of the NS if the NS is outside the zone of the DNS server. The additional query minimally affects DNS server performance.

For more information about DNS cache locking, see DNS Cache Locking . For more information about cache pollution protection, see Securing the DNS Server Service . For more information about NS resource records, see Managing resource records .

Type: Boolean
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-StoreEmptyAuthenticationResponse

Specifies whether a DNS server stores empty authoritative responses in the cache (RFC-2308). We recommend that you limit this value to either 0x00000000 or 0x00000001, but you can specify any value. The default value is 0x00000001. You must allow and treat literally the value zero.

Type: Boolean
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
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
-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

Inputs

Class DNSServerCache

{

uint32 MaxCacheTTL; // Maximum time, in seconds, that the record of a recursive name query can remain in the DNS server cache. The DNS server deletes records from the cache when the value of this entry expires, even if the value of the TTL field in the record is greater. The default value of this property is 86,400 seconds (one day).

uint32 MaxNegativeCacheTTL; // Maximum time, in seconds, that a name error result from a recursive query can remain in the DNS server cache. The DNS server deletes records from the cache when this timer expires, even if the TTL field is greater. Default value is 86,400 (one day).

boolean AutoCacheUpdate // Indicates whether the DNS Server attempts to update its cache entries by using data from root servers. When a DNS server starts, it needs a list of root server hints and Host A records for the server cache file. Microsoft DNS servers have a feature that enables them to attempt to write back a new cache file based on the responses from root servers.

Outputs

Microsoft.Management.Infrastructure.CimInstance#DnsServerCache