PowerShell for DBA’s
3/29/2014 www.linchpinpeople.com 1
www.linchpinpeople.com 2
John Sterrett
@johnsterrett
JohnSterrett.com
linked.com/in/johnsterrett
google.com/+JohnSterrett
...
Linchpin People® are database coaches and wellness experts for the
Microsoft SQL Server Ecosystem. Our team includes more ...
Objectives
•Cover the basics of PowerShell
•Examples for DBA’s
3/29/2014 www.linchpinpeople.com 4
WARNING
If you currently use PowerShell this session isn’t for
you
3/29/2014 www.linchpinpeople.com 5
Why PowerShell?
• PowerShell is object-based not text-based
• PowerShell commands are customizable
• PowerShell is a comma...
Commands “Cmdlet”
• Verb-Noun
• Get-Command
• Using Parameters
• Get-Command –Verb Get
• Get-Command –Noun Service
3/29/20...
Commands “Cmdlet”
• Verb-Noun
• Get-Help
• Using Get-Help
• Get-Help Get-Service
• Get-Help Get-Service –examples
• Get-He...
Special Variables
• $_ = Current object in pipeline
• $Args = Containts an array of parameters passed to
a function
• $Err...
Common Data Types
Type Description
Int 32 bit signed integer
Long 64-bit signed integer
String Fixed-length string
Char Un...
Comparing Data
Operator Description
-eq Equal to
-lt Less than
-gt Greater Than
-ge Greater than or equal to
-le Less than...
Logical Operators
Operator Description
-not Not
! Not
-and And
-or Or
3/29/2014 www.linchpinpeople.com 12
Looping
Operator Description
Do while Block of code executes as long as not
true
While Same as do while
Do until Block of ...
DEMO
3/29/2014 www.linchpinpeople.com 14
Get started with
PowerShell
http://johnsterrett.com/go/powershell
@johnsterrett
JohnSterrett.com
linked.com/in/johnsterret...
Upcoming SlideShare
Loading in …5
×

Introduction to PowerShell for DBA's

717 views
618 views

Published on

Published in: Data & Analytics
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
717
On SlideShare
0
From Embeds
0
Number of Embeds
223
Actions
Shares
0
Downloads
14
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Introduction to PowerShell for DBA's

  1. 1. PowerShell for DBA’s 3/29/2014 www.linchpinpeople.com 1
  2. 2. www.linchpinpeople.com 2 John Sterrett @johnsterrett JohnSterrett.com linked.com/in/johnsterrett google.com/+JohnSterrett Specialties / Focus Areas / Passions: • Performance Tuning & Troubleshooting • Virtualization • Infrastructure • Architecture • High Availability • Disaster Recovery • Health Monitoring • Capacity Management • License Efficiency Linchpin Group Principal Virtual Chapter Leader “High Availability and Disaster Recovery” Pass Regional Mentor “South Central USA”
  3. 3. Linchpin People® are database coaches and wellness experts for the Microsoft SQL Server Ecosystem. Our team includes more than 15 of the world’s top SQL Server experts, and we have presented over 175 combined sessions at SQL Saturdays, PASS Summit, and other events in the past year. Do you have specific questions about your database environment? Check out www.LinchpinPeople.com and take a look at the range of services we provide, or contact one of us today to learn how we can help improve your business. You know us individually, but do you know Linchpin People®? www.linchpinpeople.com 3
  4. 4. Objectives •Cover the basics of PowerShell •Examples for DBA’s 3/29/2014 www.linchpinpeople.com 4
  5. 5. WARNING If you currently use PowerShell this session isn’t for you 3/29/2014 www.linchpinpeople.com 5
  6. 6. Why PowerShell? • PowerShell is object-based not text-based • PowerShell commands are customizable • PowerShell is a command line interpreter and a scripting language • PowerShell helps you manage the enterprise 3/29/2014 www.linchpinpeople.com 6
  7. 7. Commands “Cmdlet” • Verb-Noun • Get-Command • Using Parameters • Get-Command –Verb Get • Get-Command –Noun Service 3/29/2014 www.linchpinpeople.com 7
  8. 8. Commands “Cmdlet” • Verb-Noun • Get-Help • Using Get-Help • Get-Help Get-Service • Get-Help Get-Service –examples • Get-Help Get-Service -Full 3/29/2014 www.linchpinpeople.com 8
  9. 9. Special Variables • $_ = Current object in pipeline • $Args = Containts an array of parameters passed to a function • $Error = Objects for which errors occurred • $Home = user’s current home path 3/29/2014 www.linchpinpeople.com 9
  10. 10. Common Data Types Type Description Int 32 bit signed integer Long 64-bit signed integer String Fixed-length string Char Unicode 16 bit character Byte 8-bit unsigned character Bool Boolean True/False value Double Double-precision 32 bit float Xml Xml Object Array An Array of values 3/29/2014 www.linchpinpeople.com 10
  11. 11. Comparing Data Operator Description -eq Equal to -lt Less than -gt Greater Than -ge Greater than or equal to -le Less than or equal to -ne Not equal to 3/29/2014 www.linchpinpeople.com 11
  12. 12. Logical Operators Operator Description -not Not ! Not -and And -or Or 3/29/2014 www.linchpinpeople.com 12
  13. 13. Looping Operator Description Do while Block of code executes as long as not true While Same as do while Do until Block of code executes until condition is true For Script executes for specific number of tries Foreach Runs for every item in a collection 3/29/2014 www.linchpinpeople.com 13
  14. 14. DEMO 3/29/2014 www.linchpinpeople.com 14
  15. 15. Get started with PowerShell http://johnsterrett.com/go/powershell @johnsterrett JohnSterrett.com linked.com/in/johnsterrett google.com/+JohnSterrett

×