EXPLORING THE SQL POWERSHELL MODULE

Slides:



Advertisements
Similar presentations
Microsoft Ignite /16/2017 1:31 PM
Advertisements

James Boother Blog: INTRODUCTION TO POWERSHELL.
James Boother Blog: AUTOMATING ADMIN TASKS WITH POWERSHELL.
Manage backup vaults and servers Download and install backup agent Download a vault agent Create backup vault.
Martin Bell SQL Server MVP Blog:
Module 3: SQL Server 2005 Administrative Tools. Overview Using SQL Server Management Studio Using SQL Computer Manager Using the sqlcmd Utility Using.
Connect with life L.Srividya Architect Advisor | Microsoft India.
9/10/20151 Hyperion Enterprise 6.5 New Features & Functionality Robert Cybulski, CPA Finit Solutions.
Module 8 : Configuration II Jong S. Bok
Learningcomputer.com SQL Server 2008 – Management Studio.
Getting Started with your Cloud File Sync Tool. Part I: Getting Started.
Copyright © New Signature Who we are: Focused on consistently delivering great customer experiences. What we do: We help you transform your business.
Level 300 System Center App Controller 2012 Marin Franković, Visoko učilište Algebra.
Introduction to the NetBeans Platform Certified Training Course Geertjan Wielenga Sun Microsystems.
DXL to PST Converter Import from Lotus Domino to Outlook.
Intro to Azure SQL Databases. INTRO TO AZURE SQL DATABASES Mike Fal.
Intro to Azure SQL Databases. 2 Mike Fal Agenda What is Azure SQL Database? Pieces and Parts Using the Database 3.
Introduction Service Management Automation
Start-SPPowerShell – Introduction to PowerShell for SharePoint Admins and Developers Paul BAker.
Microsoft Azure Deployment Planning Services
Working with SQL Server for Linux Cross-Platform
Achieve more in less time using the new SQL PowerShell
Cloud BI with Azure Analysis Services
To the Command Line and Beyond Jeremy Sublett Composable Systems, LLC
Introduction to PowerShell
PowerShell is Happening FOR REAL THIS TIME!!!
Microsoft Azure Deployment Planning Services
Andrew Pruski SQL Server & Containers
Fun with Reporting Services Tools
SQL Server & PowerShell
Microsoft Azure Deployment Planning Services
Building Cross Platform PowerShell Modules
Using PowerShell with Python & SQL Server
Simplifying XEvents Management with dbatools
07 | Analyzing Big Data with Excel
SharePoint Saturday Omaha April 2016
DevOps – Desired State Configuration –
dbatools! The reason to finally start learning and using Powershell
SQL Server and PowerShell Let’s Get Serious
Making PowerShell Useful
PowerShell goodness 2017 Jeremy Sublett Composable Systems, LLC
SQL Server and PowerShell Let’s Get Serious
SharePoint 2019 Changes Point of View.
SQL Server and PowerShell Let’s Get Serious
Making PowerShell Useful
Use PowerShell & dbatools to Manage your SQL Server Environment
Chrissy LeMaire, MVP & Rob Sewell, MVP
dbatools - PowerShell and SQL Server Working Together
Reduce TCO Using Policy-Based Management and Windows PowerShell
PowerShell for Data Professionals
SQL Server and PowerShell Let’s Get Serious
Cloud BI with Azure Analysis Services
Getting started with Powershell for the DBA
dbatools! The reason to finally start learning and using Powershell
Managing Services with VMM and App Controller
Making PowerShell Useful
Making PowerShell Useful
Cross-Platform, Cloud and On-Premise Database Tool
Commands for SQL Server
Why migrate your Server 2008 servers with cubesys?
Test and Verify Instances with DBAchecks
Grow Your Script From Simple to Module
Cross-Platform, Cloud and On-Premise Database Tool
Use PowerShell & dbatools to Manage your SQL Server Environment
Gold Sponsors.
5/25/2019 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
dbatools! The reason to finally start learning and using Powershell
Using Dbatools to Automate Database Migrations
PowerShell for ConfigMgr 2012 SP1
Life Hacks: dbatools Edition
Presentation transcript:

EXPLORING THE SQL POWERSHELL MODULE

www.mikefal.net Mike Fal

What is SqlServer (SQLPS)? Get-Agenda What is SqlServer (SQLPS)? The Provider Cmdlets/Functions Practical Use

Don’t focus on the code, focus on the concepts. Don’t Panic! Don’t focus on the code, focus on the concepts. Ask questions!

In the beginning…

SQLPS The Basics Powershell module for SQL Server Includes cmdlets and the provider SQL Server 2012 or greater Powershell 2.0 or greater Import-Module SQLPS

SqlServer SqlServer Introduced with SSMS July 2016 update! Includes everything from SQLPS along with fixes Not compatible with SQLPS! Import-Module SqlServer

