PowerShell Series (9) PowerShell Cmdlet Concept Introduction

Previous review
of PowerShell series (1): The difference between PowerShell introduction and cmd command line

PowerShell Series (2): Introduction to the Differences Between PowerShell and Python

PowerShell series (3): Combing the development history of PowerShell

PowerShell Series (4): Three ways for PowerShell to enter the interactive environment

PowerShell Series (5): PowerShell runs notes through scripts

PowerShell Series (6): PowerShell Script Execution Strategies

PowerShell Series (7) Introduction to Provider in PowerShell

PowerShell series (eight) PowerShell system default built-in Provider introduction

PowerShell is a command-line interface for operating systems that is cross-platform and provides many features to automate and optimize various tasks. PowerShell is officially developed by Microsoft and shipped as part of the Windows Server operating system. Using PowerShell, you can perform many operational operations such as creating, editing, viewing, and deleting files and folders, managing users and computers, configuring network settings, running system commands, automating testing and deployment, and more. Today I will continue to share with you the PowerShell series of tutorials.

The previous article explained the knowledge about the default built-in Provider of the PowerShell system. Today, I will introduce the concept of PPowerShell Cmdlet.

Today I will explain the concept of PowerShell Cmdlet to you, and I hope it will be helpful for everyone to learn PowerShell!

1. Concept

You may be more familiar with the cmd command. cmd is the command executed in the command line window of the Windows system. In order to distinguish it from the traditional Shell command, Microsoft has re-created the term "Cmdlet" for the use of PowerShell. Cmdlet can be understood as the command in the PowerShell environment. The command to execute, and depends on the PowerShell environment to execute.

Note: Cmdlet must have Net environment support, otherwise an error will be reported.

2. The difference between traditional CMD and Cmdlet commands

The traditional CMD is a 32-bit command-line program [cmd.exe], which inherits the DOS operation mode and is a "standard" component of the Windows system. It can execute Windows commands and BAT files. CMD can only perform basic tasks and is not integrated. Too many functions.

Cmdlet is a PowerShell command. All cmdlet commands follow the verb-noun grammatical structure. PowerShell provides a powerful command Get-Command, which can find all cmdlet commands. It has powerful third-party class library support, which can realize very complex operation and maintenance tasks and data processing and analysis.

3. Cmdlet description

It belongs to the Net class to instantiate and compile the executable script program.

Cmdlet is not responsible for error handling and data output, it depends on PowerShell's own operating environment to handle

Cmdlets use pipelines for object processing instead of text data streams, and also support passing the execution results of Cmdlets to pipelines as objects.

Cmdlets can only implement processing operations on one object at a time

4. Commands supported by PowerShell

PowerShell is very powerful and compatible with the old cmd shell, specifically supports the following types of commands

Cmdlet commands: Cmdlet commands are the "sons" of PowerShell, and all commands are supported, including alias commands based on PowerShell.

CMD command: In order to be compatible with the old version of the command line window, all commands except aliases are supported. So everyone should pay attention to using the cmd alias command.

Bat script: It also supports the bat scripts supported by cmd shell.

VBS script: It also supports the execution of VBS script commands.

Function: Of course, the function function of PowerShell Function is also supported.

Five, the characteristics of Cmdlet command

Cmdlet commands are more user-friendly and easy to understand. If no alias is used, its command format is unified

 The format verb+noun is easier to write and understand.

Execute the following command:

Query the commands supported by the current environment

get-command

CommandType     Name                                               Version    Source

-----------     ----                                               -------    ------

Alias           Add-AppPackage                                     2.0.1.0    Appx

Alias           Add-AppPackageVolume                               2.0.1.0    Appx

Alias           Add-AppProvisionedPackage                          3.0        Dism

Alias           Add-ProvisionedAppPackage                          3.0        Dism

Alias           Add-ProvisionedAppxPackage                         3.0        Dism

Alias           Add-ProvisioningPackage                            3.0        Provisioning

Alias           Add-TrustedProvisioningCertificate                 3.0        Provisioning

Alias           Apply-WindowsUnattend                              3.0        Dism

Alias ​​Begin-WebCommitDelay 1.0.0.0 WebAdministration

Alias           Disable-PhysicalDiskIndication                     2.0.0.0    Storage

Alias           Disable-StorageDiagnosticLog                       2.0.0.0    Storage

Alias           Dismount-AppPackageVolume                          2.0.1.0    Appx

Alias           Enable-PhysicalDiskIndication                      2.0.0.0    Storage

Alias           Enable-StorageDiagnosticLog                        2.0.0.0    Storage

Alias ​​End-WebCommitDelay 1.0.0.0 WebAdministration

Alias           Flush-Volume                                       2.0.0.0    Storage

Alias           Get-AppPackage                                     2.0.1.0    Appx

