SlideShare a Scribd company logo
Microsoft
Powershell v5
Presented By:
Nishtha Kesarwani
Agenda
What is Powershell ?
Working with Powershell
Cmdlets
Scripting in Powershell
Powershell Classes
What is Powershell
 Task automation and
configuration management
framework
 Interactive object-oriented
command line shell
 Interactive editor
 Scripting language
 Based on .Net Framework
 Access to COM and WMI
 Both local and remote
How to install Powershell in Mac
 https://github.com/PowerShell/PowerShell
 http://www.howtogeek.com/267858/how-to-install-microsoft-
powershell-on-linux-or-os-x/
Working with Powershell
Cmdlets
Scripts
Classes
Cmdlets
 Heart-and-Soul of Windows
PowerShell
 Written in .Net framework
language
 PowerShell cmdlets use the
Verb-Noun format as in Get-
Service, Stop-Service, or
Import-Csv
Difference between cmdlets and
commands
 Instances of .NET Framework classes; they are not stand-alone
executables.
 Can be created from as few as a dozen lines of code.
 Parsing, error presentation, and output formatting are handled by the
Windows PowerShell runtime.
 Process input objects from the pipeline rather than from streams of
text
 Deliver objects as output to the pipeline.
 Cmdlets are record-oriented as they process a single object at a time.
5 cmdlets to get started with Powershell
Get-Command
Gets all commands that are installed on the computer
Get-Help
Help describe powershell cmdlets, functions, scripts and modules
Get-Member
Gets the members, the properties and methods of objects
Get-Process
Gets the processes on a local or remote computer
Where-Object
Filter input from the pipeline and control which objects will be passed along
Get-Help
Scripting in Powershell
 Script file in Powershell is a plain-text file with .PS1 extension
 Supports variables, functions, branching, loops, structured error/exception
handling as well as integration with .NET
 Fundamental Concepts
 Pipelining
 Pipelining is the term for feeding one command's output into another
command, to pipeline two commands (or cmdlets), simply separate
them with the pipe symbol (|)
 Variables
 Can store a command's full output, variables in PowerShell scripts are
prefixed with $
 @ symbol
 This symbol can turn the contents of a list into an array
Set-Execution Policy
Restricted : Scripts won't run
RemoteSigned : Locally-created scripts will run
AllSigned : Scripts will only run if signed by a trusted publisher
Unrestricted : All scripts will run regardless of who created them and
whether or not they are signed
Script Example
$colItems = get-wmiobject -class "Win32_Printer" -namespace "rootCIMV2" -
computername $strComputer
Powershell Classes
 Class
 Definition of a template for creating objects. The class can
define properties (data fields) and methods (the way to
perform a task)
 Object
 An object is created from a class definition. New-Object
cmdlet is used to create an object
 Module
 A PowerShell module is a .psm1 file that contains one, or
more, PowerShell functions – usually advanced functions.
Class Syntax
 Class <Class_Name>
 {
 #Properties
 <Data_Type> $<Variable_Name>
 }
 #Methods
 [Return Type] <Method_Name> {
 # Script
 }
 #Creating an object
 $<Object_Name> = New-Object –TypeName <Class_Name>
 #Calling a method
 <Object_Name>.<Method_Name>()
Class Example
class Person {
#Properties
[string]$lastName
[string]$firstName
#Methods
[void] SetLast ( [string]$ln )
{
$this.lastName = $ln
}
[string] ToString ( [String]$firstName,
[String]$lastName )
{
return $firstName + " " + $lastName
}
}# end class Person
Summary
 Powershell is a task automation tool built on .Net framework with interactive
command line shell and editor
 Scripting language designed specially for administrative tasks
 Built-in Windows PowerShell commands, called cmdlets, that allows us to
manage the computers from the command line
 5 basic cmdlets to get started with Powershell
 Powershell script files have a .PS1 extension
 Scripting in Powershell supports pipelining and can handle functions,
branching, loops and exception handling
 Execution Policy for running scripts in Powershell for avoiding malicious code
execution
 Powershell classes contains properties and methods; Objects can be created
with New-Object cmdlet
Resources
 https://msdn.microsoft.com/en-us/powershell/scripting/core-
