Powershell 3.0 Ise Cheat Sheet

ADVERTISEMENT

Windows PowerShell 3.0 Language Quick Reference
Created by
Bitwise Operators
,
Comma operator (Array
Useful Commands
-band
Bitwise AND
constructor)
Update-Help
Downloads and installs newest help
-bor
Bitwise OR (inclusive)
.
Dot-sourcing operator runs a
files
-bxor
Bitwise OR (exclusive)
script in the current scope
Get-Help
Displays information about
-bnot
Bitwise NOT
. c:\scripts\sample.ps1
commands and concepts
-shl, -shr
Bitwise shift operators. Bit
Get-Command
Gets all commands
shift left, bit shift right
$( )
Subexpression operator
Get-Member
Gets the properties and methods
(arithmetic for signed,
@( )
Array subexpression operator
of objects
&
The call operator, also known as
logical for unsigned values)
Get-Module
Gets the modules that have been
the "invocation operator," lets
imported or that can be imported
you run commands that are
Other Operators
into the current session
stored in variables and
-Split
Splits a string
represented by strings.
“abcdefghi” -split “de”
$a = "Get-Process"
Operators
& $a
-join
Joins multiple strings
Assignment Operators
$sb = { Get-Process | Select –First 2 }
“abc”,”def”,”ghi” -join “;”
=, +=, -=, *=, /=, %=, ++, -- Assigns one or more values
& $sb
to a variable
..
Range operator
Logical Operators
1..10 | foreach {$_ * 5}
Comparison Operators
-and, -or, -xor, -not, !
Connect expressions and
statements, allowing you to test
-eq, -ne
Equal, not equal
-is, -isnot
Type evaluator (Boolean).
for multiple conditions
-gt, -ge
Greater than, greater than
Tells whether an object is an
or equal to
Redirection Operators
instance of a specified .NET
>, >>
The redirection operators enable
-lt, -le
Less than, less than or
Framework type.
you to send particular types of
equal to
42 –is [int]
-replace
changes the specified
output (success, error, warning,
verbose, and debug) to files and
elements of a value
-as
Type convertor. Tries to
to the success output stream.
“abcde” -replace “bc”, “TEST”
convert the input object to
Output streams
* All output
the specified .NET
1 Success output
-match, -notmatch
Regular expression match
Framework type.
2 Errors
-like, -notlike
Wildcard matching
$a = 42 –as [String]
-contains, -notcontains
Returns TRUE if the scalar
3 Warning messages
4 Verbose output
value on its right is
-f
Formats strings by using the
5 Debug messages
contained in the array on
format method of string
its left
# Writes warning output to warning.txt
objects
Do-Something 3> warning.txt
1,2,3,4,5 -contains 3
1..10 | foreach { "{0:N2}" -f $_ }
# Appends verbose.txt with the verbose output
-in, -notin
Returns TRUE only when
Do-Something 4>> verbose.txt
[ ]
Cast operator. Converts or
# Writes debug output to the output stream
test value exactly matches
limits objects to the
Do-Something 5>&1
at least one of the
specified type
reference values.
# Redirects all streams to out.txt
[datetime]$birthday = "1/10/66"
Do-Something *> out.txt
“Windows”-in “Windows”,”PowerShell”

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go
Page of 4