There are occasions where someone will use Powershell and type in a command and the command will fail with an error and not display anything back to you. Being that Powershell has been written in the .net framework we can capture error conditions by using the System.Exception Class object. The System.Exception class represents errors that occur during application execution.
If you suspect that your Powershell commands are failing with an exception, all you need to type the commands below in the order listed below:
Example:
1. Run your Powershell command: Get-PublicFolder2. Set your parameter to capture your error:
$e = $error[0]$e.Exception.StackTrace$e.Exception.InnerException$e.Exception.InnerException.StackTrace
Here is what you can except to see:
[PS] c:\>Get-PublicFolder[PS] c:\>$e.Exception.InnerExceptionMapiExceptionUnknownUser: Unable to make connection to the server. (hr=0x80004005, ec=1003)
Diagnostic context:Lid: 23065 EcDoConnectEx called [length=160]Lid: 17913 EcDoConnectEx returned [ec=0x3EB][length=56][latency=0]Lid: 19778Lid: 27970 StoreEc: 0x3EBLid: 17730Lid: 25922 StoreEc: 0x3EB
Using the err.exe (Microsoft Exchange Server Error Code Look-up Tool) you can look up both error codes:
C:\err.exe 0x80004005# for hex 0x80004005 / decimal -2147467259ecError ec.hMAPI_E_CALL_FAILED mapicode.hSTIERR_GENERIC stierr.hE_FAIL winerror.h# Unspecified error
Dave
PingBack from http://www.artofbam.com/wordpress/?p=3456
Microsoft Exchange Hosted Services: What are the real benefits? Exchanging Your Old Outlook for the New