Download presentation
Presentation is loading. Please wait.
Published byJoshua Arnold Hunt Modified over 6 years ago
1
Achieve more in less time using the new SQL PowerShell
5/30/2018 8:41 AM Achieve more in less time using the new SQL PowerShell Aaron Nelson Business Intelligence Consultant © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
2
Aaron Nelson ANelson@SolidQ.com
SolidQ Business Intelligence Consultant Microsoft Data Platform MVP Conference Speaker PASS Summit, Tech Ed, Ignite, SQL Saturdays PASS PowerShell Virtual Group Leader
3
Too Much to Cover in 20 Minutes
More resources available on my blog: Ask me questions on Check out the PowerShell VG of PASS: Over 30 videos on our YouTube channel:
4
Where to get these modules
5/30/2018 8:41 AM Where to get these modules Both of these modules are available in the PowerShell Gallery SQL Server Module sqlps.io/sqlserver SSRS Module sqlps.io/ssrs © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
5
Install from an Elevated PowerShell Session
Install-Module -Name SqlServer –Force; Install-Module -Name ReportingServicesTools;
6
Install from an Elevated PowerShell Session
5/30/2018 8:41 AM Install from an Elevated PowerShell Session Update-Module -Name ReportingServicesTools; Update-Module -Name SqlServer; Get-Command -Module ReportingServicesTools Get-Command -Module SqlServer | Out-GridView © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
7
Here are some of the new cmdlets since 2016
Moving Data Invoke-SqlCmd -ConnectionString Parameter -OutputAs (As) Parameter Read-SqlTableData Read-SqlViewData Write-SqlTableData Login Add-SqlLogin Get-SqlLogin Remove-SqlLogin Error Log Get-SqlErrorLog Set-SqlErrorLog SQL Agent Get-SqlAgent Get-SqlAgentJob Get-SqlAgentJobHistory Get-SqlAgentJobSchedule Get-SqlAgentJobStep Get-SqlAgentSchedule SSAS Invoke-ProcessASDatabase Invoke-ProcessTable
8
Want to be able to Export / Import your Schema using PowerShell?
Up-Vote this Connect item: (make sure you login otherwise your vote won’t count.)
9
The SQL Server Provider[s]
The different Providers you can use Not all of them are great Name Description SQLRegistration SQL Server Registrations SQL SQL Server Database Engine SQLAS SQL Server Analysis Services SSIS SQL Server Integration Services Xevent SQL Server Extended Events DatabaseXEvent SQL Server Extended Events DAC SQL Server Data-Tier Application DataCollection SQL Server Data Collection SQLPolicy SQL Server Policy Management Utility SQL Server Utility The ones in bold are the one I have experience using The other ones might work, but who knows? The most important provider to know about is the SQLRgistrations provider Would you be interested in a PowerShell Provider for SSRS?
10
What do they do? They’re like having access to Object Explorer, or even Object Explorer details, but at the command line! <Demo of scripting multiple object, sorted by size, then create date, in Object Explorer Details>
11
What is the benefit SQL PowerShell doesn’t have as many cmdlets as it should, but these help to fill in the gaps a little. You can see lots of things, but you can also modify them too. In the case of SSAS, they can give you more actionable information that SSMS can.
12
What is the benefit Dir = Get-ChildItem
Running a Dir is almost like piping objects to SELECT-[Object] * Except that it’s different! You can’t always rely on “column names” to be the actual “property name” To confirm this you will need to pipe to Get-Member or SELECT-[Object] *
13
Demo Aaron Nelson 5/30/2018 8:41 AM
© Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.