PowerShell is Happening FOR REAL THIS TIME!!! Aaron Nelson
PowerShell for Data Professionals By Aaron Nelson Aaron@SQLvariant.com SQLvariant.com My Blog SQLPS.com PowerShell VC of PASS sqlps.io/video PoSh VC YouTube channel Copyright 2016 By Aaron Nelson
PowerShell VC of PASS Join the conversation with us on Trello sqlps.io/vote If you want to make SSMS better you can do that too! sqlps.io/ssms
The SQL Provider is Object Explorer, just at the command line Object Explorer Details (F7) is a wonderful compliment to Object Explorer itself. Lets Traverse and look at indexes
Trying out a new session today A whole lot has changed in the ~14 weeks. Your feedback is extremely important to me
Today is about inspiration I’m not going to trot out every awesome script I have I’m going to show you some cool things Then I’d like to hear what you’d like to do if you could wave a magic wand (because I know a guy… and a gal)
Don’t freak out about the syntax You know T-SQL and you can still use it! (Invoke-SqlCommand) Although, that’s usually the point PowerShell has SELECT WHERE AND JOIN, just for starters
This next demo IS NOT ABOUT BACKUPS. Hopefully you’re using Ola scripts to backup your databases Which you can of course deploy with PowerShell
Backup All Databases Get-SqlDatabase -ServerInstance localhost | Backup-SqlDatabase Get-SqlDatabase -ServerInstance localhost | Backup-SqlDatabase -CompressionOption On Get-SqlDatabase -ServerInstance localhost | Where { $_.Name -ne 'tempdb' } | Backup-SqlDatabase -CompressionOption On
Lets just backup the ones we like OGV with the –PassThru parameter is your friend Let’s do that across multiple instances
How do I know what cmdlets are out there? Get-Command -Module SQLPS Get-Command -Module SQLPS -ParameterName Database Get-Help Get-Help Backup-SqlDatabase -Examples
Who likes reading through the error log? Who checks it every day? Who likes picking through there looking for a single word. Every. Single. Day.
Methods & Properties Methods are Verbs Properties are Adjectives You Put Properties in your WHERE clause I meant Filter Properties using Where-Object You can see a ton of Properties already in Object Explorer Details
Want to Migrate your SQL instace? DBAtools.io Copyright 2016 By Aaron Nelson
What if you want to Compact some indexes? Great idea But what if you wanted to compact just some of those indexes? DATA_COMPRESSION_ROW.ps1
Use Snippets You have lots of great ideas to make things in your environment better. Use the Snippets feature in PowerShell and create Snippets for Multi-Server Multi-Database Multi-Table Multi-Index Don’t forget that you can create one snippet for Prod servers and a different snippet for QA servers
Microsoft is Listening They have listened to the community They have hired a full time engineer for PowerShell in SQL Server They are still listening We setup a Trello board to help organize the community’s thoughts & voices The SQL Tools team comments on that Trello board. They ask questions Give us status updates Ask us if we’d like automated fries with that.
PowerShell for Data Professionals Aaron Nelson SQLvariant.com My Blog SQLPS.com PowerShell VC of PASS Aaron@SQLvariant.com Copyright 2016 By Aaron Nelson