PowerShell: Bringing DevOps to Windows

PowerShell: Bringing DevOps to Windows

An introduction to the foundations and possibilities of PowerShell! As presented at Abstractions.io.

35e74c48a612d8a6786f8ab6424b49a1?s=128

Kevin Berridge

August 19, 2016
Tweet

Transcript

  1. 3.
  2. 10.

    Basic Shell Commands and Aliases PowerShell Command PowerShell Alias DOS

    Equivalent Unix Equivalent Set-Location sl cd* cd* Get-ChildItem gci dir* ls* Copy-Item cpi copy* cp* Move-Item mi move* mv* Remove-Item ri del* rm* Get-Content gc type* cat* Get-Help help help* man*
  3. 11.
  4. 12.
  5. 13.
  6. 14.
  7. 15.
  8. 16.
  9. 17.
  10. 18.
  11. 19.
  12. 20.
  13. 21.

    Summary • Aliases are nice because they are short, also

    they match what you already know • Tab key auto completion is wonderful • The help command will teach you what you need to know
  14. 25.
  15. 26.
  16. 27.
  17. 29.
  18. 31.
  19. 32.
  20. 33.
  21. 35.

    Main Pipeline Commands • ForEach-Object (%) • Where-Object (?) •

    Sort-Object (sort) • Select-Object (select)
  22. 36.
  23. 37.
  24. 39.
  25. 41.
  26. 42.

    Summary • Commandlets return objects • DOS command return strings

    • “|” lets you easily chain commands together over those objects • Get-Member will tell you what those objects can do • %, ?, sort, select
  27. 43.
  28. 44.
  29. 45.
  30. 46.
  31. 48.
  32. 49.
  33. 50.
  34. 51.
  35. 52.
  36. 53.

    PowerShell C# -eq == -ne != -gt > -ge >=

    -lt < -le <= -like Regex -notlike -match -contains Linq
  37. 54.

    Summary • Scripts are no different than the shell! •

    $variables • Use functions just like commandlets • Comparison operators • & and Invoke-Expression • $lastexitcode vs. exceptions • PSAKE: make for PowerShell
  38. 55.
  39. 58.
  40. 59.

    Summary • PowerShell is a .NET language • You can

    use anything in .NET from PowerShell
  41. 62.
  42. 63.
  43. 64.
  44. 68.

    Honorable Mentions •PowerShell Remoting SSH for Windows! •PS Read Line

    Better editing at the shell! •Set-PSBreakpoint Integrated debugging! •Desired State Configuration (DSC) Chef/Puppet for PowerShell!