Intro to tools, commands and modules in PowerShell

Hello Everyone,

This blog is in continuation of “What is PowerShell”. We prefer you should complete that first, then continue here as both are related.

Link: What is PowerShell?

In this will explore about Tools, Commands and Modules in PowerShell.

As with most things in life, taking the time to learn and fully understand the basics will go a long way toward avoiding headaches and will help you grasp more advanced concepts as you dive deeper into the world of PowerShell commands. The three concepts introduced in this section are fundamental to understanding the key concepts that form the basis of PowerShell.

PowerShell Tools

PowerShell is installed by default in Windows 10, Windows 7, Windows Server 2008 R2, and later versions of Windows. Newer versions of PowerShell introduce new features and “cmdlets” (Microsoft’s term for PowerShell commands – pronounced “command-lets”) and are installed using the corresponding version of the Windows Management Framework (WMF). Currently WMF(?) 5.1 is the latest version recommended for production use. In some cases, several new features are dependent on the operating system in addition to the WMF version. For instance, Windows 8 and Windows Server 2012 support the Test-NetConnection cmdlet, which allows you to test connectivity to a specific TCP/IP port, but this cmdlet is not available in Windows 7 even when running the latest WMF version.

On most Windows systems users will have the availability of two PowerShell environments, the PowerShell console and the PowerShell ISE (Integrated Scripting Environment). The PowerShell console appears like the traditional command line, but with the full weight of PowerShell behind it. Variable names, loops, tab completion, and piping are all available from the PowerShell console. For more in-depth use (such as script building) the PowerShell ISE offers tab completion, code highlighting, and Microsoft’s Intellisense code completion capability to assist you in creating and testing your PowerShell code. The PowerShell ISE also allows you to work with multiple PowerShell scripts simultaneously using tabbed navigation.

PowerShell cmdlets

The basis of PowerShell commands are cmdlets. Microsoft made several design strategies when designing PowerShell cmdlets. First is the ability to easily infer cmdlet names, or at the very least make them easy to discover. PowerShell commands, or cmdlets, are also designed to be easy to use with standardized syntax, making them easy to use interactively from the command line or to create powerful scripts.

PowerShell cmdlets use the Verb-Noun format as in Get-Service, Stop-Service, or Import-Csv. The verb portion of the cmdlet name indicates the action to be performed on the noun. Typically, cmdlets used to request information use the Get verb, as is the case with Get-Process or Get-Content. Commands used to modify something will usually begin with the verb Set, while those adding a new entity to something often begin with Add or New. In many cases these verb-noun combinations can be guessed or predicted because of the standard naming convention.

Standardized cmdlet naming isn’t the only aspect of PowerShell designed to improve command line usability. Parameters commonly used throughout PowerShell also use standard names. One example of this is the -ComputerName parameter, which allows a cmdlet to be executed against one or more remote computers. Likewise, -Credential is used to provide a credential object, containing a user’s login credentials, to run the command as a specific user.

PowerShell modules

When using PowerShell via the console, aliases can be used for both cmdlets and parameters to conserve keystrokes and shorten the overall length of a command (an advantage which should not be overlooked when piping commands together). Cmdlet aliases do not always use a standard naming convention, however they do often mirror traditional command line utilities.

In PowerShell the aliases DIR, CD, DEL, and CLS correspond to the Get-ChildItem, Set-Location, Remove-Item, and Clear-Host cmdlets respectively. Parameter aliases can work in two ways: they can utilize a predefined alias defined by the cmdlet, or they can be aliased by entering enough characters to result in a unique match among the cmdlet’s supported parameters.

Next will see about, “Managing files and folders in PowerShell”
Link:

Thankyou.