SlideShare une entreprise Scribd logo
1  sur  34
10 Cool PowerShell V3
Features in Windows 8
and Server 2012
Thomas Lee – doctordns@gmail.com
PowerShell MVP
Agenda
• PowerShell v3 in Windows 8/Server 2012
• My Top 10
• Summary
The Journey to PowerShell 3
• PowerShell v3 has been a long journey
   • Monad Manifesto in 2002
   • V1 with Windows Vista/Server 2008/Exchange 2007
   • V2 with Windows 8 and Server 2008 R2
   • V3 ships with Windows 8 and Server 2012
• Key themes
   • Improving the usability
   • Increasing the surface area
   • Providing plumbing for more, more, more
My Top-10 List
• PowerShell v3 is vast
   • There are hundreds of new features

• This list is arbitrarily
   • But things I like

• The order is arbitrary
   • But all 10 are cool!
10 – PowerShell Web Access
≥ Enabled you to access PowerShell via IIS
≥ A bit like Terminal Services Gateway
How it works
What it Looks Like
What it Looks Like
What it Looks Like
9 - Module Auto-load
• Modules added to PowerShell in v2
  • No modules in v1


• In v2, modules had to be loaded manually

• In v3, if modules are in standard module
  locations (i.e. defined in $env:PSmodulePath),
  Powershell can find the module the cmdlet is
  defined in and then load it auto-magically
PowerShell Module
 Autoload Demo
  (n09.ps1-S1)
8 - Robust Remoting
• Remoting added in v2
   •   But was not robust
   •   Remoting broke at the first sign of trouble
   •   Once broken, often stayed broken
   •   Could be hard to fix

• Under the covers – v3 has benefited from lots of work
   • Simple errors no longer become fatal

• Remoting a highly key part of Server 2012
   • Remoting + Workflow are the basis for the new server
     manager tool
Robust Remoting Demo
    (n08.ps1 – s1)
7 - Updatable Help
• Help a key feature of PowerShell since V1
   • Both on line and in the box
   • Great writing team
   • Fix bugs

• All components shipped with Windows Server 2012 can only
  be updated via normal update mechanism
   • Is it important enough to raise a critical fix for?
   • Is it important enough to raise a recommended hot fix?
   • Is it important enough to be fixed in a Service Pack

• Solution
   • No help „in the box‟ – but…
   • Update-Help to fix that
Updatable Help Demo
  (n07.ps1 – host)
6 – Simplified Syntax
≥ PowerShell had a scripting „wall‟
   Get-Process
   Get-Process| Sort CPU
   Get-Process| Sort CPU| Select Name, Cpu


≥ But what about where
   Get-Process| Where {$_.name –match "power"}
   $_, {},   OH MY!

≥ In v3 – for SINGLE expressions
   Get-Process | Where name –match “power”
6 - More Simplified Syntax
≥ Calling an object method in a pipeline meant
  using Foreach in v2
   Get-Process | where {…} | foreach {$+_.kill()}


≥ Now, really simple
   Get-Process | where {…}   | kill   # NOTE NO ()!


≥ And how about this:
   Dir –AD
   Dir +Hidden
Simplified Syntax Demo
   (n06.ps1 – HOST)
Break for Breath
≥ 10 through 6 so far
      10 - PowerShell Web Service
      9 - Module auto-load
      8 - Robust Remoting
      7 - Updatable Help
      6 - Simplified Syntax for Where/Get-ChildItem
≥ These all make life easier for the IT Pro
      Simplify what you type
      Get better help
      More reliable/robust features
      Extend PowerShell access via the DMZ
5 – ISE Enhancements
≥ In v2 – the ISE was functional
    The minimum upgrade from Notepad for unicode users
    You still wanted 3rd party tools
    ISE could be extended ($PsIse variable)

≥ In v3 – ISE is now nearly at a feature parity with 3rd party
  tools

≥ Some key new features
      2-pane design (in V2 there were 3 panes)
      Intellisense
      Wrapping of regions
      Script Explorer
ISE Script Explorer
≥ Free add-on tool
≥ Created by Microsoft
≥ Allows you to explore for scripts
≥ A great starting point
Getting Script Explorer
Improved ISE
3 - Workflows
≥ Remoting added in v2
      But was not robust
      Remoting broke at the first sign of trouble
      Once broken, often stayed broken
      Could be hard to fix

≥ Under the covers – v3 has benefited from lots of work
    Simple errors no longer become fatal

≥ Remoting a highly key part of Server 2012
    Remoting + Workflow are the basis for the new server
     manager tool
More about Workflows
≥ A workflow is effectively a rich, long-running script that
  can survive reboots