powershell/ise/introducing-the-windows-powershell-ise
 https://blogs.technet.microsoft.com/heyscriptingguy/2015/01/02/wh
at-is-powershell/
 https://msdn.microsoft.com/en-us/library/ms714395(v=vs.85).aspx
 http://www.howtogeek.com/114344/5-cmdlets-to-get-you-started-
with-powershell/
 https://technet.microsoft.com/en-us/library/cc732114(v=ws.10).aspx
 https://technet.microsoft.com/en-us/scriptcenter/dd742419
Introduction to Powershell Version 5

More Related Content

What's hot (20)

PDF
Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Ahmed El-Arabawy
 
PDF
Windows Server 2016 First Look (Part 1)
Tuan Yang
 
PDF
Windows Server 2019 -InspireTech 2019
Diana Carolina Torres Viasus
 
PDF
Ansible - Introduction
Stephane Manciot
 
PDF
Git and Github slides.pdf
Tilton2
 
PPTX
Windows server
Hideo Amezawa
 
PDF
Domino Server Health - Monitoring and Managing
Gabriella Davis
 
PPTX
GIT presentation
Naim Latifi
 
PPTX
Intro to git and git hub
Venkat Malladi
 
PDF
Alphorm.com Formation Veeam Backup & Replication 9.5
Alphorm
 
PPTX
Introduction 2 linux
Papu Kumar
 
PPT
Maven Introduction
Sandeep Chawla
 
PPTX
Microsoft Hyper-V
Davoud Teimouri
 
PPTX
GitHub Presentation
BrianSchilder
 
PPTX
Basics of-linux
Singsys Pte Ltd
 
PDF
Engage2022 - Domino Admin Tips
Gabriella Davis
 
PPT
Linux command ppt
kalyanineve
 
ODP
An Introduction To Jenkins
Knoldus Inc.
 
KEY
Git and GitHub
James Gray
 
Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Ahmed El-Arabawy
 
Windows Server 2016 First Look (Part 1)
Tuan Yang
 
Windows Server 2019 -InspireTech 2019
Diana Carolina Torres Viasus
 
Ansible - Introduction
Stephane Manciot
 
Git and Github slides.pdf
Tilton2
 
Windows server
Hideo Amezawa
 
Domino Server Health - Monitoring and Managing
Gabriella Davis
 
GIT presentation
Naim Latifi
 
Intro to git and git hub
Venkat Malladi
 
Alphorm.com Formation Veeam Backup & Replication 9.5
Alphorm
 
Introduction 2 linux
Papu Kumar
 
Maven Introduction
Sandeep Chawla
 
Microsoft Hyper-V
Davoud Teimouri
 
GitHub Presentation
BrianSchilder
 
Basics of-linux
Singsys Pte Ltd
 
Engage2022 - Domino Admin Tips
Gabriella Davis
 
Linux command ppt
kalyanineve
 
An Introduction To Jenkins
Knoldus Inc.
 
Git and GitHub
James Gray
 

Viewers also liked (20)

PDF
S4 tarea4 toork
diego chavez
 
PDF
BCA Global's Food & Wine Experience
Alex Askew
 
PPTX
Incluyendo la diversidad, dinámica de conscientización
Education in the Knowledge Society PhD
 
PPTX
Study of various Data Compression Techniques used in Lossless Compression of ...
Ankita Tiwari
 
PPTX
3com H3 C Solutions
thouchin
 
PPTX
Unidad v plan de negocios
MIRIAM LILIANA ZEPETA VIDAL
 
PDF
Tool Development 08 - Windows Command Prompt
Nick Pruehs
 
