Power shell learning notes (1) learn about the cmdlet

Source: Internet
Author: User
Windows powershell cmdlet

The cmdlet (read as "command-Let") is a single function command used to operate objects in Windows powershell. The name format can be used to identify the verbs and nouns separated by hyphens (-), such as get-help, get-process, and start-service.

In the traditional shellProgramThe command is an executable program from very simple (such as attrib.exe) to very complex (such as netsh.exe.

In Windows powershell, most cmdlets are simple and designed to be used together with other cmdlets. For example, the "get" cmdlet only retrieves data, the "set" cmdlet only creates or changes data, and the "format" cmdlet only sets the data format, the "out" cmdlet only directs the output to the specified target.

Each cmdlet has a Help file, which can be accessed by typing the following:

Get-help <cmdlet Name>-detailed

The detailed view of the cmdlet help file includes the cmdlet description, command syntax, parameter description, and examples of the usage of the cmdlet.

Try the cmdlet

The cmdlet can be understood as some built-in commands of Power shell, which can be used to obtain or set system information in a fixed format.

For example, to obtain information about all services on the local machine, enter the following command:

Get-Service

The output is as follows:

We can obtain information about all system services on the local machine.

An error occurred while obtaining the "get-command" command.

The output is as follows:

When you are careful, you will find that the cmdlet has naming rules, which are composed of verbs and operation names. Easy to remember.

Cmdlet example

Get-Date

Get-content

Get content

For example, if you enter test content in the C:/test.txt file, you can get the content of the file through get-content. As follows.

Of course, he still has a lot of extensions, so we need to gradually accumulate them.

Obtain the computer name:

Get-wmiobject

This is a commonly used cmdlet. We often need to use it to obtain computer system information. This is a useful and fun cmdlet.

For example

Get-wmiobject win32_bios-computername <servername>

It can obtain BIOS information on a remote computer.

Get-wmiobject-class win32_computersystem

Get login Username: Robin is my machine name

Get local IP Address

You can try the rest on your own.

Related Article

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.