≥ PowerShell workflow based on Windows Workflow
  Foundation
    In effect, Powershell scripts become workflows

≥ Workflows are used, under the covers, with remote
  uses of Server Manger

≥ Workflows are complex and require an entire session
  (a day?) on their own.
Workflows
≥ Workflows similar to PowerShell functions
   Many restrictions owing to work flow
    architecture
≥ Complex to create, especially multi-machine
  work flows
≥ Demo left as an exercise for the reader
2 – Lots of new Modules/Cmdlets
≥ Lots of new modules added!
   Win 8
   Server 2012
≥ Lots of CIM cmdlets
   You can create cmdlets from XML and CIM
LOTS of New stuff
     Demo
 (N02.Ps1 – S1)
1 – PowerShell in Server Core
≥ In Server 2008, Server Core did not support
  PowerShell
≥ In Server 2008 R2, you could add PowerShell
  and .NET to Server Core
   Use Sconfig 42 to install
≥ In Server 2012, PowerShell installed by
  default
   Serve Core starts by defaul in CMD.EXE
   You need to do registry hack to start PowerShell
Changing the Shell to PowerShell
≥   $RegPath =
    "Microsoft.PowerShell.CoreRegistry::HKEY_LOCAL_MACHINESOFTWAREMicroso
    ftWindows NTCurrentVersionwinlogon"

≥   Set-ItemProperty -Confirm -Path $RegPath -Name Shell -Value
               'PowerShell.exe -noExit -Command "$psversiontable'

≥   Reboot-Computer
Adding / Removing The GUI
≥ In Server 2012, you can add/remove the
  GUI
   Turn Server Core into full GUI and back


≥ Just a simple PowerShell command
   But beware of sources
Summary
≥ Lots and lots of new features
   This list barley scratches the surface
≥ Windows 8 and Server 2012 not have
  PowerShell V3 by default
   You can download v3 for Server 2008/R2 and
    Win 7
Call To Action
≥ Upgrade where possible to latest Operating
  Systems
   Server 2012/Windows 8
   Possibly using Windows 7 as a client
≥ With Downlevel clients – upgrade to
  PowerShell V3

≥ Get PowerShell training
   Attend the PowerShell PowerCamp event
    See Http://tfl09.blogspot.com for details
Call To Action - 2
≥ Evaluate the following expression
• “Learn PowerShell Version 3” -OR
•     “Learn to smile and say: „Want fries
  with that?‟”

Contenu connexe

Tendances

Tendances (20)

Automation: PowerShell & DSC
Automation: PowerShell & DSCAutomation: PowerShell & DSC
Automation: PowerShell & DSC
 
Dev112 let's calendar that
Dev112   let's calendar thatDev112   let's calendar that
Dev112 let's calendar that
 
Short-Training asp.net vNext
Short-Training asp.net vNextShort-Training asp.net vNext
Short-Training asp.net vNext
 
Don Wibier
Don WibierDon Wibier
Don Wibier
 
Debugging the Web with Fiddler
Debugging the Web with FiddlerDebugging the Web with Fiddler
Debugging the Web with Fiddler
 
Сергей Калинец "Стероиды для Дотнетчика"
Сергей Калинец "Стероиды для Дотнетчика"Сергей Калинец "Стероиды для Дотнетчика"
Сергей Калинец "Стероиды для Дотнетчика"
 
Debugging your Way through .NET with Visual Studio 2015
Debugging your Way through .NET with Visual Studio 2015Debugging your Way through .NET with Visual Studio 2015
Debugging your Way through .NET with Visual Studio 2015
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
Zend Framwork presentation
Zend Framwork presentationZend Framwork presentation
Zend Framwork presentation
 
Ansible benelux meetup - Amsterdam 27-5-2015
Ansible benelux meetup - Amsterdam 27-5-2015Ansible benelux meetup - Amsterdam 27-5-2015
Ansible benelux meetup - Amsterdam 27-5-2015
 
Zend Framwork configurations
Zend Framwork configurationsZend Framwork configurations
Zend Framwork configurations
 
December OpenNTF Webinar: The Volt MX LotusScript Toolkit
December OpenNTF Webinar: The Volt MX LotusScript ToolkitDecember OpenNTF Webinar: The Volt MX LotusScript Toolkit
December OpenNTF Webinar: The Volt MX LotusScript Toolkit
 
WinOps Conf 2015 - Microsoft Azure & Open Source
WinOps Conf 2015 - Microsoft Azure & Open SourceWinOps Conf 2015 - Microsoft Azure & Open Source
WinOps Conf 2015 - Microsoft Azure & Open Source
 
