TheTAZZone - Internet Chaos

Cisco devices: Rather than create the folder structure by hand


Do not use, republish, in whole or in part, without the consent of the Author. TheTAZZone policy is that Authors retain the rights to the work they submit and/or post…we do not sell, publish, transmit, or have the right to give permission for such…TheTAZZone merely retains the right to use, retain, and publish submitted work within it’s Network

Please refer to the original post as not all the script may be visible here.

I manage a *lot* of network devices (all of them Cisco), so I maintain a repository of configurations which are all text files. I devised a method to keep all the configurations straight, and essentially maintain a kind of change control system.

I have a folder on my system named “Network Device Configurations”. Inside this folder are folders named with the hostname of each individual device. Each device folder has subfolders named by year (e.g. 2008). Each year subfolder has twelve subfolders, 01 through 12, for each month of the year. Rather than create the folder structure by hand, I use the following script:

Code: Select all
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")

strDeviceName = InputBox("Enter the device name:", "Network Device Name")

If strDeviceName = "" Then
WshShell.Popup "You must provide a device name!", 10, "Missing Device " & _
"Name!", 48
End If

' * * * Change This Line ! ! ! * * *
strTopLevelFldr = "C:\PathToYour\Network Device Configurations\" & _
strYFldr = strTopLevelFldr & "\" & Year(Date)

If objFSO.FolderExists (strTopLevelFldr) Then
WshShell.Popup "Top level folder already exists and will not be created." & _
vbCrLf, 10, "Folder Exists!", 48
WshShell.Popup "Folder does not already exist and will be created." & _
vbCrLf, 10, "New Folder", 48
Set objFldr = objFSO.CreateFolder(strTopLevelFldr)
End If

Sub subCreateYFldr
If objFSO.FolderExists (strYFldr) Then
Set objFldr = objFSO.CreateFolder(strYFldr)
End If
End Sub

Sub subCreateMFldrs
intM = 1

Do Until intM = 10
strMFldr = strYFldr & "\0" & intM
Set objFldr = objFSO.CreateFolder(strMFldr)
intM = intM + 1

Do Until intM = 13
strMFldr = strYFldr & "\" & intM
Set objFldr = objFSO.CreateFolder(strMFldr)
intM = intM + 1
End Sub

WshShell.Popup "Creation of:" & vbCrLf & vbCrLf & strTopLevelFldr & _
vbCrLf & vbCrLf &   "and all subfolders complete.", 10, _
"Folders Created!", 48

Then, any and every time I edit a device configuration, the first thing I do is take a copy of the current configuration and save it to the appropriate folder and name it using the following convention:

Code: Select all
YYYYMMDD HHMM DeviceName Backup Config.TXT

When I’m done making any changes, I’ll save the new file using a similar convention:

Code: Select all

Generally using short, but descriptive nomenclature for whatever change I made. I also rarely save the entire config in this file, but usually just the changes made.

This is helpful in that I can review historical configurations and see what changes were made when (and the above naming convention keeps everything organized in chronological order when sorted by name).

Leave a Reply

Your email address will not be published. Required fields are marked *


If you'd like to advertise on The Mutt ( aka ) feel free to contact us at: administration[at]

TheTAZZone is a non-commercial entity. We do not sell any products or services ourselves. Our revenue comes from advertising and donations only.

We appreciate your support! Your advertising revenue ( or donations ) helps us to continue to upgrade, improve, and offset the costs of maintaining this site.

Donations can be made through the page ' Donate '.