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/

Reply via email to