adm391 effective microsoft® windows® troubleshooting with the sysinternals tools david solomon...

55
ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals Software

Upload: lydia-sharp

Post on 23-Dec-2015

253 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

ADM391Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David SolomonDavid Solomon Expert Seminars

Mark RussinovichWinternals Software

Page 2: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Agenda

Introduction

Identifying Processes

Application Failures

Page 3: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

About The Speakers

Authors of:Inside Windows 2000, 3rd Edition(Microsoft Press)Inside Windows 2000/XP/2003 Interactive Internals Video Tutorial

Used by Microsoft for worldwide internal training

David Solomon:Teaches Windows internals classes (www.solsem.com)Writes books and articles on Windows internals

Mark Russinovich:Author of tools on www.sysinternals.comCo-founder and Chief Software Architect for Winternals Software (www.winternals.com)Teaches Windows internals classesWrites books and articles on Windows internals

Page 4: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Troubleshooting TopicsThings we will address:

Identifying processes and unexplained CPU activity

Application failuresRegistry issues

Permission problems

DLL version mismatches

Things we aren’t covering:Crash dump (blue screen) analysis

Performance analysis

Network problem analysis

Page 5: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Sysinternals ToolsAll freeware

Downloadable from www.sysinternals.com

Some tools include source

Tools updated frequentlyCheck the site regularly or subscribe to Sysinternals newsletter

Tools we will use:Process Explorer – view process details

Filemon – monitors file I/O

Regmon – monitors registry I/O

Strings – dumps printable strings in files

~50 other Sysinternals tools on web site

Page 6: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Agenda

Introduction

Understanding Process Activity

Application Failures

Page 7: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

The CPU Is Busy – Why?

System is busy (may be slow)

What is running?A user or system process?

Interrupt activity?

What’s it doing?File I/O? Network I/O? Registry calls?

Application code?

Page 8: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Which Process Is Running?Determine which process’ threads are consuming the most CPU time

Quick method:Open Task Manager

->Processes

Sort processes by “CPU” usage column

Other toolsQslice.exe (Resource Kit)

Performance Monitor (monitor %Processor Time counter in process object for all processes)

Page 9: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Task Manager: Applications vs. Processes

Applications tab: List of top level visible windows

Windows are owned by threads

Right-click on a window and select “Go to process”

Processes tab: List of processes

Can configure with View->Select columns

““Running” means Running” means waiting for window waiting for window messagesmessages

Page 10: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Identify The ImageOnce you’ve found the process of interest, what is it?

Sometimes name of .EXE identifies clearly (e.g., Winword.exe)

Often, it doesn’t since Task Manager doesn’t show the full path of the image

We need more information!

Page 11: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Process Explorer“Super Task Manager”

Shows full image path, command line, environment variables, parent process, security access token, open handles, loaded DLLs & mapped files

Page 12: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Process ExplorerProcess tree

If left justified, parent has exited

Disappears if you sort by any columnBring back with View->Show Process Tree

Additional details in process listIcon and description (from .EXE)

User Name shows which security database account is from (e.g. which domain)

Highlight Own, Services Processes

Differences highightingGreen: new, Red: gone

View->Update speed->Paused

Page 13: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Process PropertiesImage tab:

Description, company name, version (from .EXE)Full image pathCommand line used to start processCurrent directoryParent processUser nameStart time

Performance tab:Basic process CPU/memory usage

Security tab:Access token (groups list, privilege list)

Environment tab: environment variablesServices tab (only for service processes):

List of services hosted by processCompare XP “tasklist /svc” with details Process Explorer shows

Page 14: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Process Explorer Demo

1. Double click on date/time in task bar (lower right of screen)

2. In Process Explorer, hit F5 to refresh

3. Find new process created (RUNDLL32.EXE)

4. Examine command line arguments

Page 15: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Handle View

Lower half of display shows either:Open handles

Loaded DLLs & mapped files

Handle ViewSuggestion: sort by type or path column

Objects of type “File” and “Key” are most interesting for general troubleshooting

Can view the state of synchronization objects (mutexes, semaphores, events)

By default, shows named objectsClick on Options->Show Unnamed Objects

Page 16: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Uses of Handle View

Solve file locked errorsUse the search feature to determine what process is holding a file or directory open

Can even close an open files (be careful!)

Detect handle leaks using refresh difference highlighting

Understand resources used by an application

Files

Registry keys

Page 17: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Using Handle Table to Identify a Process

What if image properties say nothing?

Examine open handlesOpen files or registry keys may give a clue

Page 18: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

DLL ViewClick on View->DLL View

Shows more than just loaded DLLs

Includes .EXE and any “memory mapped files”High speed file access mechanism

Makes file appear as virtual memory

Uses:Detect DLL versioning problems

Compare the output from a working process with that of a failing one (use File->Save As)

Find which processes are using a specific DLL (search for it)

Show Relocated DLLs optionHighlights relocated DLLs in yellow

Page 19: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Process Explorer: DLL Lab1. Run Word XP2. In ProcExp, click File->Save As and save the DLL view of

WinWord in a text file3. Exit Word4. In Explorer, navigate to c:\Program Files\Common Files\

Microsoft Shared\Office10\10335. Rename msointl.dll as msointl.dll.good6. Copy dwintl.dll to msointl.dll7. Try and start Word XP8. With the message box from Word still showing, go to

ProcExp & save DLL view of failing Word process9. Edit both DLL view .txt files to eliminate process list (just

leave DLL list)10. Run Windiff and compare the two DLL views to determine

the problem

Page 20: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

DLL to Change to Break Various Word Versions

Office 97\Program Files\Microsoft Office\OfficeReplace mso97.dll with msain800.dll

Office 2000\Program Files\Microsoft Office\Office\1033Replace MSO9INTL.DLL with OUTLLIBR.DLL

Office XP\Program Files\Common Files\Microsoft Shared\Office10\1033Replace msointl.dll with dwintl.dll

Page 21: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Access Denied on Mapped Files

Attempting to delete a DLL or EXE that is in use gets “access denied”, not “file locked”

Example: try and delete Notepad.exe while you’re running it

Can be misleading

If this occurs, and it’s not due to permissions problems, simply search DLL list with Process Explorer for file

Page 22: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Agenda

Introduction

Identifying Processes

Application Failures

Page 23: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Troubleshooting Application Failures

Most applications do a poor job of reporting file-related or registry-related errors

E.g. permissions problems

Missing files

Missing or corrupt registry data

Page 24: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Troubleshooting Application Failures

When in doubt, run Filemon and Regmon!Filemon monitors File I/O; Regmon monitors registry I/O

Ideal for troubleshooting a wide variety of application failures

Also useful for to understand and tune file system access

E.g. understanding hard drive activity

Page 25: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Using Regmon/Filemon

Two basic techniques:Go to end of log and look backwards to where problem occurred or is evident and focused on the last things doneCompare a good log with a bad log

Often comparing the I/O and Registry activity of a failing process with one that works may point to the problem

Have to first massage log file to remove data that differs run to run

Delete first 3 columns (they are always different: line #, time, process id)

Easy to do with Excel by deleting columns

Then compare with FC (built in tool) or Windiff (Resource Kit)

Page 26: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

File I/O Activity

Sometimes, applications perform needless file I/O

Run Filemon to see how “quiet” your system is when you think nothing is going on

Some applications perform inefficient file I/OMay be due to libraries used in application that indirectly cause needless I/O

Page 27: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Filemon Demo

1. Run Filemon

2. Set filter to only include Notepad.exe

3. Run Notepad

4. Type some text

5. Save file as “test.txt”

6. Go back to Filemon

7. Stop logging

8. Set highlight to “test.txt”

9. Find line representing creation of new file Hint: look for create operation

Page 28: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Example Problem

While typing in the document Word XP closes without any prompts

See filemon-lab2.log and try and determine why

Go to end of Filemon log and search backwards for Winword.exe

Stop at first unexplainable activity

Page 29: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Solution: Filemon Example

Working backwards, the first “strange” or unexplainable behavior are the constant reads past end of file to MSSP3ES.LEX

User looked up what .LEX file wasRelated to Word proofing tools

Uninstalled and reinstalled proofing tools & problem went away

Page 30: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Example Problem

Excel reports an error "File Not Found" when starting

Sometimes when clicking OK, Excel would work fine. Other times Excel would close when OK was clicked.

See filemon-lab3.log

Page 31: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

SolutionGo to the last thing Excel did (search from bottom for Excel.exe)

Excel is opening a file in the \XLstart folder

Files in this folder get opened by Excel automatically upon startup

The file F:\OFF97PRO\Office\XLStart\59403E20 turned out to be some random file (not an XLS) that caused Excel to die

Removing the file eliminated the problem

Page 32: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Permission Problems

Many applications don’t report access denied errors wellExample:

1. In Explorer, create a folder c:\noaccess2. Remove all rights to the folder3. Run Notepad & type some text4. Run Filemon – set filter to Notepad.exe5. In Notepad, File->Save As to c:\noaccess\

test.txt Note error reported

6. Look at Filemon trace and find Access Denied

Page 33: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Example: Access DeniedFor example, an Outlook application failed with this error:

Ran Filemon and found it was getting Access Denied

Someone had misread a request to remove EDIT rights and removed all rights

Page 34: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Example: Access Denied

AOL reported this error:

Filemon showed this:

User did not have admin rights to AOL directory

waol.exe OPEN C:\PROGRA~1\AMERIC~1.0\IDB\main.ind ACCESS DENIEDwaol.exe OPEN C:\PROGRA~1\AMERIC~1.0\IDB\main.ind ACCESS DENIED

Page 35: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Understanding Disk ActivityPerformance counters show which disks are being hit, but not which files

Filemon pinpoints which file(s) are being accessed and how frequently

Example: used Filemon on a server to determine which file(s) were being accessed most frequently

Imported into Excel and make a pie chart by file name or operation type

Moved these files to a different disk on a different controller

Page 36: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

DLL ProblemsProcess Explorer may solve a DLL versioning issue, but may not if:

A DLL is missing

The order of DLL loads is relevant

So, use Filemon!Look at the last DLL opened before the application died

Compare the startup of a working with a failing application

Missing or inaccessible DLLs often not reported correctlyLook for “NOTFOUND” or “ACCESS DENIED”

May be opening wrong versions due to wrong versions being in folders in PATH

Page 37: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Example Problem: Word Dies

Word97 starts and a few seconds later gets a Dr. Watson (access violation)

Customer tried re-installing Office – still failed

Solution:Ran Filemon, looked at last DLL loaded before Dr. Watson

It was a printer DLL

Uninstalled printer – problem went away

Page 38: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Example Problem: Help Fails

The Help command in an application failed on Win95, but worked fine on Win98/ME/NT4/Win2000/WinXP

Failed with meaningless error message

Page 39: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

SolutionRan Filemon on failing system and working system

Reduced log to file opensCompared logs

At the point they diverged, looked backwards to last common thing done

An OLE system DLL was loadedNoticed this OLE DLL was loaded from a directory in the user’s PATH on Win95, but from \Windows\System on other versions

Conclusion:DLL loaded on Win95 system was not for Win95Got proper version for Win95, problem went away

Page 40: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Filemon Example: Access Hangs

Problem: Access 2000 would hang when trying to import an Excel file

Worked fine on other users’ workstations

User had Access 97 and Access 2000 installed

Compare c:\lab\filemon-lab4-good.log with filemon-lab4-bad.log

Page 41: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Solution: Access Hangs

Failing system was loading an old Access DLL from \winnt\system32 due to having installed Access 97 previously

First unexplainable difference was that Accwiz.dll was being loaded from two different directories

Removed DLL in \winnt\system32 and problem went away

Page 42: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Configuration ProblemsMissing, corrupted or overly-secure Registry settings often lead to application crashes and errors

Some applications don’t completely remove registry data at uninstall

Regmon may yield the answer…

Page 43: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Registry Activity

Normally, registry activity should be only at application/system startup and exit

But, sadly, lots of processes perform needless registry querying…

Try running Regmon to see how “quiet” your registry is

Page 44: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Using Regmon

Sometimes queries to what is not there is more interesting than what is there

Identify missing Registry keys

Search for status “NOTFOUND”

Find incorrect or corrupt data

Examine values read and/or written (in Other column)

Troubleshoot permission problems

Search for status “ACCESS DENIED”

Page 45: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Regmon Applications

If you suspect registry data is causing problems, rename the key and re-run the application

Most applications re-create user settings when run

In this way, the data won’t be seen by the application

Can always rename the key back

Page 46: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Example Problem

Internet Explorer failed to start with this error:

See c:\lab\regmon-lab2.log

Page 47: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Solution

Looked backwards from end of Regmon log

Last queries were to: HKCU\Software\Microsoft\Internet Connection Wizard

Looked here and found a single value “Completed” set to 0

Compared to other users—theirs was 1

Set this manually to 1 and problem went away

Page 48: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Example Problem

Problem:User somehow disabled all toolbars and menus in Word

No way to open files, change settings etc.

Solution:With Regmon, captured startup of Word

Found location of user-specific settings for Word

Deleted this Registry key

Re-ran Word, which re-created user settings from scratch

Page 49: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Example ProblemInternet Explorer hung when started

Default internet connection was set, but wasn’t being dialed

Dialing the connection first manually and then running IE worked

Background information:User had previously installed the AT&T Dialer program, but had uninstalled it and created dial up connection manually

Page 50: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Solution

Ran Regmon

Looked backwards from end (at the point IE was hung)

Found references to ATT under a PhoneBook key

Renamed ATT key and problem went away

Conclusion: registry junk was left from uninstall

Page 51: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Filemon/Regmon as a ServiceSometimes need to capture I/O or registry activity during the logon or logoff process

E.g. errors occurring during logon/logoffSolutions:

Install and run Filemon/Regmon as a service using Srvany tool in Resource Kit

Can configure to start at system bootFor a quick, one-time execution, run Filemon/Regmon with “psexec –s –i”

In either case, but tools remain running after logoff

Page 52: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

For More Info...

Visit the Sysinternals web site for frequent updates and new toolsSubscribe to the Sysinternals newsletter to get information on Windows internals and Sysinternals tool updatesTake our advanced internals and troubleshooting class or check out our videos (see www.solsem.com) Get the next edition of our book (to be called Windows Internals 4th edition)

Will cover advanced troubleshooting

To release end of calendar 2003

Page 53: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

Community Resources

Community Resourceshttp://www.microsoft.com/communities/default.mspx

Most Valuable Professional (MVP)http://www.mvp.support.microsoft.com/

NewsgroupsConverse online with Microsoft Newsgroups, including Worldwidehttp://www.microsoft.com/communities/newsgroups/default.mspx

User GroupsMeet and learn with your peershttp://www.microsoft.com/communities/usergroups/default.mspx

Page 54: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

evaluationsevaluations

Page 55: ADM391 Effective Microsoft® Windows® Troubleshooting with the Sysinternals Tools David Solomon David Solomon Expert Seminars Mark Russinovich Winternals

© 2003 Microsoft Corporation. All rights reserved.© 2003 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.