Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
PowerShell: Bringing DevOps to Windows
Kevin Berridge
August 19, 2016
Programming
1
230
PowerShell: Bringing DevOps to Windows
An introduction to the foundations and possibilities of PowerShell! As presented at Abstractions.io.
Kevin Berridge
August 19, 2016
Tweet
Share
More Decks by Kevin Berridge
See All by Kevin Berridge
The Cartography of Testing: CodeMash 2015
kberridge
1
170
OOP: You're Doing It Completely Wrong
kberridge
3
670
Acceptance Testing: The DIrty Details
kberridge
1
380
Other Decks in Programming
See All in Programming
microCMS × imgixを活用して品質とレスポンスを両立したポートフォリオサイトを作成した話
takehitogoto
0
380
Angular's new Standalone Components: How Will They Affect My Architecture? @iJS London 2022
manfredsteyer
PRO
0
380
既存のプロジェクトにKMMを導入するための対応策
martysuzuki
2
280
CLIツールにSwift Concurrencyを適用させようとしている話
417_72ki
3
130
ebpfとWASMに思いを馳せる2022 / techfeed-conference-2022-ebpf-wasm-amsy810
masayaaoyama
0
430
Becoming an Android Librarian
skydoves
3
420
Micro Frontends with Module Federation: Beyond the Basics @jax2022
manfredsteyer
PRO
0
270
Go言語仕様輪読会の開催を通じた振り返り
syumai
1
140
Develop your CI tools
xgouchet
2
180
dbtとBigQueryで始めるData Vault入門
kazk1018
0
170
バンドル最適化マニアクス at tfconf
mizchi
3
1.8k
競プロへの誘 -いざな-
u76ner
0
320
Featured
See All Featured
Music & Morning Musume
bryan
35
4.1k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_i
21
14k
Intergalactic Javascript Robots from Outer Space
tanoku
261
25k
Building a Scalable Design System with Sketch
lauravandoore
447
30k
Principles of Awesome APIs and How to Build Them.
keavy
113
15k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
3
430
How STYLIGHT went responsive
nonsquared
85
3.9k
Building Better People: How to give real-time feedback that sticks.
wjessup
343
17k
Building Your Own Lightsaber
phodgson
94
4.6k
Git: the NoSQL Database
bkeepers
PRO
415
59k
The MySQL Ecosystem @ GitHub 2015
samlambert
238
11k
How to Ace a Technical Interview
jacobian
265
21k
Transcript
PowerShell: Bringing DevOps to Windows! Kevin Berridge @kberridge Matrix Pointe
Software
PowerShell
DevOps
Productivity
PowerShell
Foundation Possibilities
PowerShell: Bringing DevOps to Windows! Linux Mac
The Shell Scripting
The Shell
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*
None
None
None
None
None
None
None
None
None
None
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
More Advanced Shell
Change .txt files to .ext files
ls *cmd*.txt | %{ mv $_ ($_.BaseName + ".ext" )
}
None
None
None
ls *cmd*.txt | %{ mv $_ ($_.BaseName + ".ext" )
}
None
ls *cmd*.txt | %{ mv $_ ($_.BaseName + ".ext" )
}
None
None
None
ls *cmd*.txt | %{ mv $_ ($_.BaseName + ".ext" )
}
Main Pipeline Commands • ForEach-Object (%) • Where-Object (?) •
Sort-Object (sort) • Select-Object (select)
None
None
How do we run a regular command line app?
None
What dlls did msbuild build?
None
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
Scripting
PSAKE
None
None
msbuild /v:m &”msbuild” /v:m iex ”msbuild /v:m”
None
None
None
None
None
PowerShell C# -eq == -ne != -gt > -ge >=
-lt < -le <= -like Regex -notlike -match -contains Linq
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
.NET
Store an encrypted string in an environment variable
Set-EncryptedEnvironmentVariable.ps1
None
Summary • PowerShell is a .NET language • You can
use anything in .NET from PowerShell
Possibilities
Collect log records and send a nightly email
None
None
None
Automate the execution of database migrations
migration-connections.xml
deploy-migrations.ps1
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!
PowerShell: Bringing DevOps to Windows! Kevin Berridge @kberridge Matrix Pointe
Software