Jump to content
Sign in to follow this  

Help! Change Server DNS

Recommended Posts


Hello everyone,

I am very new to AutoIt. And having some problems... All I need is to have a script to change DNS server settings on 150 servers.

here is a little script that I wrote, but getting an error:

Const INPUT_FILE_NAME = "C:\Scripts\Servers.txt"


Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.OpenTextFile(INPUT_FILE_NAME, FOR_READING)

strServers = objFile.ReadAll


arrComputers = Split(strServers, vbCrLf)

For Each strServer In arrComputers

On Error Resume Next

Set objWMIService = GetObject("winmgmts:" _

& "{impersonationLevel=impersonate}!\\" & strServer & "\root\cimv2")

Set colNetCards = objWMIService.ExecQuery _

("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled =


For Each objNetCard in colNetCards

arrDNSServers = Array("x.x.x.x", "x.x.x.x")


Exit For



Share this post

Link to post
Share on other sites

Start by reading the help file so you can have understanding of the syntax. It's pretty close to Visual Basic syntax so you'll get it very fast. For example, variables or constants names are followed by a dollar sign '$' like $Var, or for example, CreateObject's AutoIt counterpart is ObjCreate...

Good-luck ;]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this