Microsoft's ScanReg Utility

Microsoft’s ScanReg Utility

If you have read any of our articles pertaining to either the Windows Registry or to Microsoft’s Backup utility, you may have noticed our mention of Microsoft’s ScanReg utility. If you’re wondering just what Scanreg is, and what it can do, this article should answer that for you. This neat little tool can help you keep your computer in good shape and even save you from some unnecessary grief.

ScanReg, while new to the Windows 9x family of operating systems, has been around for a while, as it originally was a tool that was used in Windows NT by administrators to scan the registry. Hmm, kind of makes sense, right?

Windows 98 comes with two versions of Scanreg. “Scanreg“, which is used in a pure MS-DOS environment (MS-DOS prompt-but not a Windows MS-DOS prompt), and “Scanregw“, which is used within the Windows 98 Graphical User Interface (GUI) and invoked from the “Start”, “Run” command line. For the purposes of this discussion though, we will use the term Scanreg as referring to both versions until there is a need to distinguish between the two.

What is ScanReg?
ScanReg (Scan Registry) is more than a mere registry scanning tool. It is, among other things, an automated registry verification and backup utility that was taken from the Windows NT toolbox, revamped, and then added to, and released with, Windows 98. In addition to the tool itself, there is also a companion file called ScanReg.ini. This file contains all of the configuration information necessary to control how ScanReg does its job. As is the case with all of Microsoft’s operating system releases, shortly after releasing Windows 98 (all editions), Microsoft released their Windows 98 Resource Kit. While we won’t be getting into the features of the Windows 98 Resource Kit here, suffice it to say that it contains a full compliment of tools for working with Windows 98 as well as an in-depth explanation of the inner-workings of the Windows 98 operating system. One of the included tools is a companion for ScanReg, the ScanReg configuration editor, SREdit.exe. But don’t despair, you won’t have to purchase the Resource Kit to get this editor as it is buried on your original Windows 98 CD-ROM disk in the Config folder.

Rather than working from a DOS command line, SREdit.exe provides you with a graphical user interface that you can use to configure the default settings for Scanreg.ini file in order to control what Scanreg will do. As an example, when using Scanreg to back up the Windows registry (User.dat and System.dat), it will automatically add the Win.ini and System.ini files by default to the registry backup .CAB file. By editing the Scanreg.ini file with SREdit, you can add several other files to your registry backup as well. This can be useful for creating emergency recovery disks as well as optimizing the performance of your computer.

Here are some of the changes you can make with SREdit.Exe to control how ScanReg operates:

  • You can specify the directory or directories where ScanReg stores its backup copies of the Registry.
  • You can set the maximum number of backup copies created (the default is 5), as well as select additional system files, such as your Autoexec.bat, Config.sys, and Msdos.sys, to be backed up.
  • You can set ScanReg to optimize the registry. When this value is set, ScanReg removes the space reserved in the registry for deleted keys, which typically reduces the size of the registry.

As you probably know by now, the Windows registry is critical to your Windows 98 operating system as this is where Windows 98, as well as all other applications you have installed, stores the configuration information they rely on. Therefore, it is crucial to back up the registry frequently so that this information can be recovered in the event you experience a system crash and the registry is damaged. It is also a good idea to back up the Windows registry before installing a new application or new hardware.

Although ScanReg automatically backs up the registry, you can also run it manually at any time using the following procedure.

How to manually back up the registry using ScanReg in Windows

  1. Click Start, then click Run.
  2. Type scanregw, and click OK.

First, the Registry Checker aspect of ScanReg will verify that the registry is structurally sound.

If the registry is found to be sound, ScanReg offers to back it up.

If a backup had already made that day by ScanReg, it will notify you of this fact and then ask whether or not you wish to back it up again. As we noted earlier, this is extremely useful when installing new software or adding new hardware components. You can backup your registry just before performing these installations and changes, then, should a problem occur, return to a point just prior to the change by using ScanReg to restore the registry. When ScanReg backs up the registry, it compresses the files into CAB files and then stores them in a hidden directory on your hard drive at the \Windows\Sysbckup directory.

