編集

次の方法で共有


Set-DnsServer

Overwrites a DNS server configuration.

Syntax

Set-DnsServer
   [-InputObject] <CimInstance>
   [-ComputerName <String>]
   [-Force]
   [-CreateFileBackedPrimaryZones]
   [-PassThru]
   [-CimSession <CimSession[]>]
   [-ThrottleLimit <Int32>]
   [-AsJob]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Set-DnsServer cmdlet uses an input object to overwrite a specified Domain Name System (DNS) server configuration. You can generate the input object by using an XML file that is exported by using any of the following cmdlets: Get-DnsServer, Export-Clixml, or Import-Clixml.

For more information about Export-Clixml, see Export-Clixmlhttp://technet.microsoft.com/en-us/library/hh849916.aspx. For more information about Import-Clixml, see Import-Clixmlhttp://technet.microsoft.com/en-us/library/hh849906.aspx.

Examples

Example 1: Overwrite a DNS server configuration by using an input object

PS C:\>Get-DnsServer -ComputerName "DNSServer13.Contoso.com" | Export-Clixml -Path "c:\DnsServerConfig.xml"
PS C:\>$x = Import-Clixml "c:\DnsServerConfig.xml"
PS C:\>Set-DnsServer -InputObject $x -ComputerName "DNSServer22.Contoso.com"

This set of commands uses an input object to overwrite a DNS server configuration.

As shown in the code block, the first command gets DNS server configuration by using the Get-DnsServer cmdlet. It then pipes the information to the Export-Clixml cmdlet, which exports the data into an XML file.

The second command gets and stores the XML file data in variable $x.

The third command uses the data that is stored in variable $x to overwrite an existing DNS server configuration.

Example 2: Set DNS server configuration by using the Cimsession parameter

PS C:\>Get-DnsServer -CimSession 172.22.50.137 | Set-DnsServer

This command gets DNS server configuration from a server that has an IP address of 172.22.50.137 and applies it to the server on which the Set-DnsServer cmdlet is run.

Example 3: Migrate DNS server configuration by using IP addresses

PS C:\>Get-DnsServer -CimSession 172.22.50.137 | Set-DnsServer -ComputerName 172.22.50.138

This command migrates DNS server configuration from a server that has an IP address of 172.22.50.137 to a server that has an IP address of 172.22.50.138.

Example 4: Create a file-backed primary zone

PS C:\>Get-DnsServer -CimSession 172.22.50.137 | Set-DnsServer -CreateFileBackedPrimaryZones

This command creates file-backed primary zones on the specified local DNS server. The file that contains resource records must exist in the %windir%\system32\dns directory.

Parameters

-AsJob

ps_cimcommon_asjob

Type:SwitchParameter
Position:Named
Default value:None
Required:False
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-CimSessionhttp://go.microsoft.com/fwlink/p/?LinkId=227967 or Get-CimSessionhttp://go.microsoft.com/fwlink/p/?LinkId=227966 cmdlet. The default is the current session on the local computer.

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

-ComputerName

Specifies a DNS server. The acceptable values for this parameter are: an IP v4 address; an IP v6 address; any other value that resolves to an IP address, such as a fully qualified domain name (FQDN), host name, or NETBIOS name.

Type:String
Aliases:Cn
Position:Named
Default value:None
Required:False
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-CreateFileBackedPrimaryZones

Indicates that you must create new file-backed primary zones in the input object. The files that contains the resource records must exist in the %windir%\system32\dns directory.

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

-Force

Overrides the default confirmation setting before the cmdlet performs the action.

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

-InputObject

Specifies the input to this cmdlet. You can use this parameter, or you can pipe the input to this cmdlet.

Type:CimInstance
Position:1
Default value:None
Required:True
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ThrottleLimit

ps_cimcommon_asjob

Type:Int32
Position:Named
Default value:None
Required:False
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

CimInstance