POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and...
Transcript of POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and...
![Page 1: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/1.jpg)
Best Practices, Remote Management,
Automation and More
POWERSHELL
![Page 2: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/2.jpg)
Jason is a 30-year IT veteran and author at Pluralsight. He’s an avid
supporter of the DevOps/PowerShell community as a board member and
CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit.
He is also a Windows PowerShell MVP. Jason focuses on automation and
configuration management for DevOps and has co-authored several
PowerShell, MS Exchange and IIS related discussions on the Microsoft
Virtual Academy.
Best Practices, Remote Management,
Automation and More
POWERSHELL
@theJasonHelmick
Author/Evangelist
Pluralsight
#ILTAG119
![Page 3: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/3.jpg)
WHY POWERSHELL MATTERS
• Automation has a major impact to your business and its agility
• Automate repetitive tasks
• Deliver reusable solutions
• Reduce failure due to human mistakes
• PowerShell is your gateway to configuration management and
DevOps
#ILTAG119
![Page 4: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/4.jpg)
WHY DEVOPS MATTERS
• Reduced outages
• Rapid deployment
• Run toward change, not away
• Fail often, recover fast
#ILTAG119
![Page 5: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/5.jpg)
WHY DEVOPS MATTERS
• High performers decisively outperform lower preforming competition
• Deploy 200 times for frequently
• Recover 24 times faster
• 3 times lower change failure rate
• https://puppet.com/resources/white-paper/2016-state-of-devops-report
#ILTAG119
![Page 6: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/6.jpg)
GETTING STARTED
![Page 7: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/7.jpg)
MODULE OVERVIEW
• The purpose for PowerShell
• Installing PowerShell – Windows Management Framework
• Launching PowerShell for the administrator
• Customize the shell for comfort
• Getting familiar with the shell
#ILTAG119
![Page 8: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/8.jpg)
LAUNCHING POWERSHELL FOR THE ADMINISTRATOR
#ILTAG119
![Page 9: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/9.jpg)
CUSTOMIZE THE SHELL FOR COMFORT
#ILTAG119
![Page 10: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/10.jpg)
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
#ILTAG119
![Page 11: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/11.jpg)
THE HELP SYSTEM
![Page 12: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/12.jpg)
MODULE OVERVIEW
• Why you need help
• Updatable Help
• Discoverability with the Help system
• Understanding Syntax
• Real-World using Help
#ILTAG119
![Page 13: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/13.jpg)
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
• Advanced PowerShell configuration information
#ILTAG119
![Page 14: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/14.jpg)
UPDATABLE HELP
• Update to the latest version of Help
• Save-Help to save to a local location
#ILTAG119
![Page 15: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/15.jpg)
DISCOVERABILITY WITH THE HELP SYSTEM
• Get-Help
• Help <cmdlet>
• Help *partial*
• Help <verb/noun>
• Help <cmdlet> -Full
• Help <cmdlet> -ShowCommand
• Get-Help About_*
#ILTAG119
![Page 16: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/16.jpg)
UNDERSTANDING SYNTAX
• The meaning of Syntax
- Indicates A Parameter
<> Indicates Arguments
[] Argument Accepts Multiple Values
[Param] is Positional [Param Arg] is Optional
#ILTAG119
![Page 17: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/17.jpg)
REAL-WORLD USING HELP#ILTAG119
![Page 18: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/18.jpg)
THE PIPELINE: GETTING CONNECTED
![Page 19: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/19.jpg)
MODULE OVERVIEW
• 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
#ILTAG119
![Page 20: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/20.jpg)
WHAT’S THE PIPELINE AND WHAT DOES IT DO?
Pipe character located above the Enter key
Connects cmdlets to produce better results
Can be broken into several lines to increase readability
#ILTAG119
![Page 21: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/21.jpg)
EXPORTING/IMPORTING CSV
#ILTAG119
![Page 22: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/22.jpg)
EXPORTING/IMPORTING XML#ILTAG119
![Page 23: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/23.jpg)
OTHER FILES AND PRINTERS #ILTAG119
![Page 24: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/24.jpg)
DISPLAYING INFORMATION IN A GUI#ILTAG119
![Page 25: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/25.jpg)
MAKING A WEBPAGE OF INFORMATION#ILTAG119
![Page 26: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/26.jpg)
CMDLETS THAT KILL
• Stop-Process / kill
• Stop-service
• $ConfirmPreference
• $WhatIfPreference
• -Confirm
• -Whatif
#ILTAG119
![Page 27: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/27.jpg)
EXTENDING THE SHELL
![Page 28: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/28.jpg)
MODULE OVERVIEW
• Finding and adding Modules
• Discovering new commands
• The real world of cmdlets
#ILTAG119
![Page 29: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/29.jpg)
LIKE THE MMC - ONE SHELL DOES IT ALL
#ILTAG119
![Page 30: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/30.jpg)
FINDING & ADDING MODULES
#ILTAG119
![Page 31: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/31.jpg)
DISCOVERING NEW COMMANDS
#ILTAG119
![Page 32: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/32.jpg)
THE POWER IN POWERSHELL -REMOTING
![Page 33: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/33.jpg)
MODULE OVERVIEW
• Overview of Remoting
• Enable Remoting
• One-To-One
• One-To-Many
• Not the end yet!
#ILTAG119
![Page 34: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/34.jpg)
OVERVIEW OF REMOTING
#ILTAG119
![Page 35: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/35.jpg)
ENABLE REMOTING
Computer Configuration/Policies/Administrative
Templates/Windows Components/Windows Remote Management
#ILTAG119
![Page 36: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/36.jpg)
ONE TO ONE - INTERACTIVE
#ILTAG119
![Page 37: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/37.jpg)
ONE-TO-MANY
#ILTAG119
![Page 38: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/38.jpg)
AUTOMATION IN SCALE - REMOTING
![Page 39: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/39.jpg)
MODULE OVERVIEW
• Reusable Sessions
• Sessions with Invoke-Command
• Real-world deployment of a website
• Getting commands from anywhere
#ILTAG119
![Page 40: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/40.jpg)
REUSABLE SESSIONS
#ILTAG119
![Page 41: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/41.jpg)
SESSIONS WITH INVOKE-COMMAND
#ILTAG119
![Page 42: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/42.jpg)
GETTING COMMANDS FROM ANYWHERE -
IMPLICIT REMOTING
#ILTAG119
![Page 43: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/43.jpg)
INTRODUCTION TO TOOLMAKING
![Page 44: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/44.jpg)
MODULE OVERVIEW
• 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
#ILTAG119
![Page 45: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/45.jpg)
MAKING COMMANDS REPEATABLE
#ILTAG119
![Page 46: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/46.jpg)
ADDING PARAMETERS TO YOUR SCRIPT
#ILTAG119
![Page 47: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/47.jpg)
DOCUMENTING YOUR SCRIPT
#ILTAG119
![Page 48: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/48.jpg)
TURNING YOUR SCRIPT INTO A TOOL FOR OTHERS
#ILTAG119
![Page 49: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/49.jpg)
STORING YOUR TOOLS IN A MODULE
#ILTAG119
![Page 50: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/50.jpg)
INTRODUCTION TO POWERSHELL DESIRED STATE CONFIGURATION
![Page 51: POWERSHELL · 2017-08-03 · supporter of the DevOps/PowerShell community as a board member and CFO/COO of PowerShell.Org and the PowerShell/DevOps Global Summit. He is also a Windows](https://reader031.fdocuments.us/reader031/viewer/2022040804/5e40b5b44ddb0c102f2767fb/html5/thumbnails/51.jpg)