I'm certain this can be done Tom...I'm in a hurry at the moment so I can't do the research...but you may want to use your favorite search engine (for instance, MSN Search) and look for the following:
"text file" input and vbs That may give you enough to go on and find what you wish to do. I'm 100% certain this can work though as I've done it before. I just don't have that script handy at the moment (reference 'the hurry'). If you can't find it, please repost (or reply to me) and I'll find something. Look and Ye shall find!! Robert Williams, MCSE NT4/2K/2K3, Security+ Infrastructure Rapid Response Engineer Northeast Region Microsoft Corporation Global Solutions Support Center -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tom Kern Sent: Saturday, August 13, 2005 7:41 PM To: [email protected] Subject: Re: [ActiveDir] ok, last one really what I really want to do, is modify that script to read all my servers with static ip's from a text file and change their dns ip's to point to 2 new dns servers and get rid of the old ones. we have about 500 servers and they all have static ip's and we're changing over our dns to 2 new servers. i'd like to script pointing them to the new servers. either remotely or from a login script. the script i sent will do that but you have to enter the server names/ip's in the script and it prints info to stdout. i'd rather it read from a text file and only log errors or info to a seperate file. is this doable? thanks a lot! On 8/12/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > How about > > While ts.AtEndOfStream > strcomputer=ts.readline > wend > ts.close > > James R. Day > Active Directory Core Team > Office of the Chief Information Officer > National Park Service > 202-230-2983 > [EMAIL PROTECTED] > > > |---------+----------------------------------> > | | Tom Kern | > | | <[EMAIL PROTECTED]> | > | | Sent by: | > | | [EMAIL PROTECTED]| > | | tivedir.org | > | | | > | | | > | | 08/12/2005 04:32 PM AST| > | | Please respond to | > | | ActiveDir | > |---------+----------------------------------> > >----------------------------------------------------------------------- -------------------------------------------------------| > | | > | To: [email protected] | > | cc: (bcc: James Day/Contractor/NPS) | > | Subject: Re: [ActiveDir] ok, last one really | > >----------------------------------------------------------------------- -------------------------------------------------------| > > > > > how would you write that to loop thru every line in a file? > > thanks > > On 8/12/05, Alain Lissoir <[EMAIL PROTECTED]> wrote: > > On MSDN, you can find some sample scripts to read from a file. > > See at > > > http://msdn.microsoft.com/library/en-us/script56/html/sgWorkingWithFiles .asp > > > > > For instance, > > > > Dim fso, ts > > Const ForReading = 1 > > Set fso = CreateObject("Scripting. FileSystemObject") > > Set ts = fso.OpenTextFile("c:\test.txt", ForReading, True) > > strComputer = ts.ReadLine() > > ts.Close() > > > > Depending on the format of your file, you can read a single line and > split > > the comma separated computer names or > > You can loop and read lines one-by-one if you have a computer name per > line. > > Your call ... > > > > For a book on scripting and WMI, you can always have a look at my web > site > > ;) http://www.lissware.net > > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of Tom Kern > > Sent: Friday, August 12, 2005 7:46 AM > > To: activedirectory > > Subject: [ActiveDir] ok, last one really > > > > How can i change this script so i can just feed it a file of computer > names > > so i can automate the changing of dns servers in the client properties? > > > > SCRIPT- > > > > On Error Resume Next > > > > strComputer = "." > > arrNewDNSServerSearchOrder = Array("192.168.0.1", "192.168.0.2") > > > > Set objWMIService = GetObject("winmgmts:" _ & > > "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set > > colNicConfigs = objWMIService.ExecQuery _ ("SELECT * FROM > > Win32_NetworkAdapterConfiguration WHERE IPEnabled = True") > > > > WScript.Echo VbCrLf & "Computer: " & strComputer > > > > For Each objNicConfig In colNicConfigs > > WScript.Echo VbCrLf & " Network Adapter " & objNicConfig.Index > > WScript.Echo " DNS Server Search Order - Before:" > > If Not IsNull(objNicConfig.DNSServerSearchOrder) Then > > For Each strDNSServer In objNicConfig.DNSServerSearchOrder > > WScript.Echo " " & strDNSServer > > Next > > End If > > intSetDNSServers = _ > > objNicConfig.SetDNSServerSearchOrder(arrNewDNSServerSearchOrder) > > If intSetDNSServers = 0 Then > > WScript.Echo " Replaced DNS server search order list." > > Else > > WScript.Echo " Unable to replace DNS server search order list." > > End If > > Next > > > > WScript.Echo VbCrLf & String(80, "-") > > > > Set colNicConfigs = objWMIService.ExecQuery _ ("SELECT * FROM > > Win32_NetworkAdapterConfiguration WHERE IPEnabled = True") > > > > For Each objNicConfig In colNicConfigs > > WScript.Echo VbCrLf & " Network Adapter " & objNicConfig.Index > > WScript.Echo " DNS Server Search Order - After:" > > If Not IsNull(objNicConfig.DNSServerSearchOrder) Then > > For Each strDNSServer In objNicConfig.DNSServerSearchOrder > > WScript.Echo " " & strDNSServer > > Next > > End If > > Next > > > > END OF SCRIPT > > > > > > also, can anyone recommend a good VBscript book for Windows admining so i > > can leave you guys alone? > > > > thanks > > List info : http://www.activedir.org/List.aspx > > List FAQ : http://www.activedir.org/ListFAQ.aspx > > List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/ > > > > List info : http://www.activedir.org/List.aspx > > List FAQ : http://www.activedir.org/ListFAQ.aspx > > List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/ > > > List info : http://www.activedir.org/List.aspx > List FAQ : http://www.activedir.org/ListFAQ.aspx > List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/ > > > List info : http://www.activedir.org/List.aspx > List FAQ : http://www.activedir.org/ListFAQ.aspx > List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/ > List info : http://www.activedir.org/List.aspx List FAQ : http://www.activedir.org/ListFAQ.aspx List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/ List info : http://www.activedir.org/List.aspx List FAQ : http://www.activedir.org/ListFAQ.aspx List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
