PowerShell special characters
 Special Character   Meaning 
 "   The beginning (or end) of quoted text
 #   The beginning of a comment 
 $   The beginning of a variable
 &   Reserved for future use
 ( )   Parentheses used for subexpressions 
 ;   Statement separator
 { }   Script block
 |   Pipeline separator
 `   Escape character
 --%   Escape command invocation

To escape the whole command invocation, use the verbatim
argument marker (--%) to prevent PowerShell from interpreting any of the remaining
characters on the line. You can place this marker anywhere in the command's arguments,
letting you benefit from PowerShell constructs where appropriate.
Example:
$env:host = "myhost"
ping --% %myhost%

Escape Sequences ( ` backtick )
 Special Character   Meaning 
`0    The null character. Often used as a record separator
`a   The alarm character. Generates a beep when displayed on the console 
`b   The backspace character. The previous character remains in
 the string but is overwritten when displayed on the console
`f  A form feed. Creates a page break when printed on most printers
`n  New line  
`r  A carriage return. Newlines in PowerShell are indicated entirely by
 the `n character, so this is rarely required
`t   Tab
`v  Vertical tab
' ' (2 single quotes)   A single quote, when in a literal string 
" " (2 double quotes)  A double quote, when in an expanding string 
`any other char  That character, taken literally

if, elseif, and else conditional statements - If condition evaluates to $true, PowerShell executes the statement block you provide.
if (condition) { statement block }
elseif (condition) { statement block }
else { statement block }

PowerShell Shortcut Keys
PowerShell ISE Snippets to Remember Syntax (Ctrl+J)

PowerTip: Use PowerShell to Create Two Column Output
Use the Format-Wide cmdlet, and then use the –Column parameter to specify a number of columns, for example:
Get-Process | Format-Wide name -Column 2

Like vs Contain comparison
When exploring the operators available in PowerShell (help about_comparison_operators), they'll often run across two similar-seeming, but drastically different, operators - and get confused by them.
if ($string -contains '*win*') { }
They're trying to see if $string contains the letters "win," but unfortunately that's not what -contains does. What they really want to use is the -like operator:
if ($string -like '*win*') { }
I know it doesn't read as nicely when you say it out loud.  But -like is the correct operator for this task.

The -contains operator is a bit trickier. It's designed to tell you if a collection of objects includes ('contains') a particular object. Now, if your collection of object is a bunch of strings, this is pretty straightforward.
$coll = "one','two','three','four'
if ($coll -contains 'one') { }
Source: PowerShell -contains -like

Clip.exe - Utility to copy result of any command to the Windows clipboard
Example: ls | clip or from cmd dir | clip

Comparison Operators
 Operator   Meaning 
-eq   Equality operator: $leftValue -eq $rightValue. For all primitive types, returns $true if $leftValue and $rightValue are equal.
 When used with arrays, returns all elements in $leftValue that are equal to $rightValue.
 When used with any other type, PowerShell uses that type’s Equals() method if it implements one.
-ne  Negated equality operator: $leftValue -ne $rightValue. For all primitive types, returns $true if$leftValue and $rightValue are not equal.
 When used with arrays, returns all elements in $leftValue that are not equal to$rightValue.
 When used with any other type, PowerShell returns the negation of that type’s Equals() method if it implements one.
-ge  Greater-than-or-equal operator: $leftValue -ge $rightValue For all primitive types, returns $true if $leftValue is greater than or equal to   $rightValue. When used with arrays, returns all elements in $leftValue that are greater than or equal to $right
 Value. When used with any other type, PowerShell returns the result of that object’s Compare() method if it
 implements one. If the method returns a number greater than or equal to zero, the operator returns $true.
-gt  Greater-than operator: $leftValue -gt $rightValue For all primitive types, returns $true if $leftValue is greater than $rightValue.
 When used with arrays, returns all elements in $leftValue that are greater than $rightValue.
 When used with any other type, PowerShell returns the result of that object’s Compare() method if it
 implements one. If the method returns a number greater than zero, the operator returns $true.
-in  $value -in $list. Returns $true if the value $value is contained in the list $list. That is, if $item -eq $value returns
 $true for at least one item in the list. This is equivalent to the -contains operator with the operands reversed.
-notin  Returns $true when the -in operator would return $false.
-lt  The less-than operator: $leftValue -lt $rightValue
 For all primitive types, returns $true if $leftValue is less than $rightValue.
 When used with arrays, returns all elements in $leftValue that are less than $rightValue.
 When used with any other type, PowerShell returns the result of that object’s Compare() method if it
 implements one. If the method returns a number less than zero, the operator returns $true.
-le  Less-than-or-equal operator: $leftValue -le $rightValue
 For all primitive types, returns $true if $leftValue is less than or equal to$rightValue.
 When used with arrays, returns all elements in $leftValue that are less than or equal to $rightValue.
 When used with any other type, PowerShell returns the result of that object’s Compare() method if it
 implements one. If the method returns a number less than or equal to zero, the operator returns $true.
-like  $leftValue -like Pattern. Evaluates the pattern against the target, returning $true if the simple match is successful.
 When used with arrays, returns all elements in $leftValue that match Pattern.
 The -like operator supports the following simple wildcard characters:
 ? - Any single unspecified character
 * - Zero or more unspecified characters
 [a-b] - Any character in the range of a–b
 [ab] - The specified characters a or b
 For example: PS > "Test" -like "[A-Z]e?[tr]" returns True
-notlike  Returns $true when the -like operator would return $false.
-match  "Target" -match Regular Expression. Evaluates the regular expression against the target, returning $true if the match is successful. Once   complete, PowerShell places the successful matches in the $matches variable. When used with arrays, returns all elements in Target that   match Regular Expression. The $matches variable is a hashtable that maps the individual matches to the text they match. 0 is the
 entire text of the match, 1 and on contain the text from any unnamed captures in the regular expression, and
 string values contain the text from any named captures in the regular expression. For example:
 PS > "Hello World" -match "(.*) (.*)"
 True
 PS > $matches[1]
 Hello
-notmatch  Returns $true when the -match operator would return $false.
 The -notmatch operator still populates the $matches variable with the results of match.
-contains  $list -contains $value. Returns $true if the list specified by $list contains the value $value—that is, if $item -eq
 $value returns $true for at least one item in the list.
  -notcontains    Returns $true when the -contains operator would return $false.
-is  The type operator: $leftValue -is [type]. Returns $true if $value is (or extends) the specified .NET type
-isnot  Returns $true when the -is operator would return $false.












.