Windows powershell introduction
Download
1 / 28

Windows PowerShell Introduction - PowerPoint PPT Presentation


  • 114 Views
  • Uploaded on

Windows PowerShell Introduction. Morgan Simonsen morgan.simonsen@ementor.no Ementor. 1. What Will We Cover?. What is Windows PowerShell? How does Windows PowerShell work? How can I use Windows PowerShell?. 2. Helpful Experience. Command line experience; cmd.exe, BASH etc.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Windows PowerShell Introduction' - rowa


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Windows powershell introduction

Windows PowerShell Introduction

Morgan Simonsen

morgan.simonsen@ementor.no

Ementor

1


What will we cover
What Will We Cover?

  • What is Windows PowerShell?

  • How does Windows PowerShell work?

  • How can I use Windows PowerShell?

2


Helpful experience
Helpful Experience

  • Command line experience; cmd.exe, BASH etc.

  • Command line experience; parameters, output etc.

  • Scripting experience (PERL, VBScript, JScript) etc.)

Level 200

3


Microsoft products providing windows powershell cmdlets

Microsoft Products Providing Windows PowerShell Cmdlets

Windows Server “Longhorn”

Windows Vista

Exchange Server 2007

Operations Manager 2007

Virtual Machine Manager

Data Protection Manager “V2”

4


Why powershell
Why PowerShell?

  • As companiesscale-out; managementbecomesvery hard

  • Currenttechnologies; VBScript, WMI, RDP

  • PowerShell willprovide a unifiedmanagementexperience

5



Admin development model
Admin Development Model

  • Try things out in an interactive shell

  • Stitch things together with utilities

  • Put the results in a script file

    • Realize that the tools are unsuitable and restart with a new set of tools

  • Generalize (e.g., parameterize)

  • Clean it up  production-quality

  • Integrate into your environment

  • Share with the community

7


Introducing windows powershell
Introducing Windows PowerShell

  • New Windows command-lineshelldesigned for system administrators

  • Interactive prompt and scripting environment

  • Builton .NET CommonLanguageRuntime (CLR) and .NET Framework

8


Powershell design goals
PowerShell Design Goals

  • Easeofuse

  • Consisencyofsyntax

  • Easeoflearningcurve

9


How is powershell different
How is PowerShell different?

  • PS processesobjects, not text

  • Large set (>100) ofbuilt in commandswithcosistentinterface

  • Commoncommand parser

  • Can run all existingutilities, tools

  • Multiple commandswithoutbatch files (;)

10


Getting and installing powershell
Getting and installing PowerShell

  • Microsoft Downloadsite

  • x86/x64 versionsavailable

  • Installationrequirements:

    • Windows XP SP2, Windows Server 2003 SP1 or later versionsof Windows

    • .NET Framework 2.0

11


Getting and installing powershell continued
Getting and installing PowerShell Continued

  • WinXP, W2K3 Srv: Update.exeinstall

  • Vista/W2K8 Srv: .msu (componentbasedinstall)

  • Install locations:

    • X86:

      • %systemroot%\system32\WindowsPowerShell\V1.0

    • X64:

      • %systemroot%\system32\WindowsPowerShell\V1.0

      • %systemroot%\Syswow64\WindowsPowerShell\V1.0

12


Starting powershell
Starting PowerShell

  • Powershell.exe <parameters>

    • powershell-psconsolefile sqlsnapin.psc1

    • powershell-version 1.0 -nologo -inputformat text -outputformat XML

    • powershell-command {get-eventlog-lognamesecurity}

    • powershell-command "& {get-eventlog-lognamesecurity}”

  • Start Menu

13


Cmdlets command lets
Cmdlets (Command-lets)

  • Built-in, single-featurecommandsthatmanipulateobjects in PS

  • Small and simple, designed to be used togetherwithother cmdlets (pipelining)

  • Comeswithbuilt-inhelp (Get-Help)

  • Use a Verb-Nounnames (Get-Service, Set-Service)

14


Cmdlets command lets structure
Cmdlets (Command-lets) Structure

Name Alias Server StorageQuota

---- ---- ------ ------------

Bob Kelly bobk smbex01 unlimited

Kim Akers kima smbex01 unlimited

Property Names

Property Values

Name

Argument

String

Verb

Noun

MSH> get-mailbox –server “smbex01”

Command

Parameter

15


Cmdlet parameters
Cmdlet parameters

  • Alwaysidentified by -, never /, -- or \

  • Supports concatenation:get-help <command> -det

  • Namescan be omitted:get-help –nameget-alias = get-helpget-alias

16


Getting help in ps
Gettinghelp in PS

  • Get-Helpcmdlet

  • Get-Help <cmdlet>eg. Get-HelpGet-Commandeg. Get-HelpGet-Command –detailedeg. Get-HelpGet-Command –fulleg. Get-HelpGet-Command-examples

  • Get-Helpabout_signing

17


Getting help the 4 pillars of discoverability
Getting help: The 4 Pillars of Discoverability

Get-Command

Get-Help and -?

Get-PSDrive

Get-Members

18


Processing objects
ProcessingObjects

  • PS workswith .NET Objects

  • .NET Objectscontain:

    • Data

    • Properties

    • Methods

19


Learning about objects
Learningaboutobjects

  • Get-Member: displays informationabout .NET objects a cmdletreturnsget-service | get-member

20


Formatting output
Formatting Output

  • PS cmdlets never format data

  • Format cmdlets format data

    • Format-List

    • Format-Table

    • Format-Custom

    • Format-Wide

  • Everycmdlet has default formatting basedonthe format cmdlets, whichyoucan override

21


Aliases
Aliases

  • PS has severalaliases by default (dir, ls, cls, del etc)

  • Display aliases:get-alias

  • Create alias:set-aliasghGet-Help

  • Delete alias:remove-itemalias:gh

22


Some useful cmdlets
Someuseful cmdlets

  • Get-Command

  • Get-Childitem

  • Get-ChildItemProperty

  • Get-Service

  • Get-WMIObject

  • Invoke-Item

23


Using windows programs
Using Windows Programs

  • PS can run all Windows programs

  • Must be in pathstatement($env:path)

  • List:Get-Command *.exe

  • Aliases do not support itsnamesake’sparamteres

24


Tab completion
Tab Completion

  • PS support Tab completions for:

    • Cmdletnames

    • Registrypaths

    • Filesystem paths

    • Certificatepaths

25


Pipelining
Pipelining

  • Cmdlets can be ”piped” together to form complexcommands

  • Output from onecmdletmovealongthe pipe to anothercmdlet

  • PS pipeline operator is | (pipe)

26


For more information
For More Information

  • Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell

  • Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

27


Books about ps
Booksabout PS

28