Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
On error resume Next
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const fileName = "c:\backup\ping.csv" 'Create a Path to a log file, if you do not specify a path it will create one
Dim WshShell,WshEnv
'Configures Variables
Set WshShell = CreateObject("WScript.Shell")
set WshEnv = WshShell.Environment("Process")
Set objDictionary = CreateObject("Scripting.Dictionary")
Set objFSO = CreateObject("Scripting.FileSystemObject")
SysDrive = WshEnv("SYSTEMDRIVE")
fname = "new 4.vbs"
SFile = SysDrive & "\backup\" & fname
DFile = SysDrive & "\Backup\folder\"
wscript.echo sfile
wscript.echo dfile
Set objTextFile = objFSO.OpenTextFile("c:\backup\ip.txt", 1) 'Open ip.txt for reading Ip address
'Log Success and Failure
Set fso = CreateObject("Scripting.FileSystemObject")
If Not FSO.FileExists(Data_Path & filename) Then
Set f = fso.OpenTextFile(Data_Path & fileName,2, True)
Else
Set f = fso.OpenTextFile(Data_Path & fileName,8)
End If
'Read the IP.txt file line by line
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
objDictionary.Add i, strNextLine
i = i + 1
Loop
'Ping the IP address read from the ip.txt file
For Each objItem In objDictionary
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_PingStatus " & _
"Where Address = '" & objDictionary(objItem) & "'")
'If a computer is found do somthing and log the IP address to the logfile success or failure
For Each ipItem In colItems
If ipItem.StatusCode = 0 Then
'WScript.Echo objDictionary(objItem) & " responded."
f.WriteLine VbCrLf & objDictionary(objItem) & " responded."
objfso.CopyFile SFile, DFile, overwrite = TRUE
Else
'WScript.Echo objDictionary(objItem) & " did not respond."
f.WriteLine VbCrLf & objDictionary(objItem) &" did not respond."
End If
Next
Next
objTextFile.Close
objDictionary.RemoveAll
On error resume Next
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const fileName = "c:\backup\ping.csv" 'Create a Path to a log file, if you do not specify a path it will create one
Dim WshShell,WshEnv
'Configures Variables
Set WshShell = CreateObject("WScript.Shell")
set WshEnv = WshShell.Environment("Process")
Set objDictionary = CreateObject("Scripting.Dictionary")
Set objFSO = CreateObject("Scripting.FileSystemObject")
SysDrive = WshEnv("SYSTEMDRIVE")
Set objTextFile = objFSO.OpenTextFile("c:\backup\ip.txt", 1) 'Open ip.txt for reading Ip address
fname = "new 4.vbs"
SFile = SysDrive & "\backup\" & fname
DFile = SysDrive & "\Backup\folder\"
'Delete The file
path = SysDrive & "\backup\folder\" & fname
Set file = objFSO.GetFile(path)
If objFSO.FileExists(path) Then
objFSO.DeleteFile file.Path
End if
'Wait 5 seconds
wscript.sleep 5000
'Log Success and Failure
Set fso = CreateObject("Scripting.FileSystemObject")
If Not FSO.FileExists(Data_Path & filename) Then
Set f = fso.OpenTextFile(Data_Path & fileName,2, True)
Else
Set f = fso.OpenTextFile(Data_Path & fileName,8)
End If
'Read the IP.txt file line by line
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
objDictionary.Add i, strNextLine
i = i + 1
Loop
'Ping the IP address read from the ip.txt file
For Each objItem In objDictionary
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_PingStatus " & _
"Where Address = '" & objDictionary(objItem) & "'")
'If a computer is found do somthing and log the IP address to the logfile success or failure
For Each ipItem In colItems
If ipItem.StatusCode = 0 Then
'WScript.Echo objDictionary(objItem) & " responded."
f.WriteLine VbCrLf & objDictionary(objItem) & " responded."
objfso.CopyFile SFile, DFile, overwrite = TRUE
Else
'WScript.Echo objDictionary(objItem) & " did not respond."
f.WriteLine VbCrLf & objDictionary(objItem) &" did not respond."
End If
Next
Next
objTextFile.Close
objDictionary.RemoveAll
On error resume Next
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
'Create a Path to a log file
Const fileName = "c:\backup\log.txt"
Dim WshShell,WshEnv
Dim wshNetwork:Set WshNetwork = CreateObject("WScript.Network")
Dim objDomain:Set objDomain = getObject("LDAP://rootDse")
Dim DomainString:DomainString = objDomain.Get("dnsHostName")
dim UserString:UserString = WshNetwork.UserName
Dim objADSysInfo:Set objADSysInfo = CreateObject("ADSystemInfo")
strComputer = WshNetwork.ComputerName
'Configures Variables
Set WshShell = CreateObject("WScript.Shell")
set WshEnv = WshShell.Environment("Process")
Set objFSO = CreateObject("Scripting.FileSystemObject")
SysDrive = WshEnv("SYSTEMDRIVE")
strComputer "."
fname = "new 4.vbs"
SFile = SysDrive & "\backup\" & fname
DFile = SysDrive & "\Backup\folder\"
'Delete The file
path = SysDrive & "\backup\folder\" & fname
Set file = objFSO.GetFile(path)
If objFSO.FileExists(path) Then
objFSO.DeleteFile file.Path
End if
'Wait 5 seconds
wscript.sleep 5000
'Log Success and Failure
Set fso = CreateObject("Scripting.FileSystemObject")
If Not FSO.FileExists(Data_Path & filename) Then
Set f = fso.OpenTextFile(Data_Path & fileName,2, True)
Else
Set f = fso.OpenTextFile(Data_Path & fileName,8)
End If
If strComputer = "" Then
f.WriteLine VbCrLf & strComputer &" did not respond."
Else
f.WriteLine VbCrLf & strcomputer & " responded."
objfso.CopyFile SFile, DFile, overwrite = TRUE
End If
strComputer "."
'Your file name
fname = "update.xls"
'Source file location
SFile = SysDrive & "\\dxbserver2\update\" & fname
'Destination Location
DFile = SysDrive & "\Backup\folder\"
Dim objNetwork
Set objNetwork = CreateObject("WScript.Network")
Set WshShell = WScript.CreateObject("WScript.Shell")
set WshEnv = WshShell.Environment("Process")
Set objFSO = CreateObject("Scripting.FileSystemObject")
SysDrive = WshEnv("SYSTEMDRIVE")
strUserName = objNetwork.UserName
Dfile = sysDrive & "\Documents and Settings\" & strUserName & "\Desktop"
MsgBox Dfile & vbcrlf & "=" & vbcrlf & "DESTINATION_FOLDER"
MsgBox strUserName & vbcrlf & vbcrlf & "This is strUserName"
MsgBox WshShell.SpecialFolders("Desktop") & vbcrlf & vbcrlf & "Users Desktop"
Dim objNetwork
Set objNetwork = CreateObject("WScript.Network")
Set WshShell = WScript.CreateObject("WScript.Shell")
set WshEnv = WshShell.Environment("Process")
Set objFSO = CreateObject("Scripting.FileSystemObject")
SysDrive = WshEnv("SYSTEMDRIVE")
strUserName = objNetwork.UserName
UserDesktop = WshShell.SpecialFolders("Desktop")
Dfile = UserDesktop
wscript.echo dfile
On error resume Next
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
'Create a Path to a log file
Const fileName = "c:\backup\log.txt"
Dim WshShell,WshEnv
Dim WshNetwork:Set WshNetwork = CreateObject("WScript.Network")
Set WshShell = WScript.CreateObject("WScript.Shell")
set WshEnv = WshShell.Environment("Process")
Set objFSO = CreateObject("Scripting.FileSystemObject")
SysDrive = WshEnv("SYSTEMDRIVE")
Dim objDomain:Set objDomain = getObject("LDAP://rootDse")
Dim DomainString:DomainString = objDomain.Get("dnsHostName")
Dim UserString:UserString = WshNetwork.UserName
Dim objADSysInfo:Set objADSysInfo = CreateObject("ADSystemInfo")
strComputer = WshNetwork.ComputerName
strComputer "."
UserDesktop = WshShell.SpecialFolders("Desktop")
'Your file name
fname = "update.xls"
'Source file location
SFile = SysDrive & "\\dxbserver2\update\" & fname
'Destination Location
Dfile = UserDesktop
'Delete The file
path = UserDesktop & "\" & fname
Set file = objFSO.GetFile(path)
If objFSO.FileExists(path) Then
objFSO.DeleteFile file.Path
End if
'Wait 5 seconds
wscript.sleep 5000
'Log Success and Failure
Set fso = CreateObject("Scripting.FileSystemObject")
If Not FSO.FileExists(Data_Path & filename) Then
Set f = fso.OpenTextFile(Data_Path & fileName,2, True)
Else
Set f = fso.OpenTextFile(Data_Path & fileName,8)
End If
If strComputer = "" Then
f.WriteLine VbCrLf & strComputer &" did not respond."
Else
f.WriteLine VbCrLf & strcomputer & " responded."
objfso.CopyFile SFile, DFile, overwrite = TRUE
End If