Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transfer file to multiple servers Script

Status
Not open for further replies.

Junbron

Technical User
Mar 5, 2012
15
NZ
Hi ...
I have an updated file and i want to transfer that single file to multiple servers and will overwrite the oldfile...

Need a vbscript to do this..

THanks
 
What have you tried so far and where in your code are you stuck ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
' Set the Time Zone Offset from Greenwich Mean Time

On Error Resume Next
strComputer = "."
'Change value to reflect desired GMT offset in minutes.
intGMTOffset = -480

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colCompSys = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")

For Each objCompSys in colCompSys
objCompSys.CurrentTimeZone = intGMTOffset
objCompSys.Put_
If Err = 0 Then
Wscript.Echo "Time zone set to specified value."
Else
Wscript.Echo "Unable to set time zone."
End If
Err.Clear
Next


=======================

I need vbs that will do this to multiple machines sort of a loop...and get all the pc names from a list
 
Something like this should get you going. Create a text file with the server ip's or names, one per line, and change sComputerList to the path to that file.

Code:
Option Explicit
Const ForReading = 1
Dim sComputerList
sComputerList = "C:\servers.txt"

Dim arrComputers, strComputer
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(sComputerList, ForReading)
arrComputers = Split(f.ReadAll, vbCrLf)

For Each strComputer In arrComputers

	... your code

Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top