#135983 - 2005-03-2009:27 AMSNAPSHOT - System information backup
NTDOCNTDOC Administrator
Registered: 2000-07-28
Posts: 11628
Loc: CA
NOTE:!!! Please see the last script posting for the most up to date version of the script.
SNAPSHOT.KIX
I was contacted to help someone repair their system that had run an automated CHKDSK when they had rebooted their system. Apparently the system had a corrupted system file but the entry in the Event viewer did not tell you which file and there was no data in the .CHK file that was helpful enough to tell you what happened. Yes there are tools out there that do this already, but thought I'd whip this up in KiXtart and WinZip to create backups that can later be used with a difference tool to quickly locate and correct the problem.
This script will backup important files on your system in order to help you determine what might have changed from one point to another in order to help you more quickly repair your system in the event something were to go wrong at some point in time. It is sort of a before and after SNAPSHOT of your system. You must have Administrative rights to fully use properly. In order to be the most helpful it is advisable to run this daily and then burn a copy of the archive files to CD/DVD at least once per month and then delete all the old backups except the main one and start the process all over again.
This script requires the following software in order to function properly
KiXtart 4.23 Download KiXtart and extract KIX32.EXE and WKIX32.EXE to your C:\WINDOWS\SYSTEM32 folder so they are available via the path at all times.
WinZip Command Line NOTES: -ee = extra (enhanced deflate - smallest file) -r = Recurse into subfolders (include subfolders). This option requires the -p or -P option. -p|P= Store folder names. A lower case p stores only the names of folders recursed (subfolders included) via the -r option, while an upper case P stores all folder information specified on the command line
Example: wzzip.exe -rp Would only contain the child folder names wzzip.exe -rP Would contain the FULL path and child folder names
Example output
Warning! Each run of this backup will temporarily consume up to 100MB of diskspace or more. Once completed the final size will be between 5 to 10MB of diskspace per run. After 7 days the main archive will be renamed and a new one started. You must decide how many versions to save and when to delete them yourself. Press CTRL-C now to abort, otherwise press any other key to continue...
Backup script start time: 01:28:39
Please wait while we record a listing of all files on the system... Completed recording files and saved to: C:\BACKUP_SYSTEM\2005-03-20_01.28.38_FileListing.txt Please wait while we export the registry to: C:\BACKUP_SYSTEM\2005-03-20_01.28.38_RegBackup.txt Completed export of the registry Please wait while we copy other important files to: C:\BACKUP_SYSTEM\
Completed copying files to C:\BACKUP_SYSTEM\ Please wait while we archive all the backup files in C:\BACKUP_SYSTEM\
WinZip(R) Command Line Support Add-On Version 1.1 SR-1 (Build 6224) Copyright (c) WinZip Computing, Inc. 1991-2004 - All Rights Reserved
The backup file will be renamed once it reaches over 7 days old. Age of backup file 0
Completed all backup routines. Backup script end time: 01:29:15 Time to complete backup was: 37 seconds Size of backup archive file is: 6,216,712 bytes Press a key to continue...
#135984 - 2005-03-2512:37 PMRe: SNAPSHOT - System information backup
NTDOCNTDOC Administrator
Registered: 2000-07-28
Posts: 11628
Loc: CA
Well after someone wrote and complained that the script did not work (turned out they had not installed the WinZip Command Line app as told to), and speaking with Lonkero about the archiving program I rewrote this script to take advantage of the archiving program 7-Zip.
You can download the full GUI version here. Welcome to the 7-Zip Home! another good change in this script is that 7-Zip reduces the overall size of the archive by almost 50% compared to using WinZip and it's FREE to use.
7-Zip is free software distributed under the GNU LGPL
This updated script now does the following:
Checks if user has Admin rights and quits if not
Checks if there is at least 125MB of free space and quits if not
Automatically creates the C:\7ZA\ folder and downloads the 7z command line program 7za415b.exe
Extracts the file 7za415b.exe to the C:\7ZA\ folder
Automatically creates the C:\BACKUP_SYSTEM\ folder
List all files on the system via DIR C:\ /S
Exports the entire Registry to a text file
Copies BOOT.INI, WIN.INI, SYSTEM.INI to the archive
List all running services
net statistics workstation
net statistics server
netstat -a Active Connections
netstat -r Routing Table
nbtstat -S Sessions
net config workstation
proxycfg WinHTTP Default Proxy
Uses 7z command line app with maximum compression and archives all files above into the archive
Alerts the user when there are more then 7 archive files in the folder.
You can use the GUI version of 7z to review the files within the archive. WinRAR can also open this file format.
NOTE: This script has only been tested with KiX32 v4.22 and Windows XP English w/SP2 It has not been tested on Windows 2000 yet, but it should work on 2000 as well.
Sample Output
Warning! Each run of this backup will temporarily consume up to 100MB of diskspace or more. Once completed the final size will be between 5 to 10MB of diskspace per run. You must decide how many versions to save and when to delete them yourself.
Backup script start time: 03:21:54
Please wait while we record a listing of all files on the system... Completed recording files and saved to: C:\BACKUP_SYSTEM\2005-03-25_03.21.54_FileListing.txt Please wait while we export the registry to: C:\BACKUP_SYSTEM\2005-03-25_03.21.54_RegistryBackup.txt Completed export of the registry Please wait while we copy other important files to: C:\BACKUP_SYSTEM\
Completed copying files to C:\BACKUP_SYSTEM\ Please wait while we archive all the backup files in C:\BACKUP_SYSTEM\
The backup file will be renamed once it reaches over 7 days old. Age of backup file 0
Completed all backup routines. Backup script end time: 03:23:27 Time to complete backup was: 93 seconds Size of backup archive file is: 3,187,429 bytes
something weird I can't understand. why need to check 125M of free space if we only use 3?
why dowloading an exe and extracting? you have some package there? afaik, 7zip, zip, rar, arj... all have commandline tools that don't need no installation.
#135986 - 2005-03-2507:07 PMRe: SNAPSHOT - System information backup
NTDOCNTDOC Administrator
Registered: 2000-07-28
Posts: 11628
Loc: CA
Need to check for 125MB of free space because if you had read the original post for the Example output or within the script it'self it would show that during the process it will use 100MB or more of space. Then the data gets archived and I delete the temporary files created during the process which leaves us with only the archived file. As an example 2 of my systems export the registry file at around 75-80MB plus the directory listing of about 8MB. But each system this is ran on will be different.
Quote: Warning! Each run of this backup will temporarily consume up to 100MB of diskspace or more. Once completed the final size will be between 5 to 10MB of diskspace per run.
The install is not really an "install" in the normal sense, but I needed a method to confirm you have the command line version of 7-Zip and where it's located. So this checks if you have it in C:\7ZA and if not it then downloads it and extracts it there to use.
#135987 - 2005-04-0502:44 AMRe: SNAPSHOT - System information backup
NTDOCNTDOC Administrator
Registered: 2000-07-28
Posts: 11628
Loc: CA
I've updated the script to correct a methodology issue.
The script was always saving/updating the same file which updates the date each time, which invalidates checking the time the file was last updated.
Now the script creates a new file every time it's run. Once the script detects there are more then 7 archive files in the folder it will print out that message.
If you want to automate the log management please review these links for more information.
#135988 - 2005-05-0407:31 PMRe: SNAPSHOT - System information backup
NTDOCNTDOC Administrator
Registered: 2000-07-28
Posts: 11628
Loc: CA
Might want to add the %windows%\repair folder to the list of saved items, and may add the recent DLL UDF to help quickly check DLLs added/removed recently instead of the entire file system check which can be done but would take longer. Often spyware/trojans/worms add new DLL and Process which a compare will help to remove.