I have about 12 windows servers that I monitor w/ nagios. I manage all the configs and scripts from my laptop. As of right now I have to go to each server and run my config update script. What I want to do is to write a script that I can run on my laptop that will update all the windows server configs simultaneously. I also want the script to be able to add a line of configuration, but when script writes to the file, it clears the whole file and only adds the line I want to add. I started work on one but it only looks for the files on my computer. I am including the code that I have already.
Dim file, objFile, objFSO
Dim command, objExecObject
Dim aMachines, strMachines, machine
strMachines = "IP addresses separated by comma w/ no spaces"
aMachines = Split(strMachines, ",")
For Each machine In aMachines
command = "cmd /c xcopy ""P:\Departments\Information Technology\Scripts\chk_syslog_ntfs.vbs"" c:\progra~1\NSClient++\"
Set objShell = CreateObject("Wscript.Shell")
Set objExecObject = objShell.Exec(command)
file = "C:\Program Files\NSClient++\NSC.ini"
Const ForAppending = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(file, ForAppending)
If Err.number = vbEmpty Then
Set objShell = CreateObject("WScript.Shell")
objShell.run ("Explorer" &" " & file & "\" )
Else WScript.echo "VBScript Error: " & Err.number