Microsoft PowerShell and SQL Server: Database Management

This course is included in our On-demand training solution.


PowerShell can be used to manage the full range of SQL Server management tasks, and through scripting can assist with automation of frequent tasks. This course covers policies and jobs, working with PowerShell’s powerful scripting features, and working with individual databases.

Target Audience

SQL Server administrators and developers looking to understand the command line interface to Microsoft SQL Server



Expected Duration

150 min.

Course Objectives

Course Introduction


  • use cmdlets to create and configure user defined policies in PowerShell
  • Evaluate the SQL Policy

  • evaluate policies and output the result in PowerShell
  • PowerShell Job Step

  • create a PowerShell Job Step inside a SQL Server Agent Job
  • PowerShell from SSMS

  • use Microsoft PowerShell to populate a table created in Microsoft SQL Server Management Studio using SQLCMD mode
  • Execute SQL Scripts from File

  • execute SQL scripts from file locations in PowerShell
  • Create SQL Agent Job

  • create SQL Server Agent Jobs in PowerShell
  • Execute SQL Agent Job

  • execute existing SQL Server Jobs in PowerShell
  • Retrieve SQL Agent Job History

  • retrieve SQL Server Agent Job histories in PowerShell
  • PowerShell Variables

  • use PowerShell variables
  • Piping

  • use piping in PowerShell
  • Use PowerShell Utility to Create Stored Procedure

  • use the PowerShell Utility to create a Stored Procedure
  • Create Database

  • create databases in PowerShell
  • Create Login

  • use Microsoft PowerShell to create a Microsoft SQL Server login
  • Change Database User

  • use Microsoft PowerShell to change a SQL database’s ownership
  • Create Schema

  • create a schema within a database using the PowerShell utility
  • Create Stored Procedure

  • create, alter, and drop a stored procedure using the PowerShell utility
  • DBCC Using PowerShell

  • pass your DBCC to each database using PowerShell
  • Create XML Schema Collection

  • create a schema collection using PowerShell
  • Configure Database Mail

  • configure and enable database mail using PowerShell
  • Connect to SQL Using SQL Authentication

  • connect to an instance of SQL server using authentication in PowerShell
  • Change Server to Mixed Mode Authentication

  • use PowerShell cmdlets to change an instance of SQL Server from Integrated Mode Authentication to Mixed Mode Authentication
  • Drop Objects

  • use PowerShell cmdlets to drop an object within an instance of SQL Server
  • Send Query Results E-mail

  • use PowerShell cmdlets to send SQL Server Query results through an SMTP e-mail
  • Create Operator

  • use PowerShell cmdlets to create an operator within SQL Server Agent
  • Create Alert

  • use PowerShell cmdlets to create error alerts for multiple errors simultaneously in SQL Server Agent