Created
March 26, 2021 12:37
-
-
Save weeyin83/7d045e6ddfd413a6adc20186a977069d to your computer and use it in GitHub Desktop.
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
#Declare script to be run on remote server | |
$scriptblock = {param($zones,$dns_ip1,$dns_srv2,$z,$dns_srv3) Add-DnsServerSecondaryZone -MasterServers $dns_ip1 -Name $z -ZoneFile $z".dns"} | |
#Collects Credentials to connect to the remote server | |
$username = Read-Host -Prompt "Enter the username for the account" | |
Read-host -Prompt "enter password" -assecurestring | convertfrom-securestring | out-file C:\cred.txt | |
$password = get-content C:\cred.txt | convertto-securestring $credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist "$username",$password | |
# This line of Powershell loops round using the inputs and creates the primary copy of the non-integrated DNS zones on the first server | |
#This stage creates the non integrated zones using the first server as the primary server | |
$zones | foreach-object {Add-DnsServerPrimaryZone -ComputerName $dns_srv1 -Name $_ -DynamicUpdate None -ZoneFile $_".dns"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment