Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Useful function when reporting errors

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 12-02-2006   #1 (permalink)
Jeffrey Snover [MSFT]
Guest


 

Useful function when reporting errors

Below is a function that I encourage you to add to your Profile files and
then use when reporting an error or ask a question about a exception you are
seeing. This function provides all the information we have about the error
message making it easier to diagnose what is actually going on.

function Resolve-Error ($ErrorRecord=$Error[0])
{
$ErrorRecord | Format-List * -Force
$ErrorRecord.InvocationInfo |Format-List *
$Exception = $ErrorRecord.Exception
for ($i = 0; $Exception; $i++, ($Exception = $Exception.InnerException))
{ "$i" * 80
$Exception |Format-List * -Force
}
}
Set-Alias rver Resolve-Error


--
Jeffrey Snover [MSFT]
Windows PowerShell Architect
Microsoft Corporation
This posting is provided "AS IS" with no warranties, no confers rights.



My System SpecsSystem Spec
Old 12-02-2006   #2 (permalink)
/\\/\\o\\/\\/ [MVP]
Guest


 

Re: Useful function when reporting errors

Enjoy :

PoSH>gwmi win32_product


IdentifyingNumber : {91057632-CA70-413C-B628-2D3CDBBB906B}
Name : Macromedia Flash Player 8 Plugin
Vendor : Macromedia
Version : 8.0.22.0
Caption : Macromedia Flash Player 8 Plugin

Get-WmiObject : Generic failure
At line:1 char:5
+ gwmi <<<< win32_product


PoSH>Resolve-Error


Exception : System.Management.ManagementException: Generic
failure
at
System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus
errorCode)
at
System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext()
at
Microsoft.PowerShell.Commands.GetWmiObjectCommand.BeginProcessing()
TargetObject :
CategoryInfo : InvalidOperation: ( [Get-WmiObject],
ManagementException
FullyQualifiedErrorId :
GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo





MyCommand : Get-WmiObject
ScriptLineNumber : 1
OffsetInLine : -2147483648
ScriptName :
Line : gwmi win32_product
PositionMessage :
At line:1 char:5
+ gwmi <<<< win32_product
InvocationName : gwmi
PipelineLength : 1
PipelinePosition : 1



00000000000000000000000000000000000000000000000000000000000000000000000000000000


ErrorInformation : System.Management.ManagementBaseObject
ErrorCode : Failed
Message : Generic failure
Data : {}
InnerException :
TargetSite : Void
ThrowWithExtendedInfo(System.Management.ManagementStatus)
StackTrace : at
System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus
errorCode)
at
System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext()
at
Microsoft.PowerShell.Commands.GetWmiObjectCommand.BeginProcessing()
HelpLink :
Source : System.Management

Greetings /\/\o\/\/

----- Original Message -----
From: "Jeffrey Snover [MSFT]" <jsnover@ntdev.microsoft.com>
Newsgroups: microsoft.public.windows.powershell
Sent: Saturday, December 02, 2006 7:17 PM
Subject: Useful function when reporting errors


> Below is a function that I encourage you to add to your Profile files and
> then use when reporting an error or ask a question about a exception you
> are seeing. This function provides all the information we have about the
> error message making it easier to diagnose what is actually going on.
>
> function Resolve-Error ($ErrorRecord=$Error[0])
> {
> $ErrorRecord | Format-List * -Force
> $ErrorRecord.InvocationInfo |Format-List *
> $Exception = $ErrorRecord.Exception
> for ($i = 0; $Exception; $i++, ($Exception = $Exception.InnerException))
> { "$i" * 80
> $Exception |Format-List * -Force
> }
> }
> Set-Alias rver Resolve-Error
>
>
> --
> Jeffrey Snover [MSFT]
> Windows PowerShell Architect
> Microsoft Corporation
> This posting is provided "AS IS" with no warranties, no confers rights.
>
>


My System SpecsSystem Spec
Old 12-02-2006   #3 (permalink)
Keith Hill [MVP]
Guest


 

Re: Useful function when reporting errors

"Jeffrey Snover [MSFT]" <jsnover@ntdev.microsoft.com> wrote in message
news:47E75AF0-A7D5-4D1C-BDCC-3368799A1BFC@microsoft.com...
> Below is a function that I encourage you to add to your Profile files and
> then use when reporting an error or ask a question about a exception you
> are seeing. This function provides all the information we have about the
> error message making it easier to diagnose what is actually going on.
>
> function Resolve-Error ($ErrorRecord=$Error[0])
> {
> $ErrorRecord | Format-List * -Force
> $ErrorRecord.InvocationInfo |Format-List *
> $Exception = $ErrorRecord.Exception
> for ($i = 0; $Exception; $i++, ($Exception = $Exception.InnerException))
> { "$i" * 80
> $Exception |Format-List * -Force
> }
> }
> Set-Alias rver Resolve-Error


Any objections to me adding this to the PowerShell Community Extensions
profile?

--
Keith


My System SpecsSystem Spec
Old 12-02-2006   #4 (permalink)
Jeffrey Snover [MSFT]
Guest


 

Re: Useful function when reporting errors

> Any objections to me adding this to the PowerShell Community Extensions
> profile?

Absolutely none.
--
Jeffrey Snover [MSFT]
Windows PowerShell Architect
Microsoft Corporation
This posting is provided "AS IS" with no warranties, no confers rights.


My System SpecsSystem Spec
Old 12-02-2006   #5 (permalink)
Jeffrey Snover [MSFT]
Guest


 

Re: Useful function when reporting errors

Generic errors are 0X8004001 errors:
From:
http://blogs.msdn.com/wmi/archive/20...12/596266.aspx
4. Can you shed some more light on why WMI returns an 0x8004001 error
so frequently?


WMI returns a large number of error codes. Despite the fact that this series
of error codes covers many specific situations, there are still cases that
don't fall into a pre-defined category. Cases out of these pre-defined
categories generally return the 0x8004001 error code. After 10 years of
experience deploying WMI (WMI has existed since the NT 4.0 era as a download
from the Web), the number of cases outside of the pre-defined categories has
increased with exposure. During the design of the WMI core infrastructure 10
years ago, most of these cases didn't exist or were minimal and considered
as edge cases. In this context, WMI has been obviously improved in many
areas. However, it is very complex and risky to revamp the error management
sub-system while maintaining a 100% backward compatibility with existing
applications. This explains why WMI still returns such a type of "generic"
error today.





--
Jeffrey Snover [MSFT]
Windows PowerShell Architect
Microsoft Corporation
This posting is provided "AS IS" with no warranties, no confers rights.


My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Reporting Notification 3010 or 3014 errors Tristan Virtual Server 2 08-13-2008 08:48 AM
Errors, errors and more errors - I have Issues! E-Star Vista performance & maintenance 2 07-19-2008 11:41 AM
explorer errors, program errors, no task manager EmilyD Vista performance & maintenance 3 11-13-2007 09:14 PM
Bug Reporting? Abbe Vista file management 8 06-12-2007 10:58 AM
BUG: Redirecting function contents to a file truncates function lines at the width of the console Adam Milazzo PowerShell 2 08-11-2006 10:58 PM


Update your Vista Drivers Update Your Drivers Now!!

Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008