SlideShare a Scribd company logo
Windows PowerShell  The Next Generation Command Line Scripting Phan Quoc Hien  B110077
Agenda Introduction What is Windows PowerShell? Using PowerShell How can I script with Windows PowerShell? PowerShell and .net How .net developers will benefit from PowerShell
Introduction What is PowerShell?
What is PowerShell Revolutionary new interactive shell and scripting language Based on .NET New set of built-in tools (+120) Can continue to use current tools Can continue to use current automation (COM) Allows access to data stores as  easy  to access  as file systems
Why? Try things out in an interactive shell Stitch things together with utilities Put the results in a script file  Generalize Clean it up    production-quality Be more Productive Secure by default
Where ? Supported on Windows XP and above Microsoft Products Exchange 2007 System Center (Family) 2007 New Management Architecture based on PowerShell Windows Server 2008 None Microsoft Products IBM WebSphere MQ 6 VMWare InfrastructureToolkit
Using PowerShell
How to start? PowerShell is a free download from Microsoft Separate download for each windows version
The basics Syntax:  verb-noun  –parameter   arguments Always singular, parameters starts with “ - ” Examples: > Get-Process –name ie* > Get-Process ie* > Get-Service > Read-Host “Please Enter a number”
The basics (cont’d) You can alias Set-Alias gps Get-Process Parameters can be positional gps –ProcessName notepad gps notepad Many parameters can be wildcarded gps note* Partial parameter names allowed Gps –p notepad
Variables Not case-sensitive Default value is $null Cmdlets to manage variables Clear-Variable Get-Variable New-Variable Remove-Variable Set-Variable
Variables (cont’d) Types User created variables Automatic variables Created by PowerShell to maintain its state Cannot be modified Examples: $PSHome, $$, $^, $?, etc Preference variables Created by PowerShell to store user preferences Can be modified Examples: $MaximumHistoryCount, etc
Aliases Alternate names for cmdlets Cmdlets to manage aliases Export-Alias Get-Alias Import-Alias New-Alias Set-Alias Cannot take parameters Workaround: put the statement in a script and alias to that Example: Dir, ls, gcm, gci, etc
Conditional & Looping Conditional statements If Switch l.ooping For For ($i=0;$i –le 10;$i++)  {Write-Host $i} Foreach Used on a collection of items Foreach ($name in $namesArray) { Write-Host $name } Do Do { Write-Host $i; $i++ } while ($i –le 10) Do { Write-Host $i;$i++} Until ($i –lt 10) While While ($i –le 10) { Write-Host $i;$i++ }
Operators Comparison operators -ne, -eq, -lt, -gt, -ge, -le, -like, -notlike, -contains, -notcontains, -match, -notmatch Logical operators -or, -and, -xor, -not, ! Arithmetic operators Assignment operators
Getting Help Get-Command Gets a list of all commands  Get-Help Shows help for a given cmdlet Get-Member Gets members of an object Get-PSDrive Shows information stores in PowerShell About_Topics Get-Help about*
Trusting Operations Commands with side-effects support: Whatif Stop-Service win* –WhatIf Confirm Stop-process S* -Confirm Verbose
Security is key for PowerShell By default, only interactive usage allowed If you want to use scripting, you need to change the  ExecutionPolicy Get-ExecutionPolicy / Set-ExecutionPolicy PS1 files opened with Notepad by design
Finding Data in Data Stores Data stores surfaced as “Drives” Filesystem, Registry, Alias, Certs, Env, Functions, Variables, etc. > Get-PSDrive > dir  HKLM:\SOFTWARE\Microsoft Rich common semantics > Dir  \logs –Include *.txt –Exclude A* -Recurse Tab-Completion in all Drives > Dir HKLM:\So<TAB>\Mi<TAB> => HLKM:\Software\Microsoft Demo 1 : File System Navigation Demo 2 : Registry Navigation Demo 3 : Environment Variables Navigation
 
Out-Thankyou PS C:\> Thank you for your time and attention. Good luck in your PowerShell Adventures! PS C:\>

More Related Content