How adding a further tool can be a good thing
How adding a further tool can be a good thingHow adding a further tool can be a good thing
How adding a further tool can be a good thing
 
Manage your environment with DSC
Manage your environment with DSCManage your environment with DSC
Manage your environment with DSC
 
Uklug2012 yellow and blue stream
Uklug2012 yellow and blue streamUklug2012 yellow and blue stream
Uklug2012 yellow and blue stream
 
Introduction to ASP.NET 5
Introduction to ASP.NET 5Introduction to ASP.NET 5
Introduction to ASP.NET 5
 
Dockerizing your java development environment
Dockerizing your java development environmentDockerizing your java development environment
Dockerizing your java development environment
 
Azure Container Services
Azure Container Services Azure Container Services
Azure Container Services
 
Dot Net Core
Dot Net CoreDot Net Core
Dot Net Core
 

En vedette

En vedette (6)

PowerShell 101
PowerShell 101PowerShell 101
PowerShell 101
 
PowerShell Technical Overview
PowerShell Technical OverviewPowerShell Technical Overview
PowerShell Technical Overview
 
Some PowerShell Goodies
Some PowerShell GoodiesSome PowerShell Goodies
Some PowerShell Goodies
 
PowerShell for Cyber Warriors - Bsides Knoxville 2016
PowerShell for Cyber Warriors - Bsides Knoxville 2016PowerShell for Cyber Warriors - Bsides Knoxville 2016
PowerShell for Cyber Warriors - Bsides Knoxville 2016
 
Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShell
 
An Introduction to Windows PowerShell
An Introduction to Windows PowerShellAn Introduction to Windows PowerShell
An Introduction to Windows PowerShell
 

Similaire à Top 10 PowerShell Features in Server 2012

PowerShellForDBDevelopers
PowerShellForDBDevelopersPowerShellForDBDevelopers
PowerShellForDBDevelopers
Bryan Cafferky
 
Automating Active Directory mgmt in PowerShell
Automating Active Directory mgmt in PowerShellAutomating Active Directory mgmt in PowerShell
Automating Active Directory mgmt in PowerShell
Concentrated Technology
 

Similaire à Top 10 PowerShell Features in Server 2012 (20)

Sql Server & PowerShell
Sql Server & PowerShellSql Server & PowerShell
Sql Server & PowerShell
 
PowerShellForDBDevelopers
PowerShellForDBDevelopersPowerShellForDBDevelopers
PowerShellForDBDevelopers
 
Windows PowerShell
Windows PowerShellWindows PowerShell
Windows PowerShell
 
Power shell training
Power shell trainingPower shell training
Power shell training
 
Upgrading from WinS 2008/2008 R2 to WinS 2012
Upgrading from WinS 2008/2008 R2 to WinS 2012Upgrading from WinS 2008/2008 R2 to WinS 2012
Upgrading from WinS 2008/2008 R2 to WinS 2012
 
Server Core2
Server Core2Server Core2
Server Core2
 
Introducing PowerShell 3.0
Introducing PowerShell 3.0Introducing PowerShell 3.0
Introducing PowerShell 3.0
 
Windows 2012 R2 Multi Server Management
Windows 2012 R2 Multi Server ManagementWindows 2012 R2 Multi Server Management
Windows 2012 R2 Multi Server Management
 
Jenkins as a Service
Jenkins as a ServiceJenkins as a Service
Jenkins as a Service
 
NuGet 3.0 - Transitioning from OData to JSON-LD
NuGet 3.0 - Transitioning from OData to JSON-LDNuGet 3.0 - Transitioning from OData to JSON-LD
NuGet 3.0 - Transitioning from OData to JSON-LD
 
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshopIntroduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
 
Care and Feeding of Large Web Applications
Care and Feeding of Large Web ApplicationsCare and Feeding of Large Web Applications
Care and Feeding of Large Web Applications
 
eZ Platform Cloud and eZ Launchpad: Don’t Host, Don’t Deploy, Don’t Install—J...
eZ Platform Cloud and eZ Launchpad: Don’t Host, Don’t Deploy, Don’t Install—J...eZ Platform Cloud and eZ Launchpad: Don’t Host, Don’t Deploy, Don’t Install—J...
eZ Platform Cloud and eZ Launchpad: Don’t Host, Don’t Deploy, Don’t Install—J...
 
eZ Platform Cloud and eZ Launchpad: Don’t Host, Don’t Deploy, Don’t Install—J...
eZ Platform Cloud and eZ Launchpad: Don’t Host, Don’t Deploy, Don’t Install—J...eZ Platform Cloud and eZ Launchpad: Don’t Host, Don’t Deploy, Don’t Install—J...
eZ Platform Cloud and eZ Launchpad: Don’t Host, Don’t Deploy, Don’t Install—J...
 
