Converting Low-Level Error Numbers into Help Messages

by May 16, 2013

Sometimes, native commands such as net.exe return cryptic error numbers instead of full error messages. Traditionally, you could use the following command to convert these error numbers into full messages:

PS> net helpmsg 3534
The service did not report an error.
PS> net helpmsg 1
Incorrect function.
PS> net helpmsg 4323
The transport cannot access the medium.

A better way may be to use winrm.exe because this command can do the very same – and more:

PS> winrm helpmsg 3534
The service did not report an error.
PS> winrm helpmsg 1
Incorrect function.
PS> winrm helpmsg 4323
The transport cannot access the medium.

While net.exe can only convert a certain range of error messages, winrm.exe is more flexible and can for example also convert Remoting-specific error codes:

PS> winrm helpmsg 0x80338104
The WS-Management service cannot process the request. The WMI service returned an 'access denied' error.
PS> net helpmsg 0x80338104
The syntax of this command is:

NET HELPMSG
message#

As you see, winrm.exe returns the correct error message whereas net.exe falls back to a standard template and cannot translate the number. Winrm.exe therefore is the more generic approach that you can safely use to translate any low-level API error code to text.

Twitter This Tip! ReTweet this Tip!