cat <file> | where { $_ -match <expression> } Search each line of <file> to see if it contains the regular expression <expression> and return the entire line if there is a match.

cat <file> | where { $_ -replace <expression>,<string> } Search each line of <file> for the regular expression <expression> and replace it with <string>.

CmdLet Built-in code that performs an action.

Get-ExecutionPolicy, Set-ExecutionPolicy <label> Gets the current execution policy for PowerShell. Sets the Execution Policy to <label>.

Get-Unique Strip duplicate consecutive lines from the piped input.

Set-Content Writes or replaces the content in an item with new content.

Facts, Thoughts and Opinions

Execution Policy Settings

ExecutionPolicy Definition
Restricted Allows you to run script only through the interactive console. No script files are allowed to be executed. Only interactive sessions are allowed.
RemoteSigned Allows scripts to run on the local machine but requires scripts to be signed if downloaded from the internet.
AllSigned Requires all scripts to be signed.
Unrestricted Runs all scripts without restriction, if you download a script from the internet, you will be prompted for permission to run.
Bypass Nothing is blocked and there are no warnings or prompts.


  •   Subtopics

  •   Writings