• No results found

Jeffrey Snover Distinguished Engineer & Lead Architect Jason Helmick Senior Technologist, Concentrated Technology

N/A
N/A
Protected

Academic year: 2021

Share "Jeffrey Snover Distinguished Engineer & Lead Architect Jason Helmick Senior Technologist, Concentrated Technology"

Copied!
96
0
0

Loading.... (view fulltext now)

Full text

(1)

Jeffrey Snover | Distinguished Engineer & Lead Architect

(2)

Meet Jeffrey Snover | ‏@jsnover

• Distinguished Engineer & Lead Architect for Windows Server & System Center Division

– Inventor of Windows PowerShell

– Responsible for setting long term technical vision for these products and running the technology planning for the releases

• Over 30 years of industry experience

– Microsoft, Tivoli, NetView, DEC

– Held 8 patents prior to joining Microsoft, and has registered 30 since. – Frequent speaker at industry and research conferences on a variety of

(3)

Meet Jason Helmick | ‏@theJasonHelmick

• Senior Technologist, Concentrated Technology

– Board member and CFO – PowerShell.Org

– Author‏“Learn‏Windows‏IIS‏‏in‏a‏Month‏of‏Lunches” – Contributing‏author‏“PowerShell‏Deep‏Dives”

• 25 year IT veteran

– Speaker at a variety of industry conferences

– Teaches PowerShell for the IT pro to maximize management and automation

– Frequent contributor to TechNet Magazine and other industry publications

(4)

Course Topics

Getting Started with PowerShell

01‏|‏‏Don’t‏fear‏the‏shell 06 | The pipeline : Deeper

02 | The Help system 07 | The Power in the Shell - Remoting 03 | The pipeline : Getting connected 08 | Getting prepared for automation 04 | Extending the shell 09 | Automation in scale - Remoting

(5)

Setting Expectations

• Target Audience

– Tailored for the IT pro that needs to improve management and automation

– Fast paced for the real world

• Suggested Prerequisites/Supporting Material

– Experience working as a Windows IT pro/Admin/Help Desk – Get answers in the forums at PowerShell.Org

– Check‏out‏“Learn‏Windows‏PowerShell‏3 in‏a‏Month‏of‏Lunches”‏by‏ Don Jones and Jeffery Hicks

(6)

• Microsoft Virtual Academy

– Free online learning tailored for IT Pros and Developers – Over 1M registered users

– Up-to-date, relevant training on variety of Microsoft products

• “Earn‏while‏you‏learn!”‏

– Get 50 MVA Points for this event!

– Visit http://aka.ms/MVA-Voucher

– Enter this code: PowerJump1 (expires 8/15/2013)

(7)

01 |‏Don’t‏fear‏the‏shell

Jeffrey Snover | Distinguished Engineer & Lead Architect

(8)

• The purpose for PowerShell

• Installing PowerShell – Windows Management Framework • Launching PowerShell for the administrator

• Customize the shell for comfort • Getting familiar with the shell

(9)

The Purpose to PowerShell

• Improved management and automation • Manage real-time

• Manage large scale

YOU

YOU

YOU

(10)

Installing PowerShell – Windows Management

Framework

• PowerShell V3 – Windows 8 and Server 2012 • PowerShell V2 – Windows 7 and Server 2008

• Download the Windows Management Framework 3.0 at •

http://www.microsoft.com/en-us/download/details.aspx?id=34595

(11)
(12)
(13)

Getting familiar with the shell

• Cmdlets : Verb – Noun • Native commands work!

• Examples – Ping, IPConfig, calc, notepad, mspaint

• cls - Clear-Host • cd - Set-Location

• dir, ls - Get-Childitem • type, cat - Get-Content • Copy, cp - Copy-item

(14)
(15)

02 | The Help system

Jeffrey Snover | Distinguished Engineer & Lead Architect

(16)

• Why you need help • Updatable Help

• Discoverability with the Help system • Understanding Syntax

• Real-World using Help

(17)

Why you need help

• Vast resource at your finger tips to help make you successful • Don’t‏memorize‏– Discover!

• Thousands of cmdlets – all have help! • Scripting resources and information

(18)

Updatable Help

• Update to the latest version of Help • Save-Help to save to a local location

(19)

Discoverability with the Help system

• Get-Help versus Help and Man • Help <cmdlet>

• Help *partial*