Ow
OwOw
Ow
 
stackconf 2020 | Enterprise CI/CD Integration Testing Environments Done Right...
stackconf 2020 | Enterprise CI/CD Integration Testing Environments Done Right...stackconf 2020 | Enterprise CI/CD Integration Testing Environments Done Right...
stackconf 2020 | Enterprise CI/CD Integration Testing Environments Done Right...
 
VMworld 2013: PowerCLI Best Practices - A Deep Dive
VMworld 2013: PowerCLI Best Practices - A Deep DiveVMworld 2013: PowerCLI Best Practices - A Deep Dive
VMworld 2013: PowerCLI Best Practices - A Deep Dive
 
Windows Loves drupal
Windows Loves drupalWindows Loves drupal
Windows Loves drupal
 
Automating Active Directory mgmt in PowerShell
Automating Active Directory mgmt in PowerShellAutomating Active Directory mgmt in PowerShell
Automating Active Directory mgmt in PowerShell
 
Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestration
 

Plus de Thomas Lee (8)

PowerShell 101 - What is it and Why should YOU Care!
PowerShell 101 - What is it and Why should YOU Care!PowerShell 101 - What is it and Why should YOU Care!
PowerShell 101 - What is it and Why should YOU Care!
 
Doing Azure With PowerShell
Doing Azure With PowerShellDoing Azure With PowerShell
Doing Azure With PowerShell
 
Three cool cmdlets I wish PowerShell Had!
Three cool cmdlets I wish PowerShell Had!Three cool cmdlets I wish PowerShell Had!
Three cool cmdlets I wish PowerShell Had!
 
2014 SpiceWorld London Breakout
2014 SpiceWorld London Breakout2014 SpiceWorld London Breakout
2014 SpiceWorld London Breakout
 
Formatting With PowerShell
Formatting With PowerShell Formatting With PowerShell
Formatting With PowerShell
 
Coping with Murphy’s Law
Coping with Murphy’s LawCoping with Murphy’s Law
Coping with Murphy’s Law
 
Deep dive formatting
Deep dive formattingDeep dive formatting
Deep dive formatting
 
PowerShell 101
PowerShell 101PowerShell 101
PowerShell 101
 