Alias           Get-AppPackageDefaultVolume                        2.0.1.0    Appx

Alias           Get-AppPackageLastError                            2.0.1.0    Appx

Alias           Get-AppPackageLog                                  2.0.1.0    Appx

Alias           Get-AppPackageManifest                             2.0.1.0    Appx

Alias           Get-AppPackageVolume                               2.0.1.0    Appx

Alias           Get-AppProvisionedPackage                          3.0        Dism

Alias           Get-DiskSNV                                        2.0.0.0    Storage

Alias           Get-Language                                       1.0        LanguagePackManagement

Alias           Get-PhysicalDiskSNV                                2.0.0.0    Storage

Alias           Get-PreferredLanguage                              1.0        LanguagePackManagement

Alias           Get-ProvisionedAppPackage                          3.0        Dism

Alias           Get-ProvisionedAppxPackage                         3.0        Dism

Alias           Get-StorageEnclosureSNV                            2.0.0.0    Storage

Alias           Get-SystemLanguage                                 1.0        LanguagePackManagement

Alias           Initialize-Volume                                  2.0.0.0    Storage

Alias           Mount-AppPackageVolume                             2.0.1.0    Appx

Alias           Move-AppPackage                                    2.0.1.0    Appx

Alias           Move-SmbClient                                     2.0.0.0    SmbWitness

Alias           Optimize-AppProvisionedPackages                    3.0        Dism

Alias           Optimize-ProvisionedAppPackages                    3.0        Dism

Alias           Optimize-ProvisionedAppxPackages                   3.0        Dism

Alias           Remove-AppPackage                                  2.0.1.0    Appx

Alias           Remove-AppPackageVolume                            2.0.1.0    Appx

Alias           Remove-AppProvisionedPackage                       3.0        Dism

Alias           Remove-EtwTraceSession                             1.0.0.0    EventTracingManagement

Alias           Remove-ProvisionedAppPackage                       3.0        Dism

Alias           Remove-ProvisionedAppxPackage                      3.0        Dism

Alias           Remove-ProvisioningPackage                         3.0        Provisioning

Alias           Remove-TrustedProvisioningCertificate              3.0        Provisioning

Alias           Set-AppPackageDefaultVolume                        2.0.1.0    Appx

Alias           Set-AppPackageProvisionedDataFile                  3.0        Dism

Alias           Set-AutologgerConfig                               1.0.0.0    EventTracingManagement

Alias           Set-EtwTraceSession                                1.0.0.0    EventTracingManagement

Alias           Set-PreferredLanguage                              1.0        LanguagePackManagement

Alias           Set-ProvisionedAppPackageDataFile                  3.0        Dism

Alias           Set-ProvisionedAppXDataFile                        3.0        Dism

Alias           Set-SystemLanguage                                 1.0        LanguagePackManagement

Alias           Write-FileSystemCache                              2.0.0.0    Storage

Function        A:

Function        Add-BCDataCacheExtension                           1.0.0.0    BranchCache

Function        Add-BitLockerKeyProtector                          1.0.0.0    BitLocker

Function        Add-DnsClientNrptRule                              1.0.0.0    DnsClient

Function        Add-DtcClusterTMMapping                            1.0.0.0    MsDtc

Function        Add-EtwTraceProvider                               1.0.0.0    EventTracingManagement

Function        Add-InitiatorIdToMaskingSet                        2.0.0.0    Storage

Function        Add-MpPreference                                   1.0        ConfigDefender

Function        Add-MpPreference                                   1.0        Defender

Function        Add-NetEventNetworkAdapter                         1.0.0.0    NetEventPacketCapture

Function        Add-NetEventPacketCaptureProvider                  1.0.0.0    NetEventPacketCapture

Function        Add-NetEventProvider                               1.0.0.0    NetEventPacketCapture

Function        Add-NetEventVFPProvider                            1.0.0.0    NetEventPacketCapture

Function        Add-NetEventVmNetworkAdapter                       1.0.0.0    NetEventPacketCapture

Function        Add-NetEventVmSwitch                               1.0.0.0    NetEventPacketCapture

Function        Add-NetEventVmSwitchProvider                       1.0.0.0    NetEventPacketCapture

Function        Add-NetEventWFPCaptureProvider                     1.0.0.0    NetEventPacketCapture

Function        Add-NetIPHttpsCertBinding                          1.0.0.0    NetworkTransition

Function        Add-NetLbfoTeamMember                              2.0.0.0    NetLbfo

Function        Add-NetLbfoTeamNic                                 2.0.0.0    NetLbfo

Function        Add-NetNatExternalAddress                          1.0.0.0    NetNat

Function        Add-NetNatStaticMapping                            1.0.0.0    NetNat

Guess you like

Origin blog.csdn.net/xishining/article/details/131589297