• Help <verb/noun> • Help <cmdlet> -Full

• Help <cmdlet> -Online

• Help <cmdlet> -ShowCommand • Get-Help About_*

(20)

Understanding Syntax

• The meaning of Syntax • Parameter sets

- Indicates A Parameter

<> Indicates Arguments

[] Argument Accepts Multiple Values [Param] is Positional

(21)
(22)
(23)

03 | The Pipeline : Getting Connected

Jeffrey Snover | Distinguished Engineer & Lead Architect

(24)

• What’s‏the‏pipeline‏and‏what‏does‏it‏do? • Exporting/Importing CSV

• Exporting/Importing XML • Other files and printers

• Displaying information in a GUI

• Making a webpage of information • Cmdlets that kill

(25)

What’s‏the‏pipeline‏and‏what‏does‏it‏do?

Pipe character located above the Enter key

Connects cmdlets to produce better results

(26)
(27)
(28)
(29)
(30)
(31)

Cmdlets that kill

• Stop-Process / kill • Stop-service • $ConfirmPreference • $WhatIfPreference • -Confirm • -Whatif

(32)
(33)

04 | Extending the Shell

Jeffrey Snover | Distinguished Engineer & Lead Architect

(34)

• Like the MMC – One Shell does it all • Finding and adding Snap-ins

• Finding and adding Modules • Discovering new commands • The real world of cmdlets

(35)
(36)
(37)

Finding & Adding Modules

PowerShell V3 dynamically imports modules when you use

(38)
(39)
(40)
(41)

05 | Object for the Admin

Jeffrey Snover | Distinguished Engineer & Lead Architect

(42)

• Object across the pipeline

• Getting the information you need • Sorting Objects

• Selecting Objects • Custom Properties • Filtering data

• Methods – When no cmdlet exists

(43)
(44)

Getting the information you need

• Get-Member (gm)

• TypeName is a unique

Windows assigned name

• Displays the properties

and methods of an object

• Properties are potential

columns of information

• Methods are the

potential actions that can be taken

(45)

Sorting Objects

• Sort-Object sorts properties.

• Use Get-Member to see a list of properties

(46)

Selecting Objects

• Select-Object selects

properties.

• Use Get-Member to list

properties to select from.

• -first and -last restrict list of

(47)
(48)
(49)

Comparison Operators

• Comparison returns

boolean True or False

• Comparison can be

case-sensitive using ‘c’ prefix

• For complete description,

(50)
(51)
(52)

06 | The Pipeline : Deeper

Jeffrey Snover | Distinguished Engineer & Lead Architect

(53)

• How the pipeline really works - The 4 step solution 1. ByValue

2. ByPropertyName

3. What‏if‏my‏property‏doesn’t‏match‏– Customize it! 4. The Parenthetical – when all else fails

(54)
(55)

ByValue

1. Get-Service passes ServiceController objects to the pipeline

2. Does Stop-Service accept ServiceController Objects?

3. Help Stop-Service -Full

displays a parameter that accepts ServiceController ByValue

(56)
(57)

ByPropertyName

2. Stop-Service does not support accepting

Process” objects ByValue, so PowerShell checks what can be accepted ByPropertyName.

1. Get-Process is passing a “Process” Object

3. -Name does accept strings ByPropertyName, and the objects in the pipeline are labeled as a Name property

4. StopService attempts to use the objects for its -Name, in this example, fails

(58)
(59)

The Parenthetical – when all else fails

Parenthesis don’t rely on binding and

attach information directly to the desired parameter.

1. I want to pass a list of computer names to Get-Service. Why does this fail?

2. -Name and -InputObject accept pipeline input ByValue, not

-Computername. -Name accepts text, and then causes the failure.

(60)

The Parenthetical – when all else fails

Returns a collection (table) of objects.

(61)
(62)

07 | The Power in the Shell - Remoting

Jeffrey Snover | Distinguished Engineer & Lead Architect

(63)

• Overview of Remoting • Enable Remoting

• One-To-One • One-To-Many • Not the end yet!

(64)
(65)

Enable Remoting

Computer Configuration/Policies/Administrative

Templates/Windows Components/Windows Remote Management

PowerShell Remoting is already enabled in

(66)
(67)
(68)

PowerShell Web Access

• PowerShell – Anywhere, anytime, on any device!