ODP
nginx mod PSGI
PPTX
PHP Optimization
KEY
Kansai.pm 10周年記念 Plack/PSGI 入門
PPT
Php optimization
PPT
Why and How Powershell will rule the Command Line - Barcamp LA 4
PDF
ElePHPant7 - Introduction to PHP7
PPTX
Introduction To Power Shell
PDF
Service Oriented Web Development with OSGi - C Ziegeler
nginx mod PSGI
PHP Optimization
Kansai.pm 10周年記念 Plack/PSGI 入門
Php optimization
Why and How Powershell will rule the Command Line - Barcamp LA 4
ElePHPant7 - Introduction to PHP7
Introduction To Power Shell
Service Oriented Web Development with OSGi - C Ziegeler

What's hot (20)

PDF
Is writing performant code too expensive?
PDF
Mysqlnd, an unknown powerful PHP extension
ODP
Php in 2013 (Web-5 2013 conference)
PPTX
PHP for hacks
PDF
Php extensions workshop
PPT
Php mysql
PPTX
Php server variables
PDF
New Features in PHP 5.3
PDF
What's new in PHP 5.5
KEY
Using PHP
PDF
Pycon - Python for ethical hackers
PDF
Profiling php5 to php7
PPTX
利用Init connect做mysql clients stat 用户审计
PDF
DIG1108C Lesson3 Fall 2014
PPTX
Phphacku iitd
PDF
Review unknown code with static analysis
PDF
Diving into HHVM Extensions (PHPNW Conference 2015)
PDF
PHP 7 new engine
Is writing performant code too expensive?
Mysqlnd, an unknown powerful PHP extension
Php in 2013 (Web-5 2013 conference)
PHP for hacks
Php extensions workshop
Php mysql
Php server variables
New Features in PHP 5.3
What's new in PHP 5.5
Using PHP
Pycon - Python for ethical hackers
Profiling php5 to php7
利用Init connect做mysql clients stat 用户审计
DIG1108C Lesson3 Fall 2014
Phphacku iitd
Review unknown code with static analysis
Diving into HHVM Extensions (PHPNW Conference 2015)
PHP 7 new engine
Ad

Viewers also liked (20)

PPT
Are you ready for camp?
KEY
Community building 541
PPTX
PostgreSQL - Features and application of PostgreSQL database management systems
PDF
Intervento del presidente
KEY
Internet for instruction 541
PDF
Intervento del presidente
PPS
Chinacityinthemountains
PPTX
ISOTECH ASC Wax
PPT
Corporate parent linkages.pdf
PPTX
Artforms of the 20th century
PPS
Istina.o.raku.pluca
PPT
да здравствует вежливость и доброта
KEY
Community building 541
KEY
Internet for instruction 541
KEY
Internet for instruction 541
PPS
Thebirds sex1
PDF
CONSIUS IT CONSULTING AND HR SERVICES (P) LTD
PPTX
541networking
PPS
PPTX
541networking
Are you ready for camp?
Community building 541
PostgreSQL - Features and application of PostgreSQL database management systems
Intervento del presidente
Internet for instruction 541
Intervento del presidente
Chinacityinthemountains
ISOTECH ASC Wax
Corporate parent linkages.pdf
Artforms of the 20th century
Istina.o.raku.pluca
да здравствует вежливость и доброта
Community building 541
Internet for instruction 541
Internet for instruction 541
Thebirds sex1
CONSIUS IT CONSULTING AND HR SERVICES (P) LTD
541networking
541networking
Ad

Similar to NIIT ISAS Q5 Report - Windows PowerShell (20)

