Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


WSHshell backup script

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,2044
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> WSHshell backup script
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 WSHshell backup script - 2/11/2005 9:26:22 AM   
  schnizzlewizz

 

Posts: 1
Score: 0
Joined: 2/11/2005
From:
Status: offline
I am new to writing vbs scripts and I need some help. The objective of this script is to backup a config of a device to a stationary pc. The way the script is written it works fine but It doesn't know whether a device is working or not. What I would like to do is insert some script that will ping each device first and whether you get a reply from the ping or not, have the script either continue on or skip the portion of the script that the ping failed down to the beginning of the next node. Here is a sample:

set WshShell = WScript.CreateObject("WScript.Shell")
Wshshell.run "cmd.exe"
'NOTE x.x.x.xxx
WScript.sleep 1000
Wshshell.sendkeys "telnet x.x.x.xxx"
WScript.sleep 2500
Wshshell.sendkeys "~"
WScript.sleep 2500
Wshshell.Sendkeys "admin"
WScript.sleep 500
Wshshell.sendkeys "~"
WScript.sleep 500
Wshshell.sendkeys "~"
WScript.sleep 500
Wshshell.Sendkeys "pr"
WScript.sleep 500
Wshshell.sendkeys "~"
WScript.sleep 500
Wshshell.sendkeys "~"
WScript.sleep 500
Wshshell.sendkeys "copy run start"
WScript.sleep 500
Wshshell.sendkeys "~"
WScript.sleep 5000
Wshshell.sendkeys "copy start ftp x.x.x.xxx a aaaaaa x.xxx__backup.bin"
WScript.sleep 500
Wshshell.sendkeys "~"
WScript.sleep 1000
Wshshell.sendkeys "exit"
WScript.sleep 1000
Wshshell.sendkeys "~"
'NOTE x.x.x.xxx
WScript.sleep 1000
Wshshell.sendkeys "telnet x.x.x.xxx"
WScript.sleep 2500
Wshshell.sendkeys "~"
WScript.sleep 2500
Wshshell.Sendkeys "admin"
WScript.sleep 500
Wshshell.sendkeys "~"
WScript.sleep 500
Wshshell.sendkeys "~"
WScript.sleep 500
Wshshell.Sendkeys "pr"
WScript.sleep 500
Wshshell.sendkeys "~"
WScript.sleep 500
Wshshell.sendkeys "~"
WScript.sleep 500
Wshshell.sendkeys "copy run start"
WScript.sleep 500
Wshshell.sendkeys "~"
WScript.sleep 5000
Wshshell.sendkeys "copy start ftp x.x.x.xxx a aaaaaa x.xxx__backup.bin"
WScript.sleep 500
Wshshell.sendkeys "~"
WScript.sleep 1000
Wshshell.sendkeys "exit"
WScript.sleep 1000
Wshshell.sendkeys "~"
 
 
Post #: 1
 
 Re: WSHshell backup script - 2/11/2005 10:02:31 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
host = "2500"
Set wmi = GetObject("winmgmts:\\" & "." & "\root\cimv2")
Set pings = wmi.ExecQuery("SELECT * FROM Win32_PingStatus WHERE Address = '" & host & "'")
For Each ping in pings
If IsNull(ping.StatusCode) or ping.StatusCode <> 0 Then
wscript.echo "timed out"
else
wscript.echo "online"
end if

(in reply to schnizzlewizz)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> WSHshell backup script Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts