spikeman24
MIS
Hi Everyone,
I need help with the array execution portion of this script, I left the different options I've tried so far commented. The line that has not been commented works but does not help me with my final goal. I would like to, if possible read the server names from the text file then execute the command below on every one of those servers listed in the text file.
Can someone please help me solve this, not even sure if what I'm trying to do is possible? I’m not a programmer so if what I’ve strung together is wrong please let me know.
Kind Regards
Herschel
-----------------------------------------------------------
Const ForReading = 1
Const SERVERS = "C:\servers-list.txt" 'this file contains the name of the server that I want to run the command below on
Dim fso, f
Dim arrText()
Dim iUpperBound
Dim SourcePath,SourceFile,DestPath, String
Set shell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fs
penTextFile(SERVERS, ForReading)
iUpperBound = 0
While Not f.AtEndOfStream
ReDim Preserve arrText(iUpperBound)
arrText(UBound(arrText)) = f.ReadLine
iUpperBound = iUpperBound + 1
Wend
f.Close
For Each elem In arrText
'shell.run "C:\program" &"\\" & elem &" -i -w C:\TestFolder\admutils\stat -tT -fmyserver -aAdministrator -ppassword -S-30 -o\\fileserver\c$\servername_monthly_stat.csv -l6 -h" 'if possible when creating the [servername_from_list].csv file I would like to use the server name read from the server.txt file
shell.run "C:\program \\TheServer -i -w C:\TestFolder\admutils\stat -tT -fmyserver -aAdministrator -ppassword -S-30 -o\\fileserver\c$\servername_monthly_stat.csv -l6 -h"
I need help with the array execution portion of this script, I left the different options I've tried so far commented. The line that has not been commented works but does not help me with my final goal. I would like to, if possible read the server names from the text file then execute the command below on every one of those servers listed in the text file.
Can someone please help me solve this, not even sure if what I'm trying to do is possible? I’m not a programmer so if what I’ve strung together is wrong please let me know.
Kind Regards
Herschel
-----------------------------------------------------------
Const ForReading = 1
Const SERVERS = "C:\servers-list.txt" 'this file contains the name of the server that I want to run the command below on
Dim fso, f
Dim arrText()
Dim iUpperBound
Dim SourcePath,SourceFile,DestPath, String
Set shell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fs
iUpperBound = 0
While Not f.AtEndOfStream
ReDim Preserve arrText(iUpperBound)
arrText(UBound(arrText)) = f.ReadLine
iUpperBound = iUpperBound + 1
Wend
f.Close
For Each elem In arrText
'shell.run "C:\program" &"\\" & elem &" -i -w C:\TestFolder\admutils\stat -tT -fmyserver -aAdministrator -ppassword -S-30 -o\\fileserver\c$\servername_monthly_stat.csv -l6 -h" 'if possible when creating the [servername_from_list].csv file I would like to use the server name read from the server.txt file
shell.run "C:\program \\TheServer -i -w C:\TestFolder\admutils\stat -tT -fmyserver -aAdministrator -ppassword -S-30 -o\\fileserver\c$\servername_monthly_stat.csv -l6 -h"