I am running a script to set DNS to connect to our domain, but once it connects I need DNS to go back to automatic, is there a way to automate this with KACE?
I am currently running 2 post installation tasks on my one of my images. We use KACE to image both school and town side, which are different domains. To connect to the town side, I need to hard code DNS into the system then connect to it. I have found a script that allows me to set DNS, and then join the domain. However, I need to switch the DNS back to automatic after it has been added to the domain, is there a way to do this? Is there a way to have the system go back and click the automatic radio button in iPv4 properties? I am still new and learning how to use all of this effectively, thanks for any feed back you can provide.
Answers (2)
Down there is a Powershell Script designed to switch back the DNS to automatic.
https://devblogs.microsoft.com/scripting/weekend-scripter-modify-dns-settings-via-windows-powershell/
The problem is you are going to need to know the name of the network adapter you want to modify.
The KACE SDA is able to run Powershell scripts as post install tasks.
I will add it here in case that page goes down someday, but all credits to them
This script will set the DNS setting to automatic for the network adapter. If you want... after running the command, run Get-DnsClientServerAddress to confirm the change to the DNS servers. When the DNS setting is set to automatic, the ServerAddress column is blank for the adapter.
Set-DnsClientServerAddress -InterfaceAlias wi-fi -ResetServerAddresses