Table of Contents
Parameters
| Parameter | Attribute | DataType | Description | Allowed Values |
|---|---|---|---|---|
| IPv4Address | Key | System.String | Specifies the IPv4 address of a host. (Key Parameter) | |
| Name | Key | System.String | Specifies the name of a DNS server resource record object. (Key Parameter) | |
| ZoneName | Key | System.String | Specifies the name of a DNS zone. (Key Parameter) | |
| DnsServer | Write | System.String | The host name of the Domain Name System (DNS) server, or use 'localhost' for the current node. Defaults to 'localhost'. |
|
| Ensure | Write | Ensure | Whether the host record should be present or removed. | Present, Absent |
| TimeToLive | Write | System.String | Specifies the TimeToLive value of the SRV record. Value must be in valid TimeSpan string format (i.e.: Days.Hours:Minutes:Seconds.Miliseconds or 30.23:59:59.999). |
Description
The DnsRecordA DSC resource manages A DNS records against a specific zone on a Domain Name System (DNS) server.
Examples
Example 1
This configuration will ensure a DNS A record exists when only the mandatory properties are specified.
Configuration DnsRecordA_Mandatory_config
{
Import-DscResource -ModuleName 'DnsServerDsc'
Node localhost
{
DnsRecordA 'TestRecord'
{
ZoneName = 'contoso.com'
Name = 'www'
IPv4Address = '192.168.50.10'
Ensure = 'Present'
}
}
}
Example 2
This configuration will ensure a DNS A record exists when all properties are specified.
Configuration DnsRecordA_Full_config
{
Import-DscResource -ModuleName 'DnsServerDsc'
Node localhost
{
DnsRecordA 'TestRecord'
{
ZoneName = 'contoso.com'
Name = 'www'
IPv4Address = '192.168.50.10'
TimeToLive = '01:00:00'
DnsServer = 'localhost'
Ensure = 'Present'
}
}
}
Example 3
This configuration will ensure a DNS A record does not exist when mandatory properties are specified.
Note that not all mandatory properties are necessarily key properties. Non-key property values will be ignored when determining whether the record is to be removed.
Configuration DnsRecordA_Remove_config
{
Import-DscResource -ModuleName 'DnsServerDsc'
Node localhost
{
DnsRecordA 'TestRecord'
{
ZoneName = 'contoso.com'
Name = 'www'
IPv4Address = '192.168.50.10'
Ensure = 'Absent'
}
}
}
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Home
Resources
- DnsRecordA
- DnsRecordAaaa
- DnsRecordAaaaScoped
- DnsRecordAScoped
- DnsRecordCname
- DnsRecordCnameScoped
- DnsRecordMx
- DnsRecordMxScoped
- DnsRecordNs
- DnsRecordNsScoped
- DnsRecordPtr
- DnsRecordSrv
- DnsRecordSrvScoped
- DnsRecordTxt
- DnsRecordTxtScoped
- DnsServerADZone
- DnsServerCache
- DnsServerClientSubnet
- DnsServerConditionalForwarder
- DnsServerDiagnostics
- DnsServerDsSetting
- DnsServerEDns
- DnsServerForwarder
- DnsServerPrimaryZone
- DnsServerRecursion
- DnsServerRootHint
- DnsServerScavenging
- DnsServerSecondaryZone
- DnsServerSetting
- DnsServerSettingLegacy
- DnsServerZoneAging
- DnsServerZoneScope
- DnsServerZoneTransfer
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.