PPT
Powershell Seminar @ ITWorx CuttingEdge Club
PDF
Introduction to PowerShell
PPT
Introduction to PowerShell
PPTX
Getting Started With PowerShell Scripting
PPTX
Introduction to powershell
PPTX
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
PPTX
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
PPTX
PowerShell-1
PPTX
PowerShell 101
PPT
No-script PowerShell v2
PPTX
Powershell Tech Ed2009
PPTX
Power shell training
PPTX
Introduction to windows power shell in sharepoint 2010
PPTX
NZ Code Camp 2011 PowerShell + SharePoint
PDF
Learn Powershell Scripting Tutorial Full Course 1dollarcart.com.pdf
PDF
Sql Server & PowerShell
PPT
PowerShell Core Skills (TechMentor Fall 2011)
PDF
Basic commands for powershell : Configuring Windows PowerShell and working wi...
PDF
Ansible new paradigms for orchestration
PPTX
Windows power shell basics
Powershell Seminar @ ITWorx CuttingEdge Club
Introduction to PowerShell
Introduction to PowerShell
Getting Started With PowerShell Scripting
Introduction to powershell
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
PowerShell-1
PowerShell 101
No-script PowerShell v2
Powershell Tech Ed2009
Power shell training
Introduction to windows power shell in sharepoint 2010
NZ Code Camp 2011 PowerShell + SharePoint
Learn Powershell Scripting Tutorial Full Course 1dollarcart.com.pdf
Sql Server & PowerShell
PowerShell Core Skills (TechMentor Fall 2011)
Basic commands for powershell : Configuring Windows PowerShell and working wi...
Ansible new paradigms for orchestration
Windows power shell basics

Recently uploaded (20)

PPTX
Pradeep Kumar Roll no.30 Paper I.pptx....
PDF
The Zeigarnik Effect by Meenakshi Khakat.pdf
PDF
My 'novel' Account of Human Possibility pdf.pdf
PPTX
SELF ASSESSMENT -SNAPSHOT.pptx an index of yourself by Dr NIKITA SHARMA
PPTX
Learn how to use Portable Grinders Safely
PDF
Attachment Theory What Childhood Says About Your Relationships.pdf
PPTX
diasspresentationndkcnskndncelklkfndc.pptx
PPT
cypt-cht-healthy-relationships-part1-presentation-v1.1en.ppt
PPTX
PERDEV-LESSON-3 DEVELOPMENTMENTAL STAGES.pptx
PDF
Top 10 Visionary Entrepreneurs to Watch in 2025
PPTX
Learn how to prevent Workplace Incidents?
PDF
SEX-GENDER-AND-SEXUALITY-LESSON-1-M (2).pdf
PDF
The Power of Pausing Before You React by Meenakshi Khakat
PPTX
Commmunication in Todays world- Principles and Barriers
PPTX
Identity Development in Adolescence.pptx
PDF
The Spotlight Effect No One Is Thinking About You as Much as You Think - by M...
PPTX
Emotional Intelligence- Importance and Applicability
PDF
⚡ Prepping for grid failure_ 6 Must-Haves to Survive Blackout!.pdf
PPTX
Learn numerology content and join tarot reading
PPTX
cấu trúc sử dụng mẫu Cause - Effects.pptx
Pradeep Kumar Roll no.30 Paper I.pptx....
The Zeigarnik Effect by Meenakshi Khakat.pdf
My 'novel' Account of Human Possibility pdf.pdf
SELF ASSESSMENT -SNAPSHOT.pptx an index of yourself by Dr NIKITA SHARMA
Learn how to use Portable Grinders Safely
Attachment Theory What Childhood Says About Your Relationships.pdf
diasspresentationndkcnskndncelklkfndc.pptx
cypt-cht-healthy-relationships-part1-presentation-v1.1en.ppt
PERDEV-LESSON-3 DEVELOPMENTMENTAL STAGES.pptx
Top 10 Visionary Entrepreneurs to Watch in 2025
Learn how to prevent Workplace Incidents?
SEX-GENDER-AND-SEXUALITY-LESSON-1-M (2).pdf
The Power of Pausing Before You React by Meenakshi Khakat
Commmunication in Todays world- Principles and Barriers
Identity Development in Adolescence.pptx
The Spotlight Effect No One Is Thinking About You as Much as You Think - by M...
Emotional Intelligence- Importance and Applicability
⚡ Prepping for grid failure_ 6 Must-Haves to Survive Blackout!.pdf
Learn numerology content and join tarot reading
cấu trúc sử dụng mẫu Cause - Effects.pptx

