Forked from OmerMicrosoft/Add-DnsServerConditionalForwarderZone.ps1
Last active
January 2, 2019 01:24
-
-
Save jhochwald/1007296f2099c2089683667b2309cdec to your computer and use it in GitHub Desktop.
Create a DNS Conditional Forwarder as an Active Directory Integrated Zone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function New-ADDnsServerConditionalForwarderZone | |
{ | |
<# | |
.SYNOPSIS | |
Create a DNS Conditional Forwarder as an Active Directory Integrated Zone | |
.DESCRIPTION | |
Create a DNS Conditional Forwarder as an Active Directory Integrated Zone | |
.PARAMETER Name | |
Specifies the name of a zone. The function adds a conditional forwarder for this zone. | |
.EXAMPLE | |
PS C:\> New-ADDnsServerConditionalForwarderZone -Name 'Value1' | |
.NOTES | |
Reworked and tweaked function by Omer (Microsoft Premier Field Engineer). | |
Basicaly it is a simple wrapper for the Add-DnsServerConditionalForwarderZone cmdlet. | |
.LINK | |
https://blogs.technet.microsoft.com/meamcs/2018/12/31/most-common-mistakes-in-active-directory-and-domain-services-part-1/ | |
.LINK | |
https://gist.github.com/OmerMicrosoft/4a5359df8f3c6991a8b02d99bcb8a2cf | |
#> | |
[CmdletBinding(ConfirmImpact = 'Low')] | |
[OutputType([psobject])] | |
param | |
( | |
[Parameter(Mandatory, | |
ValueFromPipeline, | |
ValueFromPipelineByPropertyName, | |
Position = 1, | |
HelpMessage = 'Specifies the name of a zone')] | |
[ValidateNotNullOrEmpty()] | |
[string] | |
$Name | |
) | |
begin | |
{ | |
# Cleanup | |
$ConditionalForwarderZone = $null | |
} | |
process | |
{ | |
$paramAddDnsServerConditionalForwarderZone = @{ | |
Name = $Name | |
ReplicationScope = 'Forest' | |
PassThru = $true | |
Confirm = $false | |
} | |
$ConditionalForwarderZone = (Add-DnsServerConditionalForwarderZone @paramAddDnsServerConditionalForwarderZone) | |
} | |
end | |
{ | |
# Dump the Object | |
$ConditionalForwarderZone | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reworked and tweaked function based on the function by @OmerMicrosoft (Microsoft Premier Field Engineer)
I like the basic idea, and the tweaks are just to keep the code consistent with my other stuff.