How to restore the Windows Registry

On those occasions where the registry structure is sound, but a small system change you may have made or that an errant program has made, to the registry is keeping the computer from booting or starting properly, you will need to manually restore the registry and maybe other critical boot files from a backup as well. Keep in mind that this can only be done via a pure MS-DOS prompt, not a DOS prompt from within Windows.

To restore the backup manually:

  1. Click Start, then click Shut Down.
  2. Now Select Restart in MS-DOS mode and click OK.
  3. At the MS-DOS command prompt, type scanreg /restore and touch the enter key.
  4. Select the latest known good backup.

    Note: At this point you can also select any of the registry backup cabs available.

  5. Your compressed registry files are listed with the name Rbxxx.cab. The files show the time and date of backup, and next to each CAB file are the words Started or Not Started.

    Started” means that the file has successfully started Windows 98, and is a known good file. “Not Started” means that the file has never been used to start Windows 98, and thus not a known good file. This doesn’t mean that it isn’t a good registry backup, but only that it has never actually been used to start Windows 98.

When you are working in MS-DOS, syntax is everything!

Syntax means typing the MS-DOS terms (words or commands) in a specific fashion, including the insertion of spaces where needed as well as necessary forward slashes ( / ) and backward slashes ( \ ) as required.

To perform a backup of the Windows Registry using ScanReg in pure MS-DOS, the syntax would be:

C:\>C:\Windows\Command>SCANREG /BACKUP /COMMENT=”MESSAGE”

Note: Your MS-DOS prompt is shown in bold, (e.g. this is what you should see when at a DOS prompt), don’t retype it! Before each forward slash ( / ) is a blank space.

The syntax to either view the backup with message and/or restore would be:

C:\>C:\Windows\Command>SCANREG /Restore

or

C:\>C:\Windows\Command>SCANREG (and then view the backup files)

Configuring ScanReg by editing the ScanReg.ini

As mentioned earlier in this article, the ScanReg Registry Checker tool is configured with the Scanreg.ini file, which can be edited in one of three ways, either in MS-DOS through the use of Edit.com, through the use of NotePad while in Windows or by using the ScanReg editor, SREdit.

If you would like to see what the default ScanReg.ini files looks like, Click Here: (it will open a small window)

The following are the configurable settings in the Scanreg.ini file:

Backup= Enables and disables Registry Checker.
Backup=0 Disables backups
Backup=1 Enables backups
MaxBackupCopies= Specifies the maximum number of backups to store in the Backup folder.

*MaxBackupCopies=5  (5 is the default number of copies)

BackupDirectory= 

*Changes the location of the backup folder where the CAB files are stored.

For example:  BackupDirectory=C:\RegBackup

Files= Adds system files to be backed up.

*The “File=” entry does not exist by default, and is used to specify additional files you may want to add to the registry backup .cab file.

For example, to specify additional files to be backed up:

Files=,

Where is the numerical code for the folder in which the file you want to back up is located

And is the name of the file you want to back up. If you want to back up multiple files in the same location, separate each file name using a comma (,) and without spaces.

The following list is a few of the possible folder codes: 10 (for example, Windows) 11 \System (for example, Windows\System) 30 Root folder (for example, c:\) 31 Root host folder (for example, c:\)

Example: If you wanted to backup the sysmon.log and scandisk.log in the root of your C:\ drive, you would enter the information as follows:

Files=30,sysmon.log,scandisk.log

Optimize= Enables and disables automatic registry optimization.
Optimize=0 Disables optimization
Optimize=1 Enables optimization

ScanReg Command-Line Switches

These are the command-line switches supported by ScanReg:

MS-DOS
Windows
Switch Description
  /autoscan Automatically scans the registry and backs it up without displaying any prompts if there is already a backup for that date.
  /backup Backs up the registry and related files without displaying any prompts.
  “/comment=” Enables you to add a descriptive comment to the registry backup. (See below)
  filename Scans the registry file specified and displays a message indicating whether or not any errors were found. This switch does not back up the registry.
  /fix Repairs any damaged portions of the registry, and optimizes it by rebuilding it without unused space.
  /opt Compacts the registry. It will automatically do this during its boot up check if there’s more than 500KB of empty space. It will also do this when running /fix.
  /restore Displays a list of available backup files, sorted by the date and time the backup was created.
  /scanonly Scans the registry and displays a message if any errors are found. This switch does not back up the registry.

The “/comment=” switch can be used by itself or with the /backup switch. For example, you can type either of the following commands at a command prompt:

scanreg.exe “/comment=registry backup 5 June”

scanreg.exe /backup “/comment=registry backup 5 June”

Possible Error Codes returned by ScanReg

Error
Code

Reason — Possible Resolve

2 The Registry is bad. Possible resolution, choose another CAB file if available.
0 No Registry problems found.
-2 Not enough memory. Possible resolution, free some memory*
-3 File not found. User.dat or System.dat or both cannot be found, have been renamed or are severely damaged. Recover from backup or Reinstall Windows
-4 Unable to create User.dat or System.dat. Possible resolution, try another CAB file, recover from backup or reinstall Windows
-5 Reading the Registry failed. Free some memory and try another scan.
-6 Writing to the Registry failed. Free some memory and try another scan.
-7 Sharing violation. An application has the Registry open, making it inaccessible to ScanReg. Locate the errant application and close it.

Women’s Chicago Bears Brian Urlacher Nike Navy Blue Alternate Limited Jersey,San Francisco 49ers Small Over Large Mega License Plate Frame Atlanta Falcons Custom Jersey.Men’s Indianapolis Colts Andrew Luck Royal Eligible Receiver II Name and Number Long Sleeve T-Shirt,Zubaz Philadelphia Eagles Youth Green Double Edge T-Shirt,Meesh & Mia New York Jets Women’s Team Leggings – Black The Atlanta Falcons Jerseys Super Bowl.Women’s Denver Broncos Cuce Frontrunner Rain Boots,’47 Brand Seattle Seahawks Cleanup Adjustable Visor – White,Atlanta Falcons Chill Collapsible Cooler ¨C Red Atlanta Falcons Football Jersey.’47 Brand Denver Broncos Cleanup Adjustable Visor – Khaki,Men’s Denver Broncos Peyton Manning Nike Navy New Day Name & Number Performance T-Shirt.cheap nfl appeal kit,nfl wholesale 5 gallon,cheap nfl footballs standings,Men’s Tampa Bay Buccaneers Nike Pewter Lockdown Half-Zip Jacket.Pro Line Jacksonville Jaguars Historic Logo Women’s Viper Lattice Reversible Hoodie – Black/Ash,Men’s Philadelphia Eagles New Era White On Field Training Camp Bucket Hat Atlanta Falcons Jerseys Wholesale.Alex and Ani New England Patriots Women’s Rafaelian Silver Finish Bracelet,Men’s Washington Redskins New Era Black NFL Gray Collection Cuffed Knit Hat.Women’s New York Giants Majestic White/Gray Counter IV Crew Fleece Sweatshirt,Women’s Dallas Cowboys Natural/Navy Harper Slouch Meshback Adjustable Hat http://www.cheapfalconsjerseyssale.com

*Not enough memory – Free some memory. In real mode, ScanReg may require more memory, or high memory. especially if you have a huge Windows Registry. Use HIMEM.SYS in your Config.sys file to enable upper memory. ScanReg will not work in Safe Mode command prompt only! In protected mode, the Windows drive may be full.

Using the SREdit tool to edit the ScanReg.ini file

Using the ScanReg Editor (SREdit) makes it easy to customize ScanReg to include files in the daily backup that it makes. Just edit the file Scanreg.ini (found in \Windows) which even includes its own instructions. Click here for a sample. As an added safeguard, it would be a good idea to save copies of the the backups to another location, such as to another hard drive, or if possible maybe even to a CD-ROM disk.

As for the number of backups, you can change the default of 5 at the MaxBackupCopies to as few as 1 and as many as 99.

As a reminder, Scanreg /restore must be run from an MS-DOS prompt in order to restore a previously backed-up registry. In addition, during the restoration process ScanReg will only show the first 5 (the 5 oldest) backups. You can work around this by moving a number of these backups to another folder or disk, or deleting some older ones.

Another option you have is to perform the restoration manually at the command line in order to extract the backup you need.

Note: As for the number of additional files you can add to the CAB file, there is a limit of 15.

As you can see from this example, using SREdit is rather straight forward.

Can’t find this a handy utility called SrEdit? Download it here

Important Cautions about ScanReg:

You must not back up core configuration files using the Emergency Recovery Disk (ERD) utility and/or the Configuration File Backup (CfgBack) utilities from the Windows 95 compact disc. If you use these Windows 95 utilities to backup Windows 98 Registry entries and attempt to restore them to the Windows 98 system, the computer will not boot.

Note: If you make any changes to the system after you made the backup of the registry, these changes will not be restored when you restore the older registry from backup.

Microsoft Knowledge Base Article Q245147.

When you configure Windows to use user profiles and run the Windows Registry Checker tool (Scanreg.exe) to back up the computer registry, the User.dat files that are associated with each profile are not backed up.

Scanreg.exe Does Not Back Up User.dat Files When Using User Profiles In Windows 98

Problem
When you configure Windows to use user profiles and run the Windows Registry Checker tool (Scanreg.exe) to back up the computer registry, the User.dat files that are associated with each profile are not backed up.

Cause
This occurs because the User.dat file associated with a user’s profile is located in the C:\Windows\Profiles\username folder when you configure Windows to use user profiles. Scanreg.exe backs up the User.dat file from the Windows folder, not each individual C:\Windows\Profiles\username\User.dat file.

Possible Resolution
To completely back up the computer registry, make a manual backup of the C:\Windows\Profiles\username\User.dat file as follows:

  1. Click Start, point to Find, and then click Files or Folders.
  2. In the Named box, type user.dat, and then click Find Now.
  3. In the list of files returned, right-click the User.dat file that is in the C:\Windows\Profiles\username folder, click Copy, right-click a blank space on your desktop, and then click Paste.
  4. Repeat steps 1-3 for all other users of the computer, and then copy the files to a disk or other removable media for safe keeping.

Possible Error Messages

When you use the scanreg /restore command at a command prompt in MS-DOS mode to restore the registry, you may receive an error message stating that the registry was not restored.

Microsoft Knowledge Base Article Q228779

The SCANREG /RESTORE Command May Not Restore the Registry

Problem
When you use the SCANREG /RESTORE command at a command prompt in MS-DOS mode to restore the Windows Registry, you may receive an error message stating that the registry was not restored.

Cause
This can occur if a third-party program (such as Norton Unerase) has the drive’s disk access locked.

Possible Resolution
You can try and work around this problem as follows:

  1. Restart your computer and then Press and hold down the CTRL key until the Startup menu appears.
  2. Now choose Step-by-Step Confirmation, and load only Himem.sys. Press N for all other prompts. If for some reason Himem.sys is not available, you will need to insert the DEVICE=HIMEM.SYS command at the very top of your config.sys file.
  3. Now try running the SCANREG /RESTORE command again.

According to Microsoft, this behavior is by design.

Note #1: Himem.sys is not required to run Scanreg.exe, but is required for Scandisk.exe and other tools that may be needed.

Note #2: It may not be safe to unlock the drive.

Back to our Knowledge Center? Click Here

This page updated: 2/18/2001

About Dewwa Socc

Sahifa Theme License is not validated, Go to the theme options page to validate the license, You need a single license for each domain name.