Installation Not installed specifically previous to SQL 2016 SP1 Included anytime you install ANY SQL Server component SQLPS Installation Path: C:\Program Files (x86) \Microsoft SQL Server \130\Tools\PowerShell\Modules SqlServer Installation Path C:\Program Files\WindowsPowerShell\Modules

Installation with SSMS 17/SQL 2016 PowerShell Gallery (https://www.powershellgallery.com/) Install-Module SqlServer (PowerShell 5.0+)

SQL Server Management Objects (SMO) Built on the SMO SQLPS\SqlServer SQL Server Management Objects (SMO) .Net Library requires .Net 2.0

What Makes It Work? SMO ASSEMBLIES Microsoft.SqlServer.Management.Common Microsoft.SqlServer.SqlEnum Microsoft.SqlServer.Smo Microsoft.SqlServer.RegSvrEnum Microsoft.SqlServer.Dmf Microsoft.SqlServer.WmiEnum Microsoft.SqlServer.Instapi Microsoft.SqlServer.ServiceBrokerEnum Microsoft.SqlServer.SqlWmiManagement Microsoft.SqlServer.ConnectionInfoExtended Microsoft.SqlServer.ConnectionInfo Microsoft.SqlServer.Management.Collector Microsoft.SqlServer.SmoExtended Microsoft.SqlServer.Management.CollectorEnum Microsoft.SqlServer.SqlTDiagM Microsoft.SqlServer.Management.Dac Microsoft.SqlServer.SString Microsoft.SqlServer.Management.DacEnum Microsoft.SqlServer.Management.RegisteredServers Microsoft.SqlServer.Management.Utility Microsoft.SqlServer.Management.Sdk.Sfc

DEMO!

SQL Server and the File System

Windows Components as Drives Explore/Use like a FileSystem Providers Windows Components as Drives Get-PSDrive Explore/Use like a FileSystem

SQL Server Provider PS SQLSERVER:\sql\localhost\default Provider Folder Host/Server Instance

DEMO!

Tab completion and Intellisense Gotchas Timeouts! Tab completion and Intellisense Contextual behavior

SQLPS Cmdlets Verb-Noun

Cmdlet Overview

Cmdlets: General Purpose Add-SqlLogin Get-SqlDatabase Get-SqlInstance *** Get-SqlErrorLog Invoke-SqlCmd Read-SqlTableData/Read-SqlViewData Write-SqlTableData Add-RoleMember Invoke-Sqlcmd Add-SqlLogin Invoke-SqlVulnerabilityAssessmentScan ConvertFrom-EncodedSqlName New-SqlCredential ConvertTo-EncodedSqlName New-SqlVulnerabilityAssessmentBaseline Convert-UrnToPath New-SqlVulnerabilityAssessmentBaselineSet Export-SqlVulnerabilityAssessmentBaselineSet Read-SqlTableData Export-SqlVulnerabilityAssessmentScan Read-SqlViewData Get-SqlCredential Remove-RoleMember Get-SqlDatabase Remove-SqlCredential Get-SqlErrorLog Remove-SqlLogin Get-SqlInstance Save-SqlMigrationReport Get-SqlLogin Set-SqlCredential Import-SqlVulnerabilityAssessmentBaselineSet Set-SqlErrorLog Invoke-PolicyEvaluation

Cmdlets: SQL Agent Management Get-SqlAgent Get-SqlAgentJob Get-SqlAgentJobHistory Get-SqlAgentJobSchedule Get-SqlAgentJobStep Get-SqlAgentSchedule

Cmdlets: Backup and Restore Backup-SqlDatabase Restore-SqlDatabase New-SqlBackupEncryptionOption Get-SqlSmartAdmin Set-SqlSmartAdmin Test-SqlSmartAdmin Standard Backup and Restore operations SqlSmartAdmin cmdlets for Azure Managed Backups

Cloud Management Add-SqlFirewallRule Remove-SqlFirewallRule Get-SqlInstance *** Set-SqlAuthenticationMode Set-SqlNetworkConfiguration Start-SqlInstance Stop-SqlInstance These cmdlets all require the Cloud Adapter Service This has been fixed, but if you use the old version… These do the same as Start-Service and Stop-Service

Cmdlets: Advanced Cmdlets Availability Group Management AlwaysEncrypted Management SSAS Management (merged from SQLAS)

DEMO!

Poorly Documented (Changing!) Gotchas Poorly Documented (Changing!) Unexpected behavior

So now what?

DEMO!

What is the SqlServer/SQLPS Module? How do we use it? Wrapping up! What is the SqlServer/SQLPS Module? How do we use it? The Provider, what is that all about? What kind of cmdlets (functions) are there? How do I use this darn thing, anyway?

Questions mike@mikefal.net www.mikefal.net @Mike_Fal https://github.com/MikeFal