• Install-WindowsFeature –Name WindowsPowerShellWebAccess • Get-Help *Pswa*

• Install-PswaWebApplication –UseTestCertificate

• # Use the –useTestCertificate for testing (Expires in 90 days)

• Add-PswaAuthorizationRule –userName <Domain\User | Computer\user> -ComputerName <Computer> -ConfigurationName AdminsOnly

(69)

Not the end yet!

• More to come!

• Managing in scale and in real time! • Automation and scripting!

• Great resource: Free!

• Secrets of PowerShell Remoting – Don Jones and Tobias Weltner • http://powershell.org/wp/powershell-books/

(70)
(71)

08 | Getting prepared for automation

Jeffrey Snover | Distinguished Engineer & Lead Architect

(72)

• PowerShell security goals • Execution Policy

• Variables : a place to store stuff • Fun with Quotes

• Getting and displaying input

• Other output for scripts and automation

(73)

PowerShell security goals

• Secured by default • Prevents mistakes by

unintentional admins and users

• No Script Execution • .Ps1 associated with

notepad

• Must type path to execute a

(74)

Execution Policy

• By default, PowerShell does

not run scripts.

• Get/Set-ExecutionPolicy • Restricted • Unrestricted • AllSigned • RemoteSigned • Bypass • Undefined

• Can be set with Group

(75)

Variables: A place to store stuff

• Use $ to create and use

variables

• Can contain letters,

numbers, spaces and underscores

• Don’t persist after Shell exits • New-Variable

• Set-Variable • Get-Variable • Clear-Variable • Remove-Variable

• Can force a type – [int]$var

Note: The $ is not part of the variable name, it’s a cue to access the

(76)

Fun with Quotes

• Double Quotes resolve all

variables

• Can use Sub-Expressions • Single Quotes prevent

substitution • Get-Help About_Quoting_Rules • Back-tick/Grave-Accent prevents individual substitution

(77)
(78)

Other output for scripts and automation

• Write-Warning • Write-Verbose • Write-Debug • Write-Error

$Preference variables to know

Help about_Preference_Variables

$DebugPreference=SilentlyContinue

$ErrorActionPreference=Continue

(79)
(80)

09 | Automation in scale - Remoting

Jeffrey Snover | Distinguished Engineer & Lead Architect

(81)

• Reusable Sessions

• Sessions with Invoke-Command

• Real-world deployment of a website • Getting commands from anywhere

(82)

Reusable Sessions

Can be disconnected and reconnected in

(83)
(84)

Real-world deployment of a website

(85)

Getting commands from anywhere -

(86)
(87)

10 | Introducing scripting and toolmaking

Jeffrey Snover | Distinguished Engineer & Lead Architect

(88)

• The new ISE

• Making commands repeatable

• Adding parameters to your script • Documenting your script

• Turning your script into a tool for others • Storing your tools in a module

(89)
(90)
(91)
(92)
(93)
(94)
(95)
(96)

©2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics 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.

References

Related documents

Quantitative Research Instrument: PES-NWI • Components: Five (5) Doctor Nurse Relationship, Staff Resource Adequacy, Nurse Manager’s Ability, Nurse Participation &amp;

There are various Names, by which the Philosophers call it, as Sol, Gold, Brass of the Philosophers, Magnesia, the pure Body, clear Ferment, Elixir, Masculine, Fixt Argent Vive,

Buna Laminar(yapraklı) Boundary Layer(Sınır Tabakası) denir.Boundary Layer , hava moleküllerinin yüzeye en yakın geçtiği sınırdır.Hücum açısının(AOA-Angle Of

13 © 2020 Glaukos Corporation PRECLINICAL INITIAL TRIAL PIVOTAL TRIAL FDA SUBMISSION APPROVAL / TARGET IOP Sensor Glaucoma Summary Glaucoma Portfolio Micro-Surgical Devices

This research found emotional product buying motive that influence online game players decide to purchase virtual goods are pride/prestige, emulation or

Another definition in which considered as a broad definition was given by European Federation of Sport Psychology (FEPSAC), where FEPSAC defined sport psychology as, ‘Sport psychology

Lead and business architects must place a greater focus on business and behavioral competencies than the technical architect, since they need to work closely with business people

q   The Excelsior Real Property Tax Credit: Available to firms locating in. certain distressed areas and to firms in targeted industries that meet higher employment and