Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jhochwald/1007296f2099c2089683667b2309cdec to your computer and use it in GitHub Desktop.
Save jhochwald/1007296f2099c2089683667b2309cdec to your computer and use it in GitHub Desktop.
Create a DNS Conditional Forwarder as an Active Directory Integrated Zone
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
}
}
@jhochwald
Copy link
Author

jhochwald commented Jan 2, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment