Operating Systems: Commands and Options To Troubleshoot and Resolve Problems
Operating Systems: Commands and Options To Troubleshoot and Resolve Problems
Operating Systems
Commands And Options To Troubleshoot And Resolve Problems
MSCONFIG
DIR, MD / CD / RD
CHKDSK (/f /r)
EDIT
COPY (/a /v /y) and XCOPY
FORMAT
IPCONFIG (/all /release /renew), PING (-t -l), TRACERT, NSLOOKUP
NET
[command name] /?
SFC
1
Commands for Troubleshooting
You can reach CMD by selecting;
Start >> All Programs>> Accessories >>Command Prompt.
Or
Start >> Run, type CMD.
CMD is a command (cmd.exe) which opens the command prompt window. To return to Windows, type
EXIT and press Enter.
CD (Change Directory) utility changes your current directory to the one given.
An absolute path gives the full path regardless of the directory you’re currently in (for example,
C:\Documents and Settings\All Users).
A relative path tells the utility to change you to a location relative to where you currently are. For
example, if you’re in the C:\Documents and Settings directory, you can move to C:\Documents and
Settings\all users by giving the command CD all users.
With relative addressing, you can use two periods (..) to indicate the parent directory or one period (.) to
indicate the present directory.
CHKDSK command are /F and /R, which fix/repair the errors they find.
COPY Copies files from one location to another. Here are some examples:
COPY *.* D:\ copies all files from the current folder to the D: drive (an asterisk is a wildcard for
any character.)
2
The COPY Switches
Switch Description
DIR /w displays the listing in wide (multicolumn) format, with names only (fewer details).
DIR /p displays the listing one screenful at a time. Press Enter to see the next screenful.
Switch Description
3
FORMAT Prepares media for use by applying a certain filesystem to it. It’s located in the
C:\Windows\System32 folder
Switch Description
/F:size Specifies the formatted size for a floppy disk; omit for default
/B Allocates space on the formatted disk for system files to be added later
You can also access a Format utility by right-clicking a drive icon in Windows and selecting Format.
HELP or /? used to give you the syntax and a short description of any command-line utility you
want information on.
IPCONFIG /all Shows all the information related to the network card(s), not just the summary
information
IPCONFIG /release renew releases renew the IP address leased from a DHCP server.
If the address displayed falls in the 169.254.x.x category, that means the client was unable to reach the
DHCP server and has defaulted to Automatic Private IP Addressing (APIPA), which will prevent it from
communicating outside its subnet.
4
MD Make Directory is used as the name implies.
NET The capabilities of it differ based on whether it is server- or workstation-based and the version
of the OS
Purpose Syntax
5
Create a share NET SHARE
Set the time to that of another computer NET TIME
Connect to a share NET USE
Add, delete, and see information about a user NET USER
See available resources NET VIEW
These commands are invaluable troubleshooting aides when you cannot get the graphical interface to
display properly. You can also use them when interacting with hidden ($) and administrative shares that
do not appear in the graphical interface.
The NET command used with the SHARE parameter enables you to create shares from the command
prompt, using this syntax: To share the C:\John directory as SALES, you would use the following
command:
Parameter Function
PING To check a particular IP address or domain name on a network for reachability. It sends a
series of packets to another system, which in turn sends back a response. This utility can be
extremely useful for troubleshooting problems with remote hosts.
You can use the -t switch to indicate PING should continue to ping the host without stop- ping
until you break out of it (using Ctrl+C).
RD To delete/remove a directory.
You cannot delete a directory that has files in it without using the /S parameter.
6
SFC (System File Checker) To keep the OS alive and well.
SFC automatically verifies system files after a reboot to see if they were changed to unprotected
copies. If an unprotected file is found, it’s overwritten by a stored copy of the system file from
%systemroot%\system32\dllcache. (%systemroot% is the folder into which the OS was installed.)
Parameter Function
Execute the TRACERT hostname, where hostname is the computer name or IP address of the computer
whose route you want to trace.
TRACERT provides a road map of all the routing an IP packet takes to get from host A to host B.
TRACERT returns the different IP addresses the packet was routed through to reach the final destination
TRACERT returns the number of hops and amount of time required for each routing hop.
XCOPY This command is like COPY, but it also duplicates any subfolders.
7
MS Windows Directory Structures
1. User Files
The user account (which authenticates
the user) and the user profile (which
holds their settings theme, screen saver,
and so on) are two separate things—one
is needed before the other.
The folder of user account is beneath %systemdrive%\Users\ (usually C:\Users\) in Windows Vista/7.
For Windows XP/2000 it is beneath %systemdrive%\Documents and Settings\ (usually C:\Documents
and Settings\).
When settings need to apply to everyone who uses the machine, they can be placed in All Users instead
of being copied beneath each user’s folder set.
2. System Files
Are those used by the OSes and are used by all users. In all the OSes, these files are beneath
%systemroot% and many, such as System32, appear in the default path.
3. Fonts Files
Fonts folder is under %systemroot% (usually C:\). Fontmapper is the routine within Windows that maps
an application’s request for a font with particular characteristics to the available font that best matches
those characteristics.
4. Temporary Files
Is to hold any information that is needed for only a short time. In addition to temporary files used for
print queues, you also have cache from Internet sites and many other programs. We can use Disk
Cleanup utility, to delete temporary files, including the following:
Downloaded program , Offline web pages, Office setup , Recycle Bin contents, Setup log , Web
client/publisher temporary , Temporary offline , and Offline and Catalog files for the Content
Indexer
8
5. Program Files
Is beneath %systemdrive% (usually C:\), holds the files needed for each of the installed applications on a
machine. Windows Vista also added a Program Data directory, which is hidden by default. It contains the
settings needed for applications and works similar to how the Local Settings folder did in previous OSes.
6. Offline Files
If you've ever needed to access important files stored in a shared folder on your network but couldn't
because your laptop was disconnected from the network, then you can understand the need for offline
files. With offline files, you can access copies of your network files even when your computer isn't
connected to the network.
You can access local copies of network files when you're not
connected to the network.
Windows 2000
You can choose to do the synchronization between the copy and the original manually (in Explorer,
choose File >> Synchronize) or automatically (you log on and log off).
Windows XP
First, you must turn on. To do so, open My Computer and
then choose Folder Options from the Tools menu. When
the Properties dialog box appears, click the Offline Files tab
and check the Enable Offline Files option, you cannot
enable offline files if Fast User Switching is enabled.
9
To disable offline file storage, uncheck the Enable Offline Files option.
Windows Vista
The two biggest modifications are the inclusion
of the Sync Center and the restriction of offline
file support to the Business, Enterprise, and
Ultimate versions. If you do not have one of
these versions, you will not have the ability to
access the Offline Files tab or do any
configuration.
Note :
You cannot sync with network folders if you are using Windows Vista Starter, Home Basic, or Home
Premium editions.
Establish a partnership with the device you want to sync with in Sync Center.
10
System Utilities and Tools
With the Windows OSes, you can choose to use either FAT32 or NTFS. The advantage of NTFS is that it
offers security and many other features that FAT32 can’t handle. You can configure indexing, archiving,
encryption, and compression settings.
Disk-Management Tools
DEFRAG
The more files are read, added to, and rewritten, the more fragmentation (affecting performance) is
likely to occur. The Disk Defragmenter utility (DEFRAG) is the best tool for correcting fragmentation.
Disk Defragmenter reorganizes the file storage on a disk to reduce the number of files that are stored
noncontiguously. This makes file retrieval faster, because the read/write heads on the disk have to move
less.
You can go to Start menu (Start >> All Programs>> Accessories >>System Tools >>Disk Defragmenter).
The available switches for the command-line version (defrag.exe) include the following:
-a Analyze only
-v Verbose output
11
NTBACKUP
You can also perform backups from the command line by using the ntbackup.exe executable. You can’t
restore files from the command line with this utility, however. Options include the following:
/A Performs an append (adds the new backup to the end of the existing one).
/M Must be followed by a backup type name: copy, daily, differential, incremental, or normal.
/T Followed by the tape name, this specifies which tape to overwrite or append to.
The Backup utility in each of the different versions of Windows has different capabilities, with
newer versions having greater capabilities.
12
Disk Manager
Allows you to perform such actions as resizing a drive or changing the drive letter.
To access this tool, right-click on Computer (or My Computer). From the menu, choose Manage, and
then click Disk Management.
An active partition is the one that is bootable—the one that the OSes is installed on.
A primary partition is one that is used by the OS it may or may not be bootable.
An extended partition is used to hold files and is secondary to the primary. There can be only one
extended partition on a hard drive, but it can be further divided into logical drives.
Performance Tool
Windows XP/2000 is divided into two sections.
1. System Monitor allows you to gather real-time statistics about what the system is doing right
now in chart format (the default), histogram format (similar to a bar chart), or report format.
2. Performance Logs and Alerts let you record data to create and compare with a baseline (to
get a long-term look at how the system is operating) or to send administrative alerts when
thresholds are reached.
13
Administrative Tools
1. Event Viewer provides information about
what’s been going on system-wise, to help
you troubleshoot problems. Event Viewer
displays warnings, error messages, and
records of things happening successfully.
2. Computer Management is the shell that such tools as Disk Management plug in to; it is a
predefined Microsoft Management Console (MMC). It provides a common interface that allows you to
perform all the actions that can be done separately within one location.
Computer Management also has the Storage area, which lets you manage removable media,
defragment your hard drives, or manage partitions. Finally, you can manage system services and
applications.
1. System Monitor allows you to gather real-time statistics about what the system is doing right
now.
2. Performance Logs And Alerts let you record data to create and compare with a baseline (to get
a long-term look at how the system is operating) or send administrative alerts when thresholds are
reached. You can use this tool to identify problems with objects. If you want to watch memory, for
example, the object to monitor is Memory, and the counters to watch include the following:
Committed Bytes If this number always exceeds the physical RAM by more than a few
megabytes, you probably don’t have sufficient RAM.
Pages/Sec This number should be less than 100; a higher value mean the system is RAM
starved.
Note: You can also gather memory statistics by using Task Manager.
14
Device Manager
Shows a list of all installed hardware and lets you add items, remove items, update drivers, and more.
In Windows 2000/XP;
you display the System Properties >> Hardware >> Device Manager.
In Windows Vista;
You can choose Start >> Control Panel >> System And Maintenance, System >> Device
Manager. Or you right-click on Computer >> Manage >> Device Manager.
Task Manager
Shows running programs and the system resources they’re consuming. Its most often used to shut down
a nonresponsive application.
2. Right-click in an empty location on the Taskbar and choose Task Manager from the context menu.
15
System Information
System Restore
It allows you to restore the system to a previous point in time.
You can access it from Start >> All Programs >> Accessories >> System Tools >> System Restore and use
it to roll back to, as well as create, a restore point.
Windows XP creates a restore point automatically every 24 hours, as well as when you install
unsigned device drivers or install (or uninstall) a program with Windows Installer or Install Shield. By
default, restore points are kept for 90 days.
16
Remote Desktop and Remote Assistance.
Allows you to remotely connect to your workstation and use it for a variety of purposes—This utilizes
the Remote Desktop Protocol (RDP), and two elements are involved:
Remote Desktop.
To setup;
To access;
To connect;
You must enter the IP address or computer name of the host using a valid username and password.
Remote Assistance.
This can help an administrator or other support
person troubleshoot problems with the machine
from a remote location.
17
Task Scheduler
1. Select Start >> Programs (or All Programs) >>Accessories >> System Tools, and choose
Scheduled Tasks.
3. A list of applications appears. From the list, choose the application you want to run.
4. Specify how often the program is to run, and provide the name that you want to call the job—
Daily,weekly,monthly,one time only, when the computer starts and when you log on.
5. After choosing the frequency, you must specify parameters related to it.
6. Because the job will be running in unattended mode, you must provide the name and password
of a user who has authorization to run this job.
7. A verification screen shows what you have configured. Click Finish to complete the task.
Regional Settings
Allows you to customize the user location and keyboard layout.
18
Diagnostics and Troubleshooting
Startup
The programs to begin at startup can be configured through the msconfig.
For 2000/ XP - You can also Right-clicking the Start>>Open>>Programs And Startup (appear here are
few).
For Vista/7 - You can also Right-clicking the Start>>Properties>> Customise (appear here are few).
Recovering OSes
You’ll then arrive at a command prompt. You can give a number of commands from this prompt, two of
which are worth special attention: EXIT restarts the computer.
19
Recovery Console Commands
Command Purpose
ATTRIB Shows the current attributes of a file or folder, and lets you change them.
BATCH Runs the commands within an ASCII text file.
CD/CHDIR Used without parameters, it shows the current directory. Used with
parameters, it changes to the directory specified.
CHKDSK Checks the disk for errors.
CLS Clears the screen.
COPY Allows you to copy a file (or files, if used with wildcards) from one location
to another.
SYSTEMROOT Works like CD but takes you to the system root of whichever OS installation
you’re logged on to.
During the installation of the RC, a folder named Cmdcons is created in the root directory to hold the
executable files and drivers it needs. A file named Cmldr, with attributes of System, Hidden, and Read-
Only, is also placed in the root directory.
If you want to delete the RC, you can do so by deleting the Cmldr file and the Cmdcons folder, and
removing the entry from the Boot.ini file.
20
2. Automated System Recovery-ASR (Windows XP only)
It’s possible to automate the process of creating a system recovery set by choosing the ASR Wizard on
the Tools menu of the Backup utility.
You can click (Start >> All Programs >> Accessories >> System Tools >> Backup). This wizard walks you
through the process of creating a disk that can be used to restore parts of the system in the event of a
major system failure.
The default name of this file is BACKUP.BKF; it requires a floppy disk (becomes a bootable - which can
be weakness/hard to come by these days).
It require a blank, formatted floppy disk. If you don’t choose to save the Registry, the following files are
placed on the floppy disk: (The disk isn’t bootable)
If you check the box to include the Registry in the backup, the floppy disk contains the preceding
files plus the following:
The user profile (NTUSER.DAT) is for the default user; the files with the ._ extension are compressed
files from the Registry. The compression utility used is EXPAND.EXE, which offers you the flexibility of
restoring any or all files. Because this floppy contains key Registry files, it’s important that you label it
appropriately and store it in a safe location, away from users who should not have access to it.
During the process of creating the floppy, the Registry files are also backed up (in uncompressed state)
to %systemroot%\repair\RegBack.
As before, the floppy isn’t bootable, and you must bring the system up to a point (booted) where the
floppy can be accessed before it’s of any use.
ERD does not exist in Vista. The System Restore tab lets you disable/enable and configure the new
System Restore feature in Windows XP and Vista. If you have a system crash, it can restore your data
back to the restore point. You can turn on System Restore for all drives on your system or for individual
drives. Note that turning off System Restore on the system drive (the drive on which the OS is installed)
automatically turns it off on all drives.
21
Common Operational Problems
Printing Problems
Due to either improper configuration (driver- Local and Network) or actual physical problems.
Install proper driver.
You can also solve most problems using the Printing Troubleshooter (select Start >> Help and
Support, and type in Printing Troubleshooter).
Auto-Restart Errors
If the system is automatically restarting, there is the possibility that it has a virus or is unable to continue
current operations.
Install virus-detection software on every client (as well as on the server).
Keep the definitions current, and run them often.
Occasionally, systems reboot when they have been updated. This is a necessary process, and users are
always given warning before the reboot is to occur.
System Lockup
The difference between a blue screen and a system lockup is whether the dump message that
accompanies a blue screen is present. With a regular lockup, things just stop working. As with blue
screens, these are mostly a thing of the past (the exception may be laptops, which go to hibernate
mode).
You can examine the log files to discover what was happening.
Driver Failure
Drivers are associated with devices, and you can access them by looking at the properties for the device
with the two or three most common tabs:
General Displays the device type, manufacturer, and location. It also includes text regarding
whether the device is currently working properly and a Troubleshooter button to walk you
through diagnostics.
22
Driver View information on the current driver and digital signer. Three command buttons allow
you to see driver details and uninstall or update the driver.
Resources Shows the system resources in use (I/O, IRQ, and so on) and whether there are
conflicts.
Application Failures
Common steps to try include closing all other applications and beginning this one, reinstalling
fresh, and checking to see whether the application works properly on another machine.
Event Viewer is the primary tool for finding problems and uncovering what is going on. Other issues that
can occur, however, include problems with booting and system failure.
Booting problems can occur with corruption of the boot files or missing components, and common error
messages include an invalid boot disk, inaccessible boot drive, or missing NTLDR file. Luckily, during the
installation of the operating system, log files are created in the %SystemRoot% and %SystemRoot
%\Debug folders (C:\WINNT for Windows 2000 and C:\WINDOWS for Windows XP and Windows Vista).
If you have a puzzling problem, look at these logs and see if you can find error entries there. With
Windows 2000, for example, the following six files are created:
Comsetup.log This log file holds information about the COM+ installation and any optional components
installed. Of key importance are the last lines of the file, which should always show that the setup
completed. If the last lines don’t show this, they depict where the errors occurred.
Mmdet.log This file is used to hold information relevant to the detection of multimedia devices and
ports. On most systems used for business, this file is very small and contains only a few lines.
Netsetup.log This file differs from all the others in that it’s in the DEBUG folder and not just
%SystemRoot%. Entries in it detail the workgroup and domain options given during installation.
Setupact.log Known as the Action log, this file is a chronological list of what took place during the
setup. There is a tremendous amount of information here; of key importance is whether errors
occurred. The last lines of the file can show which operation was transpiring when the installation failed,
or whether the installation ended with errors. Like all the log files created during setup, this file is in
ASCII text format and can be viewed with any viewer (WordPad, Word, and so on).
23
Setupapi.log This file shows every line run from an INF file and the results. Not only is this file created
during installation, but it continues to get appended to afterward. Of key importance is whether the
commands are able to complete without error.
Setuperr.log The Error log, as this file is commonly called, is written to at the time errors are noted in
other log files. For example, an entry in Setupact.log may show that an error occurred, and additional
information on it will be found in Setuperr.log. Not only are the errors here, but also the severity of each
is given.
You can configure problems with system failure to write dump files (debugging information) for
later analysis when they occur by going to the System applet in Control Panel, choosing the Advanced
tab, and clicking Settings under Startup and Recovery. Here, in addition to choosing the default
operating system, you can configure whether events should be written to the system log, whether an
alert should be sent to the administrator and then type of memory dump to be written.
Diagnostic Tools
Safe Mode
If, when you boot, Windows won’t come all the way up (it hangs or is otherwise corrupted), you can
often solve the problem by booting into Safe Mode. Safe Mode is a concept borrowed from Windows 95
wherein you can bring up part of the operating system by bypassing the settings, drivers, or parameters
that may be causing it trouble during a normal boot. The goal of Safe Mode is to provide an interface
with which you’re able to fix the problems that occur during a normal boot and then reboot in normal
mode.
To access Safe Mode, you must press F8 when the computer starts/restarts or when the
operating system menu is displayed during the boot process if you have multiple operating systems
installed. A menu of Safe Mode choices will then appear, as listed in Table 8.7. Select the mode you
want to boot into.
Choice Loaded
Safe Mode With Networking Same as Safe Mode, but with networking
Safe Mode With Command Prompt Same as Safe Mode, but without the interface and
drivers/services associated with it
24
during any boot—normal attempted
Enable VGA Mode Normal boot with only basic video drivers
Last Known Good Configuration Uses the last backup of the Registry to bypass
corruption caused during the previous session
Return To OS Choices Menu Gives you an out in case you pressed F8 by accident.
This option only appears if you have installed multiple
operating systems and/or the Recovery Console
You need to keep a few rules in mind when booting in different modes:
If problems don’t exist when you boot to Safe Mode but do exist when you boot to normal mode, the
problem isn’t with basic services/drivers.
If the system hangs when you load drivers, the log file can show you the last driver it attempted to
load, which is usually the cause of the problem.
If you can’t solve the problem with Safe Mode, restore the Registry from the ERD to a state known to
be good. Bear in mind that doing so will lose all changes that have occurred since the last ERD was
made.
Is to keep the os alive and well. SFC.EXE automatically verifies system files after a reboot to see if they
were changed to unprotected copies. If an unprotected file is found, it’s overwritten by a stored copy of
the system file from %systemroot%\system32\dllcache. (%systemroot% is the folder into which the
operating system was installed.)
Only users with the Administrator can run SFC. It also requires the use of a parameter.
SFC Options
Parameter Function
25
/QUIET Replaces files without prompting
/SCANBOOT Checks system files on every boot
/SCANNOW Checks system files now
/SCANONCE Checks system files at the next boot
Indexing
Allow you to configure how the system caches
information that can speed up searches within
Windows. The index, when used, holds
information about files and their properties
(author, date modified, and so on)
Available from Control Panel>> Go to
Services, and stop Indexing Services.
Or Control Panel>>Indexing Option.
26
Sidebar.
It is a desktop gadgets.
Right-click on an area of it and choose Properties (if the Sidebar is not visible, click Start >> All
Programs >> Accessories >> Windows Sidebar).
Startup maintenance.
This will allow you to change the location, security, and other settings related to startup.
Using msconfig.
Right-click on Start >>Properties.
Right-click on Start >>All Program>>Properties.
Background processes
This will show you the processes of application running. Some of them aren't busy working on the
system.
using Task Manager.
Performance.
This will show you the visual effects, processor scheduling, memory usage and virtual memory.
using System Properties>>Advence>>Performances.
Review Questions
1. Which command-line utility displays or changes the attributes for one or more files?
2. You have opened a command window with CMD and now want to close it. What command
should you use to do this?
3. At the command line, what switch can be used with DIR to see the listing one screenful at
a time?
4. You are in the directory C:\Documents and Settings\Johny\photos. Where will the
command cd .. take you?
5. What is the command—and syntax—that should be used to change the G: drive from
FAT32 to NTFS without losing data?
7. Which type of backup copies only the files for which the archive bit is currently turned on,
and turns off the archive bit after the files are backed up?
10. What is the command used to install the Recovery Console from the CD?
27
28
Answers to Review Questions
3. DIR /P display the listing one screenful at a time. Press Enter to see the next screenful.
6. The command is MSCONFIG. You can start it by going to Start >> Run, and typing MSCONFIG.
7. An incremental backup copies only the files for which the archive bit is currently turned on.
After the files are backed up, the archive bit is turned off.
8. Windows XP creates restore points automatically every 24 hours, as well as when you install
unsigned device drivers or install (or uninstall) a program with Windows Installer or InstallShield.
9. Three ways of starting Task Manager were discussed in this chapter. One way to display the Task
Manager is to press Ctrl+Alt+Delete and click the Task Manager button (if needed). The second way
is to right-click an empty location on the Taskbar and choose Task Manager from the context menu.
The third method is to hold down Ctrl+Shift and press Esc. There are actually more than three. For
example typing taskmgr (or taskmgr.exe) will do the same in the Run dialog box or at the command
prompt.
29
30