Powershell Cmdlets and Member Notes

Resources

Cmdlets

A small, lightweight command that is used in Windows PowerShell. It exists as a small script that is intended to perform a single specific function, such as copying files and changing directories. Native PowerShell commands, not stand-alone executables. Cmdlets perform an action and typically return a Microsoft .NET object.

PowerShell is an object-oriented scripting language. It represents data and system states using structured objects derived from .NET classes defined in the .NET framework.

PowerShell uses a verb-noun name pair to name cmdlets.

  • The naming pattern is meant to make cmdlet easier to remember and read

  • The verb identified the action that the cmdlet performs.

    • The -Verb flag targets the part of the command name that related to the verb

  • the noun identifies the resource on which the cmdlet performs its action

    • The -Noun flag targets the part of the command name that related to the noun.

  • Here are some examples of commands:

    • Get-Command (gives you information about available commands, like man).

    • Get-Process (gives you information about running processes)

    • Set-Service (modified the properties of a service)

Example

Cmdlet Properties

Properties are the attributes of an object. To illustrate this concept, consider a driver's license as an analogy. Like any object, a driver's license has properties, such as eye color, which typically includes blue and brown values.

Extended Properties

Methods

Methods are the actions you can perform on an object. In contrast to properties, methods represent actions you can perform on the object. For instance, Revoke is a method that the Department of Motor Vehicles can perform on a driver's license.

Member Type

In PowerShell, a member type refers to a specific category of elements that comprise an object.

  • Properties

    • Attributes or characteristics of an object holding data or values associated with it.

  • Methods

    • Actions or functions that an object can perform. Executable blocks of code associated with an object.

  • Events

    • Notifications that an object can raise when something significant happens

  • Member Sets

    • Collections of other members, often used to group related properties or methods

Last updated