NIIT ISAS Q5 Report - Windows PowerShell

  • 1. Windows PowerShell The Next Generation Command Line Scripting Phan Quoc Hien B110077
  • 2. Agenda Introduction What is Windows PowerShell? Using PowerShell How can I script with Windows PowerShell? PowerShell and .net How .net developers will benefit from PowerShell
  • 3. Introduction What is PowerShell?
  • 4. What is PowerShell Revolutionary new interactive shell and scripting language Based on .NET New set of built-in tools (+120) Can continue to use current tools Can continue to use current automation (COM) Allows access to data stores as easy to access as file systems
  • 5. Why? Try things out in an interactive shell Stitch things together with utilities Put the results in a script file Generalize Clean it up  production-quality Be more Productive Secure by default
  • 6. Where ? Supported on Windows XP and above Microsoft Products Exchange 2007 System Center (Family) 2007 New Management Architecture based on PowerShell Windows Server 2008 None Microsoft Products IBM WebSphere MQ 6 VMWare InfrastructureToolkit
  • 8. How to start? PowerShell is a free download from Microsoft Separate download for each windows version
  • 9. The basics Syntax: verb-noun –parameter arguments Always singular, parameters starts with “ - ” Examples: > Get-Process –name ie* > Get-Process ie* > Get-Service > Read-Host “Please Enter a number”
  • 10. The basics (cont’d) You can alias Set-Alias gps Get-Process Parameters can be positional gps –ProcessName notepad gps notepad Many parameters can be wildcarded gps note* Partial parameter names allowed Gps –p notepad
  • 11. Variables Not case-sensitive Default value is $null Cmdlets to manage variables Clear-Variable Get-Variable New-Variable Remove-Variable Set-Variable
  • 12. Variables (cont’d) Types User created variables Automatic variables Created by PowerShell to maintain its state Cannot be modified Examples: $PSHome, $$, $^, $?, etc Preference variables Created by PowerShell to store user preferences Can be modified Examples: $MaximumHistoryCount, etc
  • 13. Aliases Alternate names for cmdlets Cmdlets to manage aliases Export-Alias Get-Alias Import-Alias New-Alias Set-Alias Cannot take parameters Workaround: put the statement in a script and alias to that Example: Dir, ls, gcm, gci, etc
  • 14. Conditional & Looping Conditional statements If Switch l.ooping For For ($i=0;$i –le 10;$i++) {Write-Host $i} Foreach Used on a collection of items Foreach ($name in $namesArray) { Write-Host $name } Do Do { Write-Host $i; $i++ } while ($i –le 10) Do { Write-Host $i;$i++} Until ($i –lt 10) While While ($i –le 10) { Write-Host $i;$i++ }
  • 15. Operators Comparison operators -ne, -eq, -lt, -gt, -ge, -le, -like, -notlike, -contains, -notcontains, -match, -notmatch Logical operators -or, -and, -xor, -not, ! Arithmetic operators Assignment operators
  • 16. Getting Help Get-Command Gets a list of all commands Get-Help Shows help for a given cmdlet Get-Member Gets members of an object Get-PSDrive Shows information stores in PowerShell About_Topics Get-Help about*
  • 17. Trusting Operations Commands with side-effects support: Whatif Stop-Service win* –WhatIf Confirm Stop-process S* -Confirm Verbose
  • 18. Security is key for PowerShell By default, only interactive usage allowed If you want to use scripting, you need to change the ExecutionPolicy Get-ExecutionPolicy / Set-ExecutionPolicy PS1 files opened with Notepad by design
  • 19. Finding Data in Data Stores Data stores surfaced as “Drives” Filesystem, Registry, Alias, Certs, Env, Functions, Variables, etc. > Get-PSDrive > dir HKLM:\SOFTWARE\Microsoft Rich common semantics > Dir \logs –Include *.txt –Exclude A* -Recurse Tab-Completion in all Drives > Dir HKLM:\So<TAB>\Mi<TAB> => HLKM:\Software\Microsoft Demo 1 : File System Navigation Demo 2 : Registry Navigation Demo 3 : Environment Variables Navigation
  • 20.  
  • 21. Out-Thankyou PS C:\> Thank you for your time and attention. Good luck in your PowerShell Adventures! PS C:\>

Editor's Notes

  • #2: INF210
  • #3: 10/02/11 11:24 © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  • #5: 10/02/11 11:24 MICROSOFT CONFIDENTIAL © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  • #6: 10/02/11 11:24 © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  • #9: Start NOW !
  • #11: 10/02/11 11:24 © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  • #18: 10/02/11 11:24 © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  • #20: 10/02/11 11:24 © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. Demo Get-PSDrive Show navigation in File System and Registry