liveBook · Manning

Chapter 4: Running commands

What you will learn in chapter 4 of Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS

The introduction positions running commands as the beginner’s starting point for PowerShell, despite the advanced scripting examples often found online.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The introduction positions running commands as the beginner’s starting point for PowerShell, despite the advanced scripting examples often found online.

Key terms: running commands, command-line utilities, scripting, programming

4.1 Let’s talk security

This section explains how PowerShell relates to existing permissions and why its security measures focus on unintentional script execution.

Key terms: permissions, command, script, PowerShell’s security system, unintentionally, scripts from untrusted sources

4.1.1 Execution policy

This subsection explains which scripts PowerShell’s execution policy permits, how the policy is set, and why it should not be treated as a security barrier.

Key terms: execution policy, Restricted, scripts, AllSigned, RemoteSigned, Unrestricted, Bypass, digital signature, Get-ExecutionPolicy, Set-ExecutionPolicy

4.2 Not scripting, but running commands

This section presents PowerShell as a shell where beginners can work effectively by running commands, then save repeated commands as scripts when useful.

Key terms: shell, command, parameters, .ps1, PowerShell script, scripts

4.3 The anatomy of a command

This section breaks down a full-form PowerShell command and explains the typing rules for its name, parameters, and values.

Key terms: full-form syntax, cmdlet name, parameter name, switch parameter, parameter names, dash (-), quotation marks, case sensitive

4.4 The cmdlet naming convention

Defines PowerShell command terminology and explains how the verb-noun naming convention helps readers find cmdlets.

Key terms: cmdlet, function, application, command, verb-noun naming convention, Get-Verb, Help, Get-Command, wildcards

4.5 Aliases: Nicknames for commands

This section explains how PowerShell aliases shorten command names, how to identify them, and why custom aliases require care.

Key terms: alias, gps, Get-Process, help system, full command, New-Alias, Export-Alias, Import-Alias, custom aliases, Bash

4.6 Taking shortcuts

Introduces parameter shortcuts as another form of PowerShell shorthand alongside command aliases.

Key terms: aliases, parameters, shortcuts

4.6.1 Truncating parameter names

Explains when a PowerShell parameter name can be shortened and how Tab completion makes that shortcut clearer.

Key terms: parameter names, minimum-length parameter, Tab

4.6.2 Using parameter name aliases

This subsection shows that parameters can have aliases and explains why those aliases can be hard to discover.

Key terms: parameter aliases, -ea, -ErrorAction, Tab completion, common parameters

4.6.3 Using positional parameters

This section shows how to recognize and use positional parameters, then explains why named parameters are usually clearer.

Key terms: positional parameters, position 0, full help, named (nonpositional) parameters, positional (unnamed) parameters, parameter names, PowerShell script file

4.7 Support for external commands

This section shows that PowerShell can run familiar external utilities, explains why some commands need help with parsing, and gives two ways to pass their arguments.

Key terms: external command-line utilities, cmdlets, Test-Connection, ping, parser, placeholders, invocation operator (&), --%, variables, parameter values

4.8 Dealing with errors

This section shows how to interpret PowerShell error messages and troubleshoot confusing ones by checking help and spelling out commands and parameters.

Key terms: error messages, Get-Command, help, Get-ChildItem, -Path, -Recurse

4.9 Common points of confusion

Introduces the chapter’s common-mistakes section as a way to help readers avoid or resolve problems when using PowerShell.

4.9.1 Typing cmdlet names

This section clarifies that cmdlet names must be typed with a hyphen between the verb and noun, even though the hyphen is often omitted in speech.

Key terms: cmdlet names, verb-noun, dash

4.9.2 Typing parameters

This section explains how to type PowerShell parameters with the required dashes and spaces while recognizing that capitalization usually does not matter.

Key terms: parameter, parameter name, value, cmdlet, dash

4.10 Lab

4.11 Lab answers

Where this is used later

Concepts explained in this chapter

← Chapter 3: Using the help system Chapter 5: Working with providers →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.