Set-DnsServerDiagnostics

Set-DnsServerDiagnostics

Sets debugging and logging parameters.

Syntax

Parameter Set: Parameters
Set-DnsServerDiagnostics [-Answers <Boolean> ] [-AsJob] [-CimSession <CimSession[]> ] [-ComputerName <String> ] [-EnableLogFileRollover <Boolean> ] [-EnableLoggingForLocalLookupEvent <Boolean> ] [-EnableLoggingForPluginDllEvent <Boolean> ] [-EnableLoggingForRecursiveLookupEvent <Boolean> ] [-EnableLoggingForRemoteServerEvent <Boolean> ] [-EnableLoggingForServerStartStopEvent <Boolean> ] [-EnableLoggingForTombstoneEvent <Boolean> ] [-EnableLoggingForZoneDataWriteEvent <Boolean> ] [-EnableLoggingForZoneLoadingEvent <Boolean> ] [-EnableLoggingToFile <Boolean> ] [-EventLogLevel <UInt32> ] [-FullPackets <Boolean> ] [-IPFilterList <IPAddress[]> ] [-LogFilePath <String> ] [-MaxMBFileSize <UInt32> ] [-Notifications <Boolean> ] [-PassThru] [-Queries <Boolean> ] [-QuestionTransactions <Boolean> ] [-ReceivePackets <Boolean> ] [-SaveLogsToPersistentStorage <Boolean> ] [-SendPackets <Boolean> ] [-TcpPackets <Boolean> ] [-ThrottleLimit <Int32> ] [-UdpPackets <Boolean> ] [-UnmatchedResponse <Boolean> ] [-Updates <Boolean> ] [-UseSystemEventLog <Boolean> ] [-WriteThrough <Boolean> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: All
Set-DnsServerDiagnostics -All <Boolean> [-AsJob] [-CimSession <CimSession[]> ] [-ComputerName <String> ] [-PassThru] [-ThrottleLimit <Int32> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: LogLevel
Set-DnsServerDiagnostics [-AsJob] [-CimSession <CimSession[]> ] [-ComputerName <String> ] [-DebugLogging <UInt32> ] [-OperationLogLevel1 <UInt32> ] [-OperationLogLevel2 <UInt32> ] [-PassThru] [-ThrottleLimit <Int32> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Set-DnsServerDiagnostics cmdlet sets debugging and logging parameters on a Domain Name System (DNS) server.

If you enable debug logging (set the FullPackets parameter to $True), you must satisfy the following conditions:

1. Set the ReceivePackets parameter or the SendPackets parameter to $True., and:

2. Set the TcpPackets parameter or the UdpPackets parameter to $True, and:

3. Set the Notifications parameter, the Queries parameter, or the Updates parameter to $True, and:

4. Set the QuestionTransactions parameter or the Answers parameter to $True.

If you use the first parameter set, you must specify at least one of the options in each of the following entries:

1. ReceivePackets, SendPackets

2. TcpPackets, UdpPackets

3. Notifications, Updates, Queries

4. QuestionTransactions, Answers

The All parameter set enables all options except for the following: LogFilePath, MaxMBFileSize, EventLogLevel, FilterIpAddrList, UseSystemEventLog, and EnableLogFileRollover.

Use the third parameter to enable diagnostics at a more detailed level.

Parameters

-All<Boolean>

Controls whether the DNS server logs all events.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Answers<Boolean>

Enables the logging of DNS responses when you set the value to $True.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-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 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), Hostname, or NETBIOS name.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DebugLogging<UInt32>

Specifies the bitmask for debug logging. Valid values are:

0x00000001. The server logs query packet exchanges.

0x00000010. The server logs packet exchanges that are related to zone exchanges.

0x00000020. The server logs packet exchanges that are related to zone updates.

0x0000010.: The server logs packets that contain questions.

0x00000200. The server logs packets that contain answers.

0x00001000. The server logs packets that it sends.

0x00002000. The server logs packets that it receives.

0x00004000. The server logs User Datagram Protocol (UDP) packet exchanges.

0x00008000. The server logs Transmission Control Protocol (TCP) packet exchanges.

0x0000FFFF. The server logs operations if you set the following fields to $True: 0x00001000, 0x00002000, 0x00008000, 0x00004000, 0x00000001, 0x00000001, 0x00000020, 0x00000100, and 0x00000200S.

0x00010000. Independent of other field values, this bitmap logs Active Directory write operations.

0x00020000. Independent of other field values, this bitmap logs Active Directory polling operations and operations that occur during DNS updates (secure and not secure) on Active Directory-integrated zones.

0x01000000. If other field values allow it, the server logs the entire packet to the log file.

0x02000000. If other field values allow it, the server logs response packets that do not match any outstanding queries.

0x80000000. If other field values allow it, the server saves packet logging information to persistent storage.

Aliases

none

Required?

false

Position?

named

Default Value

0xFFFFFFFF

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-EnableLogFileRollover<Boolean>

Sets a bit flag to enable log file rollover.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-EnableLoggingForLocalLookupEvent<Boolean>

Controls whether the DNS server logs local lookup events.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-EnableLoggingForPluginDllEvent<Boolean>

Controls whether the DNS server logs dynamic link library (DLL) plug-in events.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-EnableLoggingForRecursiveLookupEvent<Boolean>

Controls whether the DNS server logs recursive lookup events.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-EnableLoggingForRemoteServerEvent<Boolean>

Controls whether the DNS server logs remote server events.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-EnableLoggingForServerStartStopEvent<Boolean>

Controls whether the DNS server logs server start and stop events.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-EnableLoggingForTombstoneEvent<Boolean>

Controls whether the DNS server logs tombstone events.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-EnableLoggingForZoneDataWriteEvent<Boolean>

Controls whether the DNS server logs zone data write events.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-EnableLoggingForZoneLoadingEvent<Boolean>

Controls whether the DNS server logs zone load events.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-EnableLoggingToFile<Boolean>

Controls whether the DNS server logs logging-to-file.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-EventLogLevel<UInt32>

Specifies an event log level. Valid values are Warning, Error, and None.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-FullPackets<Boolean>

Controls whether the DNS server logs full packets.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-IPFilterList<IPAddress[]>

Specifies an array of IP addresses to filter. When you enable logging, traffic to and from these IP addresses is logged. If you do not specify any IP addresses, traffic to and from all IP addresses is logged.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-LogFilePath<String>

Specifies a log file path.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-MaxMBFileSize<UInt32>

Specifies the maximum size of the log file. This parameter is relevant if you set EnableLogFileRollover and EnableLoggingToFile to $True.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Notifications<Boolean>

Controls whether the DNS server logs notifications.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-OperationLogLevel1<UInt32>

Sets a bit flag for the logging level. Valid values are:

0x00000001. The DNS server saves operational logging information to persistent storage.

0x00000010: The DNS server logs event logging information to a log file.

0x00000020: The DNS server logs operational logging information for server start and stop activities to the log file.

0x00002000: The DNS server logs operational logging information for activities that are related to loading a zone from a directory server to the log file.

0x00004000. The DNS server logs operational logging information for activities that are related to writing zone data to the directory server to the log file.

0x00020000. The DNS server logs operational logging information for activities that are related to updating nodes that have exceeded the tombstone lifetime to the log file.

0x00100000: The DNS server logs operational logging information for local resource lookup activities to the log file.

0x00200000. The DNS server logs operational logging information for activities that occur during recursive query lookup to the log file.

0x00400000. The DNS server logs operational logging information for activities that are related to interaction with remote name servers to the log file.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-OperationLogLevel2<UInt32>

Specifies the additional operations that the DNS server logs. The default valid value is:

0x01000000. Valid values for this parameter are: 0x01, 0x02, and 0x03.The DNS server logs operational logging information for activities that are related to interaction with plug-in DLLs to the log file.

Aliases

none

Required?

false

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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Queries<Boolean>

Controls whether the DNS server allows query packet exchanges to pass through the content filter, such as the IPFilterList parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-QuestionTransactions<Boolean>

Controls whether the DNS server logs queries.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-ReceivePackets<Boolean>

Controls whether the DNS server logs receive packets.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-SaveLogsToPersistentStorage<Boolean>

Controls whether the DNS server saves logs to persistent storage.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-SendPackets<Boolean>

Controls whether the DNS server logs send packets.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-TcpPackets<Boolean>

Controls whether the DNS server logs TCP packets.

Aliases

none

Required?

false

Position?

named

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

-UdpPackets<Boolean>

Controls whether the DNS server logs UDP packets.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-UnmatchedResponse<Boolean>

Controls whether the DNS server logs unmatched responses.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Updates<Boolean>

Controls whether the DNS server logs updates.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-UseSystemEventLog<Boolean>

Controls whether the DNS server uses the system event log for logging.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-WriteThrough<Boolean>

Controls whether the DNS server logs write-throughs.

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.

Outputs

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

  • Microsoft.Management.Infrastructure.CimInstance#DnsServerDiagnostics

Notes

  • 0x0. The DNS server does not create a log. This is the default entry.

    0x10. Logs queries.

    0x10. Logs notifications.

    0x20. Logs updates.

    0xFE. Logs non-queries.

    0x100. Logs question transactions.

    0x200. Logs answers.

    0x1000. Logs send packets.

    0x2000. Logs receive packets.

    0x4000. Logs UDP packets.

    0x8000. Logs TCP packets.

    0xFFFF. Logs all packets.

    0x10000. Logs Active Directory write transactions.

    0x20000. Logs Active Directory update transactions.

    0x1000000. Logs full packets.

    0x80000000. Logs write-through transactions.

Examples

Example 1: Enable diagnostics for outgoing TCP responses for updates

This command enables the diagnostics of outgoing TCP responses for updates.

PS C:\> Set-DnsServerDiagnostics -SendPackets $true -TcpPackets $true -Answers $true -Updates $true

Example 2: Enable all diagnostic options except for LogFilePath

This command enables all options for DNS server diagnostics except for LogFilePath.

PS C:\> Set-DnsServerDiagnostics -All $true

Example 3: Log send packets

This command logs send packages.

PS C:\> Set-DnsServerDiagnostics -DebugLogging 0x10000

Example 4: Reset debugging settings

This command resets the TCP packet debugging and UDP packet debugging options on DNSServer02 to their values on DNSServer01.

PS C:\> Get-DnsServerDiagnostics -ComputerName "DNSServer01" | select -TcpPackets, -UdpPackets | Set-DnsServerDiagnostics -ComputerName "DNSServer02"

Get-DnsServerDiagnostics