Set-DnsServer
Overwrites a DNS server configuration.
Set-DnsServer
[-InputObject] <CimInstance>
[-AsJob]
[-CimSession <CimSession[]>]
[-ComputerName <String>]
[-CreateFileBackedPrimaryZones]
[-Force]
[-PassThru]
[-ThrottleLimit <Int32>]
[-Confirm]
[-WhatIf]
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.
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.
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.
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.
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.
ps_cimcommon_asjob
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
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[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
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 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
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 |
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 |
Specifies the input to this cmdlet. You can use this parameter, or you can pipe the input to this cmdlet.
Type: | CimInstance |
Position: | 2 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
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 |
ps_cimcommon_asjob
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: | SwitchParameter |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |