'Open list.txt containing computer names
'Keep list.txt in the same directory as the script file
Set FSO = CreateObject("Scripting.FileSystemObject")
Set File = FSO.OpenTextFile("list.txt", 1, False)
'Read list file one line at a time and perform tasks
Do While File.AtEndOfStream <> True
strLine = File.ReadLine
'Host or IP to ping
strHost = strLine
'Create shell object
Set Shell = wscript.createObject("wscript.shell")
'What to run in command line
strCommand = "ping -n 1 -w 300 " & strHost
'Run command and get return code
ReturnCode = Shell.Run(strCommand, 0, True)
'0 = pingable, 1 = no response
If ReturnCode = 0 Then
wscript.echo strHost & " is pingable"
Else
wscript.echo strHost & " is not pingable"
End If
Loop
File.Close
WScript.Echo "Complete"
WScript.Quit
TheDate = Date
TheTime = Time
Const ForWriting = 2, ForAppending = 8
Set Shell = wscript.createObject("wscript.shell")
set FileSystem = CreateObject("Scripting.FileSystemObject")
Dummy = Shell.Popup ( "Building Ping File. Please Wait...",1,"Ping Automation Tool",64)
If (FileSystem.FileExists("C:\Documents and Settings\harmanp\Desktop\Pingfile.txt")) Then
Set TheFile = FileSystem.OpenTextFile("C:\Documents and Settings\harmanp\Desktop\Pingfile.txt", ForAppending, True)
Else
Set TheFile = FileSystem.OpenTextFile("C:\Documents and Settings\harmanp\Desktop\Pingfile.txt", ForWriting, True)
End If
TheFile.WriteBlankLines(1)
TheFile.WriteLine("=========================================")
TheFile.WriteLine(" Ping Automation Tool")
TheFile.WriteLine("This Ping Session was run on: " & TheDate & " at " & TheTime)
TheFile.WriteLine("=========================================")
TheFile.WriteBlankLines(1)
TheFile.Close
'Open list.txt containing computer names
'Keep list.txt in the same directory as the script file
Set FSO = CreateObject("Scripting.FileSystemObject")
Set File = FSO.OpenTextFile("livelist.txt", 1, False)
'Read list file one line at a time and perform tasks
Do While File.AtEndOfStream <> True
strLine = File.ReadLine
'Host or IP to ping
strHost = strLine
'Create shell object
Set Shell = wscript.createObject("wscript.shell")
Shell.Run "Cmd.exe /c Ping.exe -n 2 " & strHost &" >> C:\Documents and Settings\harmanp\Desktop\Pingfile.txt", 2,True
Shell.Run "Cmd.exe /c Echo. >> C:\Documents and Settings\harmanp\Desktop\Pingfile.txt", 2,True
Shell.Run "Cmd.exe /c Echo ********************************** >> C:\Documents and Settings\harmanp\Desktop\Pingfile.txt", 2,True
Loop
File.Close
Shell.Run "Notepad.exe C:\Documents and Settings\harmanp\Desktop\Pingfile.txt", 1,True
WScript.Echo "Complete"
WScript.Quit
TheDate = Date
TheTime = Time
Const ForWriting = 2, ForAppending = 8
Set Shell = wscript.createObject("wscript.shell")
set FileSystem = CreateObject("Scripting.FileSystemObject")
Dummy = Shell.Popup ( "Building Ping File. Please Wait...",1,"Ping Automation Tool",64)
If (FileSystem.FileExists("Pingfile.txt")) Then
Set TheFile = FileSystem.OpenTextFile("Pingfile.txt", ForAppending, True)
Else
Set TheFile = FileSystem.OpenTextFile("Pingfile.txt", ForWriting, True)
End If
TheFile.WriteBlankLines(1)
TheFile.WriteLine("=========================================")
TheFile.WriteLine(" Ping Automation Tool")
TheFile.WriteLine("This Ping Session was run on: " & TheDate & " at " & TheTime)
TheFile.WriteLine("=========================================")
TheFile.WriteBlankLines(1)
TheFile.Close
'Open list.txt containing computer names
'Keep list.txt in the same directory as the script file
Set FSO = CreateObject("Scripting.FileSystemObject")
Set File = FSO.OpenTextFile("livelist.txt", 1, False)
'Read list file one line at a time and perform tasks
Do While File.AtEndOfStream <> True
strLine = File.ReadLine
'Host or IP to ping
strHost = strLine
'Create shell object
Set Shell = wscript.createObject("wscript.shell")
Shell.Run "Cmd.exe /c Ping.exe -n 2 " & strHost &" >> Pingfile.txt", 2,True
Shell.Run "Cmd.exe /c Echo. >> Pingfile.txt", 2,True
Shell.Run "Cmd.exe /c Echo ********************************** >> Pingfile.txt", 2,True
Loop
File.Close
Shell.Run "Notepad.exe Pingfile.txt", 1,True
WScript.Echo "Complete"
WScript.Quit
TheDate = Date
TheTime = Time
Const ForWriting = 2, ForAppending = 8
Set Shell = wscript.createObject("wscript.shell")
set FileSystem = CreateObject("Scripting.FileSystemObject")
Dummy = Shell.Popup ( "Building Ping File. Please Wait...",1,"Ping Automation Tool",64)
If (FileSystem.FileExists("Pingfile.txt")) Then
Set TheFile = FileSystem.OpenTextFile("Pingfile.txt", ForAppending, True)
Else
Set TheFile = FileSystem.OpenTextFile("Pingfile.txt", ForWriting, True)
End If
TheFile.WriteBlankLines(1)
TheFile.WriteLine("=========================================")
TheFile.WriteLine(" Ping Automation Tool")
TheFile.WriteLine("This Ping Session was run on: " & TheDate & " at " & TheTime)
TheFile.WriteLine("=========================================")
TheFile.WriteBlankLines(1)
TheFile.Close
'Open list.txt containing computer names
'Keep list.txt in the same directory as the script file
Set FSO = CreateObject("Scripting.FileSystemObject")
Set File = FSO.OpenTextFile("livelist.txt", 1, False)
'Read list file one line at a time and perform tasks
Do While File.AtEndOfStream <> True
strLine = File.ReadLine
'Host or IP to ping
strHost = strLine
'Create shell object
Set Shell = wscript.createObject("wscript.shell")
'What to run in command line
strCommand = "ping -n 1 -w 300 " & strHost
'Run command and get return code
ReturnCode = Shell.Run(strCommand, 0, True)
'0 = pingable, 1 = no response
If ReturnCode = 0 Then
Set TheFile = FileSystem.OpenTextFile("Pingfile.txt", ForAppending, True)
TheFile.WriteLine("=========================================")
TheFile.WriteLine(strHost & " is pingable ")
TheFile.WriteLine("=========================================")
TheFile.WriteBlankLines(1)
Else
Set TheFile = FileSystem.OpenTextFile("Pingfile.txt", ForAppending, True)
TheFile.WriteLine("=========================================")
TheFile.WriteLine(strHost & " is not pingable ")
TheFile.WriteLine("=========================================")
TheFile.WriteBlankLines(1)
End If
TheFile.Close
Loop
File.Close
Shell.Run "Notepad.exe Pingfile.txt", 1,True
WScript.Echo "Complete"
WScript.Quit
TheDate = Date
TheTime = Time
Const ForWriting = 2, ForAppending = 8
Set Shell = wscript.createObject("wscript.shell")
set FileSystem = CreateObject("Scripting.FileSystemObject")
Dummy = Shell.Popup ( "Building Ping File. Please Wait...",1,"Ping Automation Tool",64)
If (FileSystem.FileExists("Pingfile.txt")) Then
Set TheFile = FileSystem.OpenTextFile("Pingfile.txt", ForAppending, True)
Else
Set TheFile = FileSystem.OpenTextFile("Pingfile.txt", ForWriting, True)
End If
TheFile.WriteBlankLines(1)
TheFile.WriteLine("=========================================")
TheFile.WriteLine(" Ping Automation Tool")
TheFile.WriteLine("This Ping Session was run on: " & TheDate & " at " & TheTime)
TheFile.WriteLine("=========================================")
TheFile.WriteBlankLines(1)
TheFile.Close
'Open list.txt containing computer names
'Keep list.txt in the same directory as the script file
Set FSO = CreateObject("Scripting.FileSystemObject")
Set File = FSO.OpenTextFile("livelist.txt", 1, False)
Set TheFile = FileSystem.OpenTextFile("Pingfile.txt", ForAppending, True)
'Read list file one line at a time and perform tasks
Do While File.AtEndOfStream <> True
strLine = File.ReadLine
'Host or IP to ping
strHost = strLine
'Create shell object
Set Shell = wscript.createObject("wscript.shell")
'What to run in command line
strCommand = "ping -n 1 -w 300 " & strHost
'Run command and get return code
ReturnCode = Shell.Run(strCommand, 0, True)
'0 = pingable, 1 = no response
If ReturnCode = 0 Then
TheFile.WriteLine("=========================================")
TheFile.WriteLine(strHost & " is pingable ")
TheFile.WriteLine("=========================================")
TheFile.WriteBlankLines(1)
Else
TheFile.WriteLine("=========================================")
TheFile.WriteLine(strHost & " is not pingable ")
TheFile.WriteLine("=========================================")
TheFile.WriteBlankLines(1)
End If
Loop
TheFile.Close
File.Close
Shell.Run "Notepad.exe Pingfile.txt", 1,True
WScript.Echo "Complete"
WScript.Quit
Set Shell = CreateObject("Wscript.Shell")
Return = Shell.Run ("taskkill /s " & strLine & " /im scale.exe", 1, true)
that's it! lol thanksI think in your code above you missed a space between the /s and the computer name?
A[L]C;19318232 said:quick question if you are still around..... the copy, does it wait for the file to be copied, before running the register? Its going across the wan so may take a little while.
Thanks