0% found this document useful (0 votes)
17 views15 pages

Advance Filteration and Operator PowerShell Session 2

The document discusses PowerShell concepts including pipelines, comparison operators, filtering with Where-Object and Select-Object, sorting with Sort-Object, and formatting output with Format-Table and Format-List. Aliases and operators are also covered.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views15 pages

Advance Filteration and Operator PowerShell Session 2

The document discusses PowerShell concepts including pipelines, comparison operators, filtering with Where-Object and Select-Object, sorting with Sort-Object, and formatting output with Format-Table and Format-List. Aliases and operators are also covered.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

Basic

Understanding
of PowerShell
Topic

 Last Session Revision


 Advance Filtration
 Basic of Comparison Operator
 Pipeline Operator
 Where-Object
 Script Block

Advance
 Aliases
 Select-Object
Filtration  Get-Member
 Sort-Object
 Format-list and Table
 It’s series of command connected by
pipeline Operators (|).
 Output of preceding command (pervious
Pipeline command) becomes input of next
command.
Operator  Example :-
Get-Service -name “Windows Update” |
stop - service
 It will select objects based on the property
value.
 Two type of Where-Object filtration

Where-Object $_ and $_.

$_ provide all property values.


$_. Provide particular property values.
 We can test a single and multiple property
values per a object
 Collection of statements or expressions that
can be used as a single unit.

Script-Block  Inside Script block whatever the Input is


should mentioned in { }.
 An alias is an alternate name for a cmdlet,
function, executable file, including scripts.
 PowerShell includes a set of built-in aliases.

Aliases You can add your own aliases to the current


session and to your PowerShell profile.
 The Select-Object cmdlet selects specified
properties of an object or set of objects. It
can also select unique objects, a specified
number of objects, or objects in a specified
position in an array.
 To select objects from a collection, use the
Select-Object First, Last, Unique, Skip, and Index
parameters. To select object properties, use
the Property parameter. When you select
properties, Select-Object returns new
objects that have only the specified
properties.
 The Get-Member cmdlet gets the members,
the properties and methods, of objects.
 The Select-Object cmdlet selects specified
properties of an object or set of objects. It
can also select unique objects, a specified
number of objects, or objects in a specified
position in an array.
 To select objects from a collection, use the
Get-Member First, Last, Unique, Skip, and Index
parameters. To select object properties, use
the Property parameter. When you select
properties, Select-Object returns new
objects that have only the specified
properties.
 The Format-List cmdlet formats the output
of a command as a list of properties in
which each property is displayed on a
separate line. You can use Format-List to
Format – List / format and display all or selected properties
of an object as a list (Format-List -Property
Table *).
 The Sort-Object cmdlet sorts objects in
ascending or descending order based on
object property values. If sort properties
are not included in a command, PowerShell

Sort-Object uses default sort properties of the first


input object.
 PowerShell provides a rich set of operators
to manipulate variables. We can divide all
the PowerShell operators into the following
groups −
 Comparison Operators
 Logical Operators
PowerShell  Arithmetic Operators

Operators 


Assignment Operators
Redirection Operators
 Spilt and Join Operators
 Type Operators
 Unary Operators
 Comparison operators let you compare
values or finding values that match
specified patterns.

PowerShell includes the following


comparison operators:
Comparison  Equality

Operators 


Matching
Replacement
 Containment
 Type
 -eq, -ieq, -ceq - equals
 -ne, -ine, -cne - not equals

Equality 


-gt, -igt, -igt - greater than
-ge, -ige, -cge - greater than or equal
Operators  -lt, -ilt, -clt - less than
 -le, -ile, -cle - less than or equal

You might also like