Configuration Management using Solarwinds TFTP Engine

From Internetworkpro

Jump to: navigation, search
This page or section provides device configuration instructions
Please note that the information on this page has not been checked for accuracy and is not intended as a replacement to documentation. Please ensure you understand your desired objectives before attempting to apply any examples listed.
See more examples at Category:Configuration
Option Explicit
 
  Dim TransferEngine 
  Dim Transfer
  Dim Results
  Dim BackupPath
  Dim FS
  Dim Folder1
 
On Error Resume Next
 
  ' Create file system object 
  Set FS = CreateObject("Scripting.FileSystemObject")
 
  ' Generate backup folder path using today's date
  BackupPath = "C:\Config_Backup\" & Year(Date) & "-" & Month(Date) & "-" & Day(Date)  
 
  ' Create folder
  Set Folder1 = CreateObject("Scripting.FileSystemObject").CreateFolder(BackupPath) 
 
  Set FS = Nothing
  Set Folder1 = Nothing 
 
On Error Goto 0  ' Disable On Error Resume Next
 
  ' Connect to the SolarWinds Config Transfer Engine
  Set TransferEngine = CreateObject("SWCiscoTransfer.Application")
 
  TransferEngine.TFTPRootDir = BackupPath
 
  Results = "             Configuration Backup Results                 " & VbCrLf & _
            "==========================================================" & VbCrLf
 
 
  ' Download configs from devices
  ' Syntax:  Download "DeviceIP", "TFTP Server IP", "SMTP R/W String"
 
  ' Internal routers
  Download "192.168.1.1", "192.168.2.250", "internetworkpro"  	'cae-asdf-ar01
  Download "192.168.1.2", "192.168.2.250", "internetworkpro"	'cae-asdf-ar02
  Download "192.168.1.3", "192.168.2.250", "internetworkpro"	'cae-asdf-ar03
  Download "192.168.1.4", "192.168.2.250", "internetworkpro"	'cae-asdf-ar04
 
  ' External routers - using the outside TFTP server IP address
  Download "100.100.100.100", "100.100.100.200", "l33th4x0rz"	'atl-asdf-cr01
 
  Wscript.Echo Results
 
  Set TransferEngine = Nothing
 
 
 
 
Sub Download(DeviceIP ,TFTPServerIP, SNMPCommunity)
 
  Set Transfer = TransferEngine.Transfers.NewTransfer
 
  Transfer.IP = DeviceIP
  Transfer.TFTPServer = TFTPServerIP
  Transfer.Community = SNMPCommunity
 
  If Transfer.DownloadConfig Then
    Results = Results & "Success: Downloaded Config to " & Transfer.FullPathName & VbCrLf 
  Else
    Results = Results & "Error  : " & Transfer.LastError & VbCrLf 
  End If
 
  Set Transfer = Nothing
 
End Sub



Original script by tabularasa Rewritten by Aileran

Personal tools