bringing home the bacon - spiceworks › u › gen › may2016 › 2016spiceworldlon… ·...
TRANSCRIPT
Bringing Home The BaconAn Introduction to Windows PowerShell
ThomasLeePartner,PSPartnership@DoctorDNS onTwitterTflonSpiceworks
• WhatIS PowerShell?• WhatareCmdlets,ObjectsandThePipeline?• PowerShellinWindowsandWindowsApplications• WhyPowerShellMatterstoYOU• DesiredStateConfiguration• Questions
•PowerShell is thefutureofWindowsadministration•PowerShellmakesyourlifeeasier•PowerShellmagnifiesyoureffort•WithPowerShell youhavemoretimetoenjoyandconsume bacon• Letmeshowyouhowandwhy!
•Microsoft’s StrategicTaskAutomationPlatformforITPros• Itcontains• Shell– thinkUnixlikeintermsofusefulness• ScriptingLanguage– withthepowerofPerlorRuby• Extensible– bringonthecommunity
• Basedon.NET– Microsoftfocused,but…
Cmdlets Objects Pipeline
• Aunitoffunctionality– muchlikeaLinuxcommand• Implementedasa.NETClass
• GetsomewithPowerShell/Windows• Buysome– e.g./nSoftware’sNetCmdlets• Findsome– leveragethecommunityefforts• Buildyourown– useC#andVS
• Cmdlets namedwithaVerb-Noun syntax• Verbsarestandardtoaiddiscovery
• Cmdlets canhavealiases• Built inoraddyourown• AliasesdoNOTincludeparameteraliasingL
• Cmdlets comefromPowerShell,Windows,apps
•Cmdlets takeparameters•Allparameters haveparameternames• Beginwitha‘-’
•Someparameternamescanbeomitted•Tabcompletion isyourfriend!•Cmdlets arediscoverable – Get-Help,Get-Command
• Cmdlets/Functionspackagedintomodules• Modulescanbedynamicallyloaded• Youcandevelopyourownmodules
• Acomputerabstractionofareallifething• Aprocess• Aserver• AnADUser
• InPowerShelleverything isanobject
• Objectshaveoccurrencesyoumanage• Theprocessesrunningonacomputer• TheusersinanOU• Thefiles inafolder
• Objectsdramaticallysimplifiesscripting
• PowerShellsupports:• .NETobjects• COMobjects• WMIobjects• CustomObjects
• Syntaxandusagevary– similar,yetdifferent
• Cmdlets produceandconsumeobjects• E.g.Get-ProcessproducesobjectsofthetypeSystem.Diagnostics.Process
• Objectsarediscoverable• Get-Member tellsyouthewhatanobjectcontains
• RefertoMSDNdocumentationformoredetail
• Thepipelineconnectscmdlets• Onecmdletoutputsobjects• Nextcmdletusesthemasinput
• Pipelineisnotanewconcept• CameFromUnix/Linux• PowerShellPipesobjectsnottext
• Simpletouse– fareasiertocompose• Powerfulinoperation- PowerShell(and.NET)dotheheavylifting• Improvesintegrationoffunctionalitystacks
• OS/Application/PowerShellbase/Communityefforts/etc
• AkeyconceptinPowerShell• Whatyouknowhelpsyoulearnmore• PowerShellbuilttobediscoverable
• Get-Command – helpsyoutofindcmdlet/functionnames• Get-Help– getsyoudetailsonaspecificcmdlets/function• Get-Member– pipeyouroutputtoGet-Membertodiscoverwhatitis
CmdletsPipelineObjects
Discovery
Demo Time
• Youneverwalkalone=>thereisaHUGEPowerShellecosystem• Spiceheads• Productteams• Vendors
• Variouswaystoengagewiththecommunity• Spiceworks PowerShellGroup• Blogs• Twitter
• PowerShellhasalanguage• Thisisusedtocreatescripts,scriptcmdlets,etc.• SyntaxsimilartoC#,etal• LanguagecontainsfeaturesfromUnix/Linuxandabunchofothers• Youneedtoknowthelanguagetowritescripts
• Aricherenvironment• Doescolourcodingofsyntax• Goodeditingfeatures• Extensible
• CoremodulescomewithWindows• AdditionalmodulescomewithWindowsfeatures• MoremodulecomewithWindowsapps• Evenmoremodulescomefromthecommunity
• V3BuiltintoWin8,Server2012• V4BuiltintoWin8.1,Server2012R2• V5inWindows10andavailablefordownload• V5.1inWin10AEandServer2016TP5
• Somebuiltin• SomewithServerfeatureand/orRSATtools• Somedownloadable(eg Azure)• Some3rd partycommercial• UsePowerShellGet moduletofindandinstallmore!
• DSC– DesiredStateConfiguration• Youdefineaconfiguration
• PowerShellDSC– Makes itso!• PowerShellDSC– KEEPSitso!
• Today– DSCisstillaworkinprogress• Only12fullyreleasedresourcesinV5• Loadsmorebeingdeveloped– manyarestable• Windows10helps,butWindowsServer2016shouldhavemore• Themoveisnowtoplacethese intoPSGallery – online
• Becauseit’severywhere!• It’sfasterforrepetitivetasks• It’srepeatableandauditable• Lesspronetoerror
• Books/blogs/forums• Microsoftandothertrainingcourses• Getyourcompanytosponsoraclass• Learnbydoing
• First,removecmd.exefromyoursystem• UsePowerShelleverywhere
• UsePowerShellforasmuchasyoucan• AskquestionsonSpiceworks
• MasterPowerShell• Andbringhomethebacon
• IfyouareanITProintheWindowsspaceyouneedtoeither• LearnPowerShell• Learnhowtosmilewhenyousay‘wouldyoulikefrieswiththat’