Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
PowerShell: Bringing DevOps to Windows
Search
Kevin Berridge
August 19, 2016
Programming
1
370
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
310
OOP: You're Doing It Completely Wrong
kberridge
3
870
Acceptance Testing: The DIrty Details
kberridge
1
510
Other Decks in Programming
See All in Programming
デザインシステムで Tailwind CSSとCSS in JSに分散投資をしたら良かった話
fsubal
14
3.4k
Ruby製社内ツールのGo移行
bgpat
2
270
クソコード動画『カプセル化 Mk-II』 で考える 上手くカプセル化できない理由 / encapsulation2
minodriven
11
8k
IntelliJ IDEA を知らなかった 自分に教えたい小ネタ集 / IntelliJ IDEA Hints for My Past Self
mackey0225
3
180
イベントストーミングによるオブジェクトモデリング・オブジェクト指向プログラミングの適用・開発プロセスの変遷・アーキテクチャの変革 / Object modeling with Event Storming.
nrslib
12
3.1k
DDDはなぜ難しいのか / 良いコードの定義と設計能力の壁
pospome
24
7.5k
15分間でふんわり理解するDocker @ Matsuriba MAX
ukwhatn
PRO
1
340
品質が高いコードって何?Rev2.1
ickx
1
490
document.write再考
brn
5
2.5k
LLMチャットボットのアプリケーション設計Tips
os1ma
4
660
SwiftUI, Jetpack Composeの導入で変化した「家族アルバム みてね」のアプリ開発体験
hicka04
6
400
受託開発でGitLab CI を活用していく
xiombatsg
1
130
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
7
2.3k
Infographics Made Easy
chrislema
237
18k
A Philosophy of Restraint
colly
195
15k
The Illustrated Children's Guide to Kubernetes
chrisshort
28
46k
Art, The Web, and Tiny UX
lynnandtonic
288
19k
Navigating Team Friction
lara
177
13k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
6
950
Designing the Hi-DPI Web
ddemaree
275
33k
What's in a price? How to price your products and services
michaelherold
236
11k
Fantastic passwords and where to find them - at NoRuKo
philnash
35
2.4k
KATA
mclloyd
14
11k
Robots, Beer and Maslow
schacon
PRO
154
7.9k
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