Set-DnsServerDiagnostics

Sets debugging and logging parameters.

Syntax

Parameters (Default)

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

LogLevel

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

All

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

Description

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

To enable debug logging, specify a value of $True for the FullPackets parameter and do the following:

  • Set the ReceivePackets parameter or the SendPackets parameter to $True.
  • Set the TcpPackets parameter or the UdpPackets parameter to $True.
  • Set the Notifications parameter, the Queries parameter, or the Updates parameter to $True.
  • Set the QuestionTransactions parameter or the Answers parameter to $True.

If you use the Parameters parameter set, you must specify at least one of the options in each of the following pairs of parameters:

  • ReceivePackets, SendPackets
  • TcpPackets, UdpPackets
  • Notifications, Updates, Queries
  • QuestionTransactions, Answers

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

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

Examples

Example 1: Enable diagnostics for outgoing TCP responses for updates

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

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

Example 2: Enable all diagnostic options except for LogFilePath

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

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

Example 3: Log send packets

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

This command logs send packages.

Example 4: Reset debugging settings

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

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

Parameters

-All

Specifies whether the DNS server logs all events.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

All
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Answers

Specifies whether to enable the logging of DNS responses.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:

CimSession[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:Session

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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), Hostname, or NETBIOS name.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Cn

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DebugLogging

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.
  • 0x00000100. 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.

Parameter properties

Type:UInt32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

LogLevel
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-EnableLogFileRollover

Specifies whether to enable log file rollover.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-EnableLoggingForLocalLookupEvent

Specifies whether the DNS server logs local lookup events.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-EnableLoggingForPluginDllEvent

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

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-EnableLoggingForRecursiveLookupEvent

Specifies whether the DNS server logs recursive lookup events.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-EnableLoggingForRemoteServerEvent

Specifies whether the DNS server logs remote server events.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-EnableLoggingForServerStartStopEvent

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

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-EnableLoggingForTombstoneEvent

Specifies whether the DNS server logs tombstone events.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-EnableLoggingForZoneDataWriteEvent

Specifies Controls whether the DNS server logs zone data write events.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-EnableLoggingForZoneLoadingEvent

Specifies whether the DNS server logs zone load events.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-EnableLoggingToFile

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

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-EventLogLevel

Specifies an event log level. Valid values are:

  • 0: No Events
  • 1: Errors Only
  • 2: Errors and warnings
  • 3-7: All Events

Parameter properties

Type:UInt32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-FullPackets

Specifies whether the DNS server logs full packets.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-IPFilterList

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.

Parameter properties

Type:

IPAddress[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:FilterIPAddressList

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-LogFilePath

Specifies a log file path.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-MaxMBFileSize

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

Parameter properties

Type:UInt32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Notifications

Specifies whether the DNS server logs notifications.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-OperationLogLevel1

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

Parameter properties

Type:UInt32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

LogLevel
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-OperationLogLevel2

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.

Parameter properties

Type:UInt32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

LogLevel
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-PassThru

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Queries

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

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-QuestionTransactions

Specifies whether the DNS server logs queries.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ReceivePackets

Specifies whether the DNS server logs receive packets.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-SaveLogsToPersistentStorage

Specifies whether the DNS server saves logs to persistent storage.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-SendPackets

Specifies whether the DNS server logs send packets.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-TcpPackets

Specifies whether the DNS server logs TCP packets.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-UdpPackets

Specifies whether the DNS server logs UDP packets.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-UnmatchedResponse

Specifies whether the DNS server logs unmatched responses.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Updates

Specifies whether the DNS server logs updates.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-UseSystemEventLog

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

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WriteThrough

Specifies whether the DNS server logs write-throughs.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Parameters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

CimInstance