PPTX
5 клас 28 урок. Реалізація алгоритмів з розгалуженням у середовищі Scratch. (...
StAlKeRoV
 
PPTX
Unity 5 Jumpstart: Kickoff
Shahed Chowdhuri
 
PPSX
Execute sql query or sql command sql server using command prompt
Ikhwan Krisnadi
 
PDF
Windows command prompt a to z
Subuh Kurniawan
 
PDF
Understanding Blockchain Security
ITU
 
PPTX
Intro to HoloLens Development
Shahed Chowdhuri
 
PPTX
以太坊智能合約撰寫簡單教學
Nicholas Lin
 
PPT
Spanning Tree Protocol
Manoj Gharate
 
PPTX
Use Powershell to make your life easy.
Aman Dhally
 
PDF
Practical PowerShell Programming for Professional People
Ben Ten (0xA)
 
PDF
Powershell training material
Dr. Awase Khirni Syed
 
PPT
Java servlet life cycle - methods ppt
kamal kotecha
 
PPT
Java Servlets
Nitin Pai
 
S4 tarea4 toork
diego chavez
 
BCA Global's Food & Wine Experience
Alex Askew
 
Incluyendo la diversidad, dinámica de conscientización
Education in the Knowledge Society PhD
 
Study of various Data Compression Techniques used in Lossless Compression of ...
Ankita Tiwari
 
3com H3 C Solutions
thouchin
 
Unidad v plan de negocios
MIRIAM LILIANA ZEPETA VIDAL
 
Tool Development 08 - Windows Command Prompt
Nick Pruehs
 
5 клас 28 урок. Реалізація алгоритмів з розгалуженням у середовищі Scratch. (...
StAlKeRoV
 
Unity 5 Jumpstart: Kickoff
Shahed Chowdhuri
 
Execute sql query or sql command sql server using command prompt
Ikhwan Krisnadi
 
Windows command prompt a to z
Subuh Kurniawan
 
Understanding Blockchain Security
ITU
 
Intro to HoloLens Development
Shahed Chowdhuri
 
以太坊智能合約撰寫簡單教學
Nicholas Lin
 
Spanning Tree Protocol
Manoj Gharate
 
Use Powershell to make your life easy.
Aman Dhally
 
Practical PowerShell Programming for Professional People
Ben Ten (0xA)
 
Powershell training material
Dr. Awase Khirni Syed
 
Java servlet life cycle - methods ppt
kamal kotecha
 
Java Servlets
Nitin Pai
 
Ad

Similar to Introduction to Powershell Version 5 (20)

PPTX
PowerShell-1
Saravanan G
 
PPTX
PowerShell 101 - What is it and Why should YOU Care!
Thomas Lee
 
PPTX
Introduction to powershell
Salaudeen Rajack
 
PPTX
PowerShell 101
Thomas Lee
 
PPTX
Introduction to PowerShell and getting started
Ravikanth Chaganti
 
PPTX
Holy PowerShell, BATman! - dogfood edition
Dave Diehl
 
PPT
Introduction to PowerShell
Salaudeen Rajack
 
PPTX
2016 spice world_london_breakout
Thomas Lee
 
PPTX
Power shell training
Pedro Lopez
 
PDF
Windows Powershell Step By Step 3rd Edition Wilson Ed
forsenqenan
 
PPTX
Powershell Tech Ed2009
rsnarayanan
 
PPTX
PowerShell 101
Thomas Lee
 
PDF
powershell.pdf
Saurabh846965
 
PDF
Sql Server & PowerShell
Aaron Shilo
 
PPTX
Everything you need to know about PowerShell
Shane Hoey
 
PPTX
Power Shell for System Admins - By Kaustubh
Kaustubh Kumar
 
PDF
Windows Powershell in Action 1st Edition Bruce G. Payette
zahithovor
 
PPTX
PowerShellForDBDevelopers
Bryan Cafferky
 
PDF
Learn Powershell Scripting Tutorial Full Course 1dollarcart.com.pdf
ClapperboardCinemaPV
 
PPTX
learn ps new advance for all powershell.pptx
Ronnie Kapoor
 
PowerShell-1
Saravanan G
 
PowerShell 101 - What is it and Why should YOU Care!
Thomas Lee
 
Introduction to powershell
Salaudeen Rajack
 
PowerShell 101
Thomas Lee
 
Introduction to PowerShell and getting started
Ravikanth Chaganti
 
Holy PowerShell, BATman! - dogfood edition
Dave Diehl
 
Introduction to PowerShell
Salaudeen Rajack
 
2016 spice world_london_breakout
Thomas Lee
 
Power shell training
Pedro Lopez
 
Windows Powershell Step By Step 3rd Edition Wilson Ed
forsenqenan
 
Powershell Tech Ed2009
rsnarayanan
 
PowerShell 101
Thomas Lee
 
powershell.pdf
Saurabh846965
 
Sql Server & PowerShell
Aaron Shilo
 
Everything you need to know about PowerShell
Shane Hoey
 
Power Shell for System Admins - By Kaustubh
Kaustubh Kumar
 
Windows Powershell in Action 1st Edition Bruce G. Payette
zahithovor
 
PowerShellForDBDevelopers
Bryan Cafferky
 
Learn Powershell Scripting Tutorial Full Course 1dollarcart.com.pdf
ClapperboardCinemaPV
 
learn ps new advance for all powershell.pptx
Ronnie Kapoor
 
Ad

More from Nishtha Kesarwani (6)

PDF
img-160819165446-0001
Nishtha Kesarwani
 
PDF
img-160819165329-0001
Nishtha Kesarwani
 
PDF
Suryakala-LOR
Nishtha Kesarwani
 
PDF
Sangeetha-LOR
Nishtha Kesarwani
 
PDF
img-160819165517-0001
Nishtha Kesarwani
 
PDF
Ranjitha-LOR
Nishtha Kesarwani
 
img-160819165446-0001
Nishtha Kesarwani
 
img-160819165329-0001
Nishtha Kesarwani
 
Suryakala-LOR
Nishtha Kesarwani
 
Sangeetha-LOR
Nishtha Kesarwani
 
img-160819165517-0001
Nishtha Kesarwani
 
Ranjitha-LOR
Nishtha Kesarwani
 

Recently uploaded (20)

PDF
Quantum Threats Are Closer Than You Think – Act Now to Stay Secure
WSO2
 
PDF
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
PDF
TrustArc Webinar - Navigating APAC Data Privacy Laws: Compliance & Challenges
TrustArc
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
PDF
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
PPTX
Reimaginando la Ciberdefensa: De Copilots a Redes de Agentes
Cristian Garcia G.
 
PDF
Why aren't you using FME Flow's CPU Time?
Safe Software
 
PPSX
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
 
PDF
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
PDF
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
PDF
Kubernetes - Architecture & Components.pdf
geethak285
 
PDF
Pipeline Industry IoT - Real Time Data Monitoring
Safe Software
 
PPTX
CapCut Pro PC Crack Latest Version Free Free
josanj305
 
PDF
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
PDF
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
PPTX
Mastering Authorization: Integrating Authentication and Authorization Data in...
Hitachi, Ltd. OSS Solution Center.
 
PDF
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 
PDF
Simplify Your FME Flow Setup: Fault-Tolerant Deployment Made Easy with Packer...
Safe Software
 
PDF
“A Re-imagination of Embedded Vision System Design,” a Presentation from Imag...
Edge AI and Vision Alliance
 
Quantum Threats Are Closer Than You Think – Act Now to Stay Secure
WSO2
 
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
TrustArc Webinar - Navigating APAC Data Privacy Laws: Compliance & Challenges
TrustArc
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
Reimaginando la Ciberdefensa: De Copilots a Redes de Agentes
Cristian Garcia G.
 
Why aren't you using FME Flow's CPU Time?
Safe Software
 
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
 
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
Kubernetes - Architecture & Components.pdf
geethak285
 
Pipeline Industry IoT - Real Time Data Monitoring
Safe Software
 
CapCut Pro PC Crack Latest Version Free Free
josanj305
 
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
Mastering Authorization: Integrating Authentication and Authorization Data in...
Hitachi, Ltd. OSS Solution Center.
 
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 
Simplify Your FME Flow Setup: Fault-Tolerant Deployment Made Easy with Packer...
Safe Software
 
“A Re-imagination of Embedded Vision System Design,” a Presentation from Imag...
Edge AI and Vision Alliance
 

Introduction to Powershell Version 5

  • 2. Agenda What is Powershell ? Working with Powershell Cmdlets Scripting in Powershell Powershell Classes
  • 3. What is Powershell  Task automation and configuration management framework  Interactive object-oriented command line shell  Interactive editor  Scripting language  Based on .Net Framework  Access to COM and WMI  Both local and remote
  • 4. How to install Powershell in Mac  https://github.com/PowerShell/PowerShell  http://www.howtogeek.com/267858/how-to-install-microsoft- powershell-on-linux-or-os-x/
  • 6. Cmdlets  Heart-and-Soul of Windows PowerShell  Written in .Net framework language  PowerShell cmdlets use the Verb-Noun format as in Get- Service, Stop-Service, or Import-Csv
  • 7. Difference between cmdlets and commands  Instances of .NET Framework classes; they are not stand-alone executables.  Can be created from as few as a dozen lines of code.  Parsing, error presentation, and output formatting are handled by the Windows PowerShell runtime.  Process input objects from the pipeline rather than from streams of text  Deliver objects as output to the pipeline.  Cmdlets are record-oriented as they process a single object at a time.
  • 8. 5 cmdlets to get started with Powershell Get-Command Gets all commands that are installed on the computer Get-Help Help describe powershell cmdlets, functions, scripts and modules Get-Member Gets the members, the properties and methods of objects Get-Process Gets the processes on a local or remote computer Where-Object Filter input from the pipeline and control which objects will be passed along
  • 10. Scripting in Powershell  Script file in Powershell is a plain-text file with .PS1 extension  Supports variables, functions, branching, loops, structured error/exception handling as well as integration with .NET  Fundamental Concepts  Pipelining  Pipelining is the term for feeding one command's output into another command, to pipeline two commands (or cmdlets), simply separate them with the pipe symbol (|)  Variables  Can store a command's full output, variables in PowerShell scripts are prefixed with $  @ symbol  This symbol can turn the contents of a list into an array
  • 11. Set-Execution Policy Restricted : Scripts won't run RemoteSigned : Locally-created scripts will run AllSigned : Scripts will only run if signed by a trusted publisher Unrestricted : All scripts will run regardless of who created them and whether or not they are signed
  • 12. Script Example $colItems = get-wmiobject -class "Win32_Printer" -namespace "rootCIMV2" - computername $strComputer
  • 13. Powershell Classes  Class  Definition of a template for creating objects. The class can define properties (data fields) and methods (the way to perform a task)  Object  An object is created from a class definition. New-Object cmdlet is used to create an object  Module  A PowerShell module is a .psm1 file that contains one, or more, PowerShell functions – usually advanced functions.
  • 14. Class Syntax  Class <Class_Name>  {  #Properties  <Data_Type> $<Variable_Name>  }  #Methods  [Return Type] <Method_Name> {  # Script  }  #Creating an object  $<Object_Name> = New-Object –TypeName <Class_Name>  #Calling a method  <Object_Name>.<Method_Name>()
  • 15. Class Example class Person { #Properties [string]$lastName [string]$firstName #Methods [void] SetLast ( [string]$ln ) { $this.lastName = $ln } [string] ToString ( [String]$firstName, [String]$lastName ) { return $firstName + " " + $lastName } }# end class Person
  • 16. Summary  Powershell is a task automation tool built on .Net framework with interactive command line shell and editor  Scripting language designed specially for administrative tasks  Built-in Windows PowerShell commands, called cmdlets, that allows us to manage the computers from the command line  5 basic cmdlets to get started with Powershell  Powershell script files have a .PS1 extension  Scripting in Powershell supports pipelining and can handle functions, branching, loops and exception handling  Execution Policy for running scripts in Powershell for avoiding malicious code execution  Powershell classes contains properties and methods; Objects can be created with New-Object cmdlet
  • 17. Resources  https://msdn.microsoft.com/en-us/powershell/scripting/core- powershell/ise/introducing-the-windows-powershell-ise  https://blogs.technet.microsoft.com/heyscriptingguy/2015/01/02/wh at-is-powershell/  https://msdn.microsoft.com/en-us/library/ms714395(v=vs.85).aspx  http://www.howtogeek.com/114344/5-cmdlets-to-get-you-started- with-powershell/  https://technet.microsoft.com/en-us/library/cc732114(v=ws.10).aspx  https://technet.microsoft.com/en-us/scriptcenter/dd742419

Editor's Notes

  • #5: Before getting to know more about Powershell, Let's see how we can install Powershell in Mac. Powershell is a product of Microsoft Windows but has recently become cross-platform and is now available for Mac / Linux.I have provided two links from where you can download the package for any platform. I will now demonstrate how to install and use Powershell in Mac. First you need to download the.pkg  file from the mentioned link,once you have downloaded click on the file and follow theinstallation instruction. After the installation is complete open terminal window