SlideShare a Scribd company logo
WINDOWS
POWERSHELL BASICS Robin Aggarwal
What Is PowerShell?
Windows PowerShell includes an interactive prompt and a scripting environment
Commands are object-based
Large set of built-in commands
All shell commands use the same parser
Windows PowerShell 2.0 is installed by default on Windows Server®
2008 R2 and Windows® 7
PowerShell Syntax
Name
Argument
Verb Noun String
PS> get-mailbox –server “smbex01”
Command Parameter
Name Alias Server StorageQuota
---- ---- ------ ------------
Bob Kelly bobk smbex01 unlimited
Kim Akers kima smbex01 unlimited
Property Names
Property Values
Demo: Getting starting with PowerShell
• Powershell Cmd-let[Console]
• Powershell ISE
• Get-Verb
• Getting Help
• Getting Members
Piping and the Pipeline
Cmdlet Filter Sort
Scenario 1
Get-Service| Where-Object {$_.Status –eq “Running”} | Sort-Object Name
Data Types
Shortcut Data Type
[datetime] Date or time
[string] String of characters
[char] Single character
[double] Double-precision floating number
[single] Single-precision floating number
[int] 32-bit integer
[boolean] True or false value
Demo: Variables, Operations and Types
• Creating variables
• Operations
• Using types
• Creating arrays
Powershell Scripts
PowerShell Scripts have the .ps1 extension
Run a Script
C:Scriptssample.ps1
This script will get files and folder stored in
$a = Get-ChildItem
.sample.ps1
Script Security Settings
• Restricted – No scripts can be run. Windows PowerShell can be
used only in interactive mode.
• AllSigned – Only scripts signed by a trusted publisher can be run.
• RemoteSigned – Downloaded scripts must be signed by a trusted
publisher before they can be run.
• Unrestricted – No restrictions; all Windows PowerShell scripts can
be run.
Demo: Working with scripts
• Creating PowerShell scripts
• Running scripts
More features[if time permits]
• Registry [HKLM:]
• Certificates [cert:]
• Environment Variable [env:]
• Variables [variable:]
• Aliases
• Functions
• Extending powershell -> cmdlets
Demo: if time permits
• Killing processes
• Sort examples
• Using .Net examples[int, string, datetime]
• Let us touch AZURE
Capabilities of Powershell?
• Lets write down

More Related Content

PPTX
Windows Azure Automation and Dev/Test for the Enterprise - RightScale Compute...
PDF
Fast C++ Web Servers
PDF
Basic commands for powershell : Configuring Windows PowerShell and working wi...
PPTX
Powershell Demo Presentation
PDF
React Development with the MERN Stack
PPT
Learn ELK in docker
PDF
Google App Engine With Java And Groovy
PPT
A Brief Introduce to WSGI
Windows Azure Automation and Dev/Test for the Enterprise - RightScale Compute...
Fast C++ Web Servers
Basic commands for powershell : Configuring Windows PowerShell and working wi...
Powershell Demo Presentation
React Development with the MERN Stack
Learn ELK in docker
Google App Engine With Java And Groovy
A Brief Introduce to WSGI

What's hot (18)

PDF
WatchOS2
PPTX
Continuous Deployment
PDF
Python in the database
PDF
Ansible with AWS
PDF
What's new in Ansible 2.0
PDF
Distributed Eventing in OSGi
ODP
Introduction to Apache Kafka- Part 2
PDF
Lambda Jam 2015: Event Processing in Clojure
PDF
Fighting Against Chaotically Separated Values with Embulk
ODP
An Introduction to Quill
PPTX
Cassandra Java APIs Old and New – A Comparison
PPTX
Azure sql insert perf
PDF
The Patterns of Distributed Logging and Containers
PDF
Python WSGI introduction
PDF
Slick eventsourcing
PDF
Cassandra Community Webinar | Become a Super Modeler
PPT
Pax Migration Ocs 23062008
PDF
Introduction to Quill
WatchOS2
Continuous Deployment
Python in the database
Ansible with AWS
What's new in Ansible 2.0
Distributed Eventing in OSGi
Introduction to Apache Kafka- Part 2
Lambda Jam 2015: Event Processing in Clojure
Fighting Against Chaotically Separated Values with Embulk
An Introduction to Quill
Cassandra Java APIs Old and New – A Comparison
Azure sql insert perf
The Patterns of Distributed Logging and Containers
Python WSGI introduction
Slick eventsourcing
Cassandra Community Webinar | Become a Super Modeler
Pax Migration Ocs 23062008
Introduction to Quill
Ad

Viewers also liked (7)

