diff --git a/scripts/ADDS/payload/scripts/09.DNS records.ps1 b/scripts/ADDS/payload/scripts/09.DNS records.ps1 index 0c46fc2..c332abb 100644 --- a/scripts/ADDS/payload/scripts/09.DNS records.ps1 +++ b/scripts/ADDS/payload/scripts/09.DNS records.ps1 @@ -7,7 +7,7 @@ Param( # Only executed on secondary or standalone Domain Controller If (@('secondary','standalone') -contains $Parameter['deployment.type']) { $GetContentSplat = @{ - Path = "$($PSScriptRoot)\$($MyInvocation.MyCommand)".Replace('.ps1', '.yml') + Path = "$($PSScriptRoot)\$($MyInvocation.MyCommand)".Replace('.ps1', ".$($Parameter['deployment.type']).yml") Raw = $True } $RawContent = Get-Content @GetContentSplat @@ -20,7 +20,7 @@ If (@('secondary','standalone') -contains $Parameter['deployment.type']) { # Check if the respective .yml file declared substitutions which need to be parsed If (($YamlDocuments.Count -gt 1) -and $YamlDocuments[-1].Variables) { ForEach ($Pattern in $YamlDocuments[-1].Variables) { - $RawContent = $RawContent -replace "\{\{ ($($Pattern.Name)) \}\}", [string](Invoke-Expression -Command $Pattern.Expression) + $RawContent = $RawContent -replace "\{\{ ($($Pattern.Name)) \}\}", [string](Invoke-Expression -Command $Pattern.Expression -ErrorAction 'SilentlyContinue') } # Perform conversion to Yaml again, now with parsed file contents $ConvertFromYamlSplat = @{ diff --git a/scripts/ADDS/payload/scripts/09.DNS records.yml b/scripts/ADDS/payload/scripts/09.DNS records.secondary.yml similarity index 100% rename from scripts/ADDS/payload/scripts/09.DNS records.yml rename to scripts/ADDS/payload/scripts/09.DNS records.secondary.yml diff --git a/scripts/ADDS/payload/scripts/09.DNS records.standalone.yml b/scripts/ADDS/payload/scripts/09.DNS records.standalone.yml new file mode 100644 index 0000000..d9c949f --- /dev/null +++ b/scripts/ADDS/payload/scripts/09.DNS records.standalone.yml @@ -0,0 +1,18 @@ +Entries: +- Name: ldap + Type: A + Value: "{{ primarydc }}" +- Name: timeserver + Type: A + Value: "{{ primarydc }}" +# - Name: mail +# Type: MX +# Value: mail.contoso.com:10 # Value should match pattern ':' +# - Name: voipserver +# Type: SRV +# Value: sip.contoso.com:0:0:5060 # Value should match pattern ':::' +--- +Variables: +- Name: primarydc + Expression: | + (Resolve-DnsName -Name $Parameter['addsconfig.domainname'] | Sort-Object)[0].IPAddress