Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ?#Author: James Cruce https://astgl.com
- #Date: 07/25/18
- #Version: 1.0
- # Script assumes you are logged into an account with local Administrator rights for the remote servers
- # This will work for all Windows computers including both physical and virtual servers
- #Variables
- $servers = $null
- $NIC = $null
- $i = $null
- #This loads the contents of the text file into an array
- $servers = Get-Content "c:\Test\servers.txt"
- #This prompts for your admin credentials
- #$cred = Get-Credential
- #This section is a loop to apply the correct DNS settings
- foreach ($i in $servers)
- {$i + "`n" + "======================"; ($NIC = Get-WMIObject Win32_NetworkAdapterConfiguration -ComputerName $i | Where-Object{($_.IPEnabled) -eq 'TRUE'})
- $NewDNS = '192.168.10.250','192.168.0.250'
- $NIC.SetDNSServerSearchOrder($NewDNS)
- $NIC.SetDynamicDNSRegistration('TRUE')
- $NIC.SetDNSDomain('yourdomain.com'), $null
- $NIC.SetWINSServer('','')
- #Sets 'Append these DNS suffixes (in order)' setting
- $DNSSuffix = 'yourdomain.com','yourdomain.local'
- Invoke-WMIMethod -path Win32_NetworkAdapterConfiguration -Name SetDNSSuffixSearchOrder -ArgumentList @($DNSSuffix), $null
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement