2 ways to query for error number information in PowerShell _powershell

Source: Internet
Author: User
Tags error code

Sometimes, some local commands, such as Net.exe, return an error message in the form of a number in the course of execution. It's depressing that we don't know what these numbers mean. Previously, we could use the following methods to get the information that the numbers represent:

Copy Code code as follows:

ps> NET helpmsg 3534
The service did not a error.

ps> NET HELPMSG 1
Incorrect function.

ps> NET helpmsg 4323
The transport cannot access the medium.


In fact, there is a better way, that is, using winrm.exe, it can not only achieve the above functions, but also more powerful! Again, look at the translations of the top three errors:
Copy Code code as follows:

ps> WinRM helpmsg 3534
The service did not a error.

ps> WinRM helpmsg 1
Incorrect function.

ps> WinRM helpmsg 4323
The transport cannot access the medium.


OK, see, the result is the same. In fact, Net.exe can only translate the error message within a particular specification (specifically how a particular specification, Hongo is not very clear), and Winrm.exe is more powerful, such as it can convert "specific remote" error codes:
Copy Code code as follows:

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 can be seen above, winrm.exe correct translation of the 0X80338104 error message, and Net.exe did not do so. In fact, this command may not be directly related to PowerShell, but it is a shell command, we can use it to translate any low-level API error code, and firmly believe that the results of it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.