Runs a script against multiple computers

This snippet runs a script against multiple computers taken from a text file. A big time saver.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'Create a FileSystemObject
Set oFS = CreateObject("Scripting.FileSystemObject")
'Open a text file of computer names
'with one computer name per line
Set oTS = oFS.OpenTextFile("c:computers.txt")

'go through the text file
Do Until oTS.AtEndOfStream
'get the next computer name
'store it in variable sComputer
sComputer = oTS.ReadLine

'-----------------------------------
' YOUR CODE HERE - code will
' affect each computer in the
' input text file
'-----------------------------------
Loop
'close the text file
oTS.Close
MsgBox "Done!"
You can leave a response, or trackback from your own site.
Print This Post Print This Post



Further Reading

83 views

Leave a Reply

Twitter Delicious Facebook Digg Stumbleupon Favorites More
111 queries in 4.707 seconds.