Top 10 PowerShell Features in Server 2012

  • 1. 10 Cool PowerShell V3 Features in Windows 8 and Server 2012 Thomas Lee – doctordns@gmail.com PowerShell MVP
  • 2. Agenda • PowerShell v3 in Windows 8/Server 2012 • My Top 10 • Summary
  • 3. The Journey to PowerShell 3 • PowerShell v3 has been a long journey • Monad Manifesto in 2002 • V1 with Windows Vista/Server 2008/Exchange 2007 • V2 with Windows 8 and Server 2008 R2 • V3 ships with Windows 8 and Server 2012 • Key themes • Improving the usability • Increasing the surface area • Providing plumbing for more, more, more
  • 4. My Top-10 List • PowerShell v3 is vast • There are hundreds of new features • This list is arbitrarily • But things I like • The order is arbitrary • But all 10 are cool!
  • 5. 10 – PowerShell Web Access ≥ Enabled you to access PowerShell via IIS ≥ A bit like Terminal Services Gateway
  • 10. 9 - Module Auto-load • Modules added to PowerShell in v2 • No modules in v1 • In v2, modules had to be loaded manually • In v3, if modules are in standard module locations (i.e. defined in $env:PSmodulePath), Powershell can find the module the cmdlet is defined in and then load it auto-magically
  • 11. PowerShell Module Autoload Demo (n09.ps1-S1)
  • 12. 8 - Robust Remoting • Remoting added in v2 • But was not robust • Remoting broke at the first sign of trouble • Once broken, often stayed broken • Could be hard to fix • Under the covers – v3 has benefited from lots of work • Simple errors no longer become fatal • Remoting a highly key part of Server 2012 • Remoting + Workflow are the basis for the new server manager tool
  • 13. Robust Remoting Demo (n08.ps1 – s1)
  • 14. 7 - Updatable Help • Help a key feature of PowerShell since V1 • Both on line and in the box • Great writing team • Fix bugs • All components shipped with Windows Server 2012 can only be updated via normal update mechanism • Is it important enough to raise a critical fix for? • Is it important enough to raise a recommended hot fix? • Is it important enough to be fixed in a Service Pack • Solution • No help „in the box‟ – but… • Update-Help to fix that
  • 15. Updatable Help Demo (n07.ps1 – host)
  • 16. 6 – Simplified Syntax ≥ PowerShell had a scripting „wall‟  Get-Process  Get-Process| Sort CPU  Get-Process| Sort CPU| Select Name, Cpu ≥ But what about where  Get-Process| Where {$_.name –match "power"}  $_, {}, OH MY! ≥ In v3 – for SINGLE expressions  Get-Process | Where name –match “power”
  • 17. 6 - More Simplified Syntax ≥ Calling an object method in a pipeline meant using Foreach in v2  Get-Process | where {…} | foreach {$+_.kill()} ≥ Now, really simple  Get-Process | where {…} | kill # NOTE NO ()! ≥ And how about this:  Dir –AD  Dir +Hidden
  • 18. Simplified Syntax Demo (n06.ps1 – HOST)
  • 19. Break for Breath ≥ 10 through 6 so far  10 - PowerShell Web Service  9 - Module auto-load  8 - Robust Remoting  7 - Updatable Help  6 - Simplified Syntax for Where/Get-ChildItem ≥ These all make life easier for the IT Pro  Simplify what you type  Get better help  More reliable/robust features  Extend PowerShell access via the DMZ
  • 20. 5 – ISE Enhancements ≥ In v2 – the ISE was functional  The minimum upgrade from Notepad for unicode users  You still wanted 3rd party tools  ISE could be extended ($PsIse variable) ≥ In v3 – ISE is now nearly at a feature parity with 3rd party tools ≥ Some key new features  2-pane design (in V2 there were 3 panes)  Intellisense  Wrapping of regions  Script Explorer
  • 21. ISE Script Explorer ≥ Free add-on tool ≥ Created by Microsoft ≥ Allows you to explore for scripts ≥ A great starting point
  • 24. 3 - Workflows ≥ Remoting added in v2  But was not robust  Remoting broke at the first sign of trouble  Once broken, often stayed broken  Could be hard to fix ≥ Under the covers – v3 has benefited from lots of work  Simple errors no longer become fatal ≥ Remoting a highly key part of Server 2012  Remoting + Workflow are the basis for the new server manager tool
  • 25. More about Workflows ≥ A workflow is effectively a rich, long-running script that can survive reboots ≥ PowerShell workflow based on Windows Workflow Foundation  In effect, Powershell scripts become workflows ≥ Workflows are used, under the covers, with remote uses of Server Manger ≥ Workflows are complex and require an entire session (a day?) on their own.
  • 26. Workflows ≥ Workflows similar to PowerShell functions  Many restrictions owing to work flow architecture ≥ Complex to create, especially multi-machine work flows ≥ Demo left as an exercise for the reader
  • 27. 2 – Lots of new Modules/Cmdlets ≥ Lots of new modules added!  Win 8  Server 2012 ≥ Lots of CIM cmdlets  You can create cmdlets from XML and CIM
  • 28. LOTS of New stuff Demo (N02.Ps1 – S1)
  • 29. 1 – PowerShell in Server Core ≥ In Server 2008, Server Core did not support PowerShell ≥ In Server 2008 R2, you could add PowerShell and .NET to Server Core  Use Sconfig 42 to install ≥ In Server 2012, PowerShell installed by default  Serve Core starts by defaul in CMD.EXE  You need to do registry hack to start PowerShell
  • 30. Changing the Shell to PowerShell ≥ $RegPath = "Microsoft.PowerShell.CoreRegistry::HKEY_LOCAL_MACHINESOFTWAREMicroso ftWindows NTCurrentVersionwinlogon" ≥ Set-ItemProperty -Confirm -Path $RegPath -Name Shell -Value 'PowerShell.exe -noExit -Command "$psversiontable' ≥ Reboot-Computer
  • 31. Adding / Removing The GUI ≥ In Server 2012, you can add/remove the GUI  Turn Server Core into full GUI and back ≥ Just a simple PowerShell command  But beware of sources
  • 32. Summary ≥ Lots and lots of new features  This list barley scratches the surface ≥ Windows 8 and Server 2012 not have PowerShell V3 by default  You can download v3 for Server 2008/R2 and Win 7
  • 33. Call To Action ≥ Upgrade where possible to latest Operating Systems  Server 2012/Windows 8  Possibly using Windows 7 as a client ≥ With Downlevel clients – upgrade to PowerShell V3 ≥ Get PowerShell training  Attend the PowerShell PowerCamp event See Http://tfl09.blogspot.com for details
  • 34. Call To Action - 2 ≥ Evaluate the following expression • “Learn PowerShell Version 3” -OR • “Learn to smile and say: „Want fries with that?‟”