PPS
44536 26520-garbanzos-2
PPTX
Cloud Computing
PDF
Module Fiscaliteit (Juli 2010)(Met Logo)
PPT
Aaltoes Presentation
PPS
Tajikistan
PPTX
Wpf-Xaml And Layout Basics
PDF
High Temperature Cabinet Oven by ACMAS Technologies Pvt Ltd.
44536 26520-garbanzos-2
Cloud Computing
Module Fiscaliteit (Juli 2010)(Met Logo)
Aaltoes Presentation
Tajikistan
Wpf-Xaml And Layout Basics
High Temperature Cabinet Oven by ACMAS Technologies Pvt Ltd.
Ad

Similar to Powershell_Basics_Robin (20)

PPTX
Power shell training
PDF
Learn Powershell Scripting Tutorial Full Course 1dollarcart.com.pdf
PPT
PowerShell Core Skills (TechMentor Fall 2011)
PPTX
Power shell basics day 2
PPTX
PowerShell-1
PPTX
Getting Started With PowerShell Scripting
PPTX
Introduction To Power Shell
PPTX
PowerShell 101 - What is it and Why should YOU Care!
PPTX
Power shell training
PDF
Windows Powershell Step By Step 3rd Edition Wilson Ed
PDF
Powershell notes
PPTX
PowerShell 101
PPTX
PowerShell 101
PDF
PowerShell_LangRef_v3 (1).pdf
PPTX
Power shell v3 session1
PPTX
Meet Windows PowerShell
PPT
Introduction to PowerShell
PPTX
PowerShellForDBDevelopers
PPTX
Introduction to PowerShell and getting started
PDF
Windows PowerShell Step by Step 3rd Edition Wilson
Power shell training
Learn Powershell Scripting Tutorial Full Course 1dollarcart.com.pdf
PowerShell Core Skills (TechMentor Fall 2011)
Power shell basics day 2
PowerShell-1
Getting Started With PowerShell Scripting
Introduction To Power Shell
PowerShell 101 - What is it and Why should YOU Care!
Power shell training
Windows Powershell Step By Step 3rd Edition Wilson Ed
Powershell notes
PowerShell 101
PowerShell 101
PowerShell_LangRef_v3 (1).pdf
Power shell v3 session1
Meet Windows PowerShell
Introduction to PowerShell
PowerShellForDBDevelopers
Introduction to PowerShell and getting started
Windows PowerShell Step by Step 3rd Edition Wilson

Powershell_Basics_Robin

  • 2. What Is PowerShell? Windows PowerShell includes an interactive prompt and a scripting environment Commands are object-based Large set of built-in commands All shell commands use the same parser Windows PowerShell 2.0 is installed by default on Windows Server® 2008 R2 and Windows® 7
  • 3. PowerShell Syntax Name Argument Verb Noun String PS> get-mailbox –server “smbex01” Command Parameter Name Alias Server StorageQuota ---- ---- ------ ------------ Bob Kelly bobk smbex01 unlimited Kim Akers kima smbex01 unlimited Property Names Property Values
  • 4. Demo: Getting starting with PowerShell • Powershell Cmd-let[Console] • Powershell ISE • Get-Verb • Getting Help • Getting Members
  • 5. Piping and the Pipeline Cmdlet Filter Sort Scenario 1 Get-Service| Where-Object {$_.Status –eq “Running”} | Sort-Object Name
  • 6. Data Types Shortcut Data Type [datetime] Date or time [string] String of characters [char] Single character [double] Double-precision floating number [single] Single-precision floating number [int] 32-bit integer [boolean] True or false value
  • 7. Demo: Variables, Operations and Types • Creating variables • Operations • Using types • Creating arrays
  • 8. Powershell Scripts PowerShell Scripts have the .ps1 extension Run a Script C:Scriptssample.ps1 This script will get files and folder stored in $a = Get-ChildItem .sample.ps1
  • 9. Script Security Settings • Restricted – No scripts can be run. Windows PowerShell can be used only in interactive mode. • AllSigned – Only scripts signed by a trusted publisher can be run. • RemoteSigned – Downloaded scripts must be signed by a trusted publisher before they can be run. • Unrestricted – No restrictions; all Windows PowerShell scripts can be run.
  • 10. Demo: Working with scripts • Creating PowerShell scripts • Running scripts
  • 11. More features[if time permits] • Registry [HKLM:] • Certificates [cert:] • Environment Variable [env:] • Variables [variable:] • Aliases • Functions • Extending powershell -> cmdlets
  • 12. Demo: if time permits • Killing processes • Sort examples • Using .Net examples[int, string, datetime] • Let us touch AZURE