Introduction to SQL Server Automation with Powershell by Chris Sommer.

Slides:



Advertisements
Similar presentations
IF statement (i) Single statement. IF ( logical expression ) statement Example: read(*,*) a if (a. lt. 0) a = -a write(*,*) a Or read(*,*) a if (a < 0)
Advertisements

Introduction to Programming Lesson 1. Objectives Skills/ConceptsMTA Exam Objectives Understanding Computer Programming Understand computer storage and.
Rick Toner MCSD, MCPD, MCITP Blog:
Introduction to Unix – CS 21 Lecture 11. Lecture Overview Shell Programming Variable Discussion Command line parameters Arithmetic Discussion Control.
CSET4100 – Fall 2009 Perl Introduction Scalar Data, Operators & Control Blocks Acknowledgements: Slides adapted from NYU Computer Science course on UNIX.
Jason Himmelstein, MVP Senior Technical Director,
James Boother Blog: INTRODUCTION TO POWERSHELL.
James Boother Blog: AUTOMATING ADMIN TASKS WITH POWERSHELL.
CS 497C – Introduction to UNIX Lecture 33: - Shell Programming Chin-Chih Chang
Great people, great experience, great passion Administering SharePoint with Windows PowerShell Go Beyond the Management Shell with SharePoint and Windows.
Algorithms. Introduction Before writing a program: –Have a thorough understanding of the problem –Carefully plan an approach for solving it While writing.
Shell Programming 1. Understanding Unix shell programming language: A. It has features of high-level languages. B. Convenient to do the programming. C.
Bash Shell Scripting 10 Second Guide Common environment variables PATH - Sets the search path for any executable command. Similar to the PATH variable.
COMPE 111 Introduction to Computer Engineering Programming in Python Atılım University
Invitation to Computer Science, Java Version, Second Edition.
S2008Final_part1.ppt CS11 Introduction to Programming Final Exam Part 1 S A computer is a mechanical or electrical device which stores, retrieves,
4 1 Array and Hash Variables CGI/Perl Programming By Diane Zak.
Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1 © Copyright IBM Corporation 2008 Unit 11: Shell.
1 System Administration Introduction to Scripting, Perl Session 3 – Sat 10 Nov 2007 References:  chapter 1, The Unix Programming Environment, Kernighan.
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
Good PowerShell EXPAND YOUR POWERSHELL SKILLZ BY KIERAN JACOBSEN.
Introduction to Perl Yupu Liang cbio at MSKCC
Perl Language Yize Chen CS354. History Perl was designed by Larry Wall in 1987 as a text processing language Perl has revised several times and becomes.
Chapter 10: BASH Shell Scripting Fun with fi. In this chapter … Control structures File descriptors Variables.
7 1 User-Defined Functions CGI/Perl Programming By Diane Zak.
Chapter 15 Introduction to PL/SQL. Chapter Objectives  Explain the benefits of using PL/SQL blocks versus several SQL statements  Identify the sections.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
IDL Tutorials: Day 4 Goal: Learn some programming techniques: Relational operators, conditional statements, boolean operators, loops Maria Kazachenko
Prof. Alfred J Bird, Ph.D., NBCT Office – McCormick 3rd floor 607 Office Hours – Tuesday and.
(A Very Short) Introduction to Shell Scripts CSCI N321 – System and Network Administration Copyright © 2000, 2003 by Scott Orr and the Trustees of Indiana.
Introducing System Managers to Win32 Perl Programming Tim Christian College of Arts and Sciences Computing Support Services.
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
Windows PowerShell. What is Windows PowerShell? A command-line interface (CLI) A new way of developing Windows and other products to be more manageable.
Flow Control in Imperative Languages. Activity 1 What does the word: ‘Imperative’ mean? 5mins …having CONTROL and ORDER!
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
Introduction to Programming Lesson 1. Algorithms Algorithm refers to a method for solving problems. Common techniques for representing an algorithms:
Rob Sewell Making PowerShell Useful Real-Life Examples of Powershell in Action Slides available here -
Bret Stateham Owner, Net Connex blogs.netconnex.com
Ravikanth C.
1 Lecture 8 Shell Programming – Control Constructs COP 3353 Introduction to UNIX.
Working with SQL Server for Linux Cross-Platform
Agenda Bash Shell Scripting – Part II Logic statements Loop statements
Introduction to PowerShell
Programming Fundamentals
Introduction to PowerShell
Eric Kang: Sr. Program Manager
Making PowerShell Useful
dbatools - PowerShell and SQL Server Working Together
SQL Server and PowerShell Let’s Get Serious
Getting started with Powershell for the DBA
Control Structures: for & while Loops
Delivering complex script projects
SQL Server Agent The Life Preserver for the Drowning DBA Lance Tidwell.
PowerShell Best Practices for SQL DBA’s
Making PowerShell Useful
Test and Verify Instances with DBAchecks
Grow Your Script From Simple to Module
PowerShell Flow of Control Copyright © 2016 – Curt Hill.
Introduction to Computer Science
Gold Sponsors.
Introduction to Programming
The Selection Structure
Introduction to Bash Programming, part 3
Azure Data Factory V2: SSIS in the Cloud or Not?
INTRODUCTION to PERL PART 1.
What it is and why you should use it
REPETITION Why Repetition?
Control Structures.
Presentation transcript:

Introduction to SQL Server Automation with Powershell by Chris Sommer

Agenda Introduction Automation The PowerShell Language The SQL Server Module (SQLPS) Demos

Introduction

Chris Sommer SQL Server DBA at on Twitter Blog: LinkedIn:

Automation

What is automation? Automation is having computers perform repetitive tasks for us.

What problems does automation solve? The people problem! Automation brings Repeatability Consistency Reliability Scalability

What do I get out of automation? I don’t have to perform the mundane and repetitive tasks any more. It frees up my time so I can work on the fun stuff and learn new things. I allows me to sleep at night and gives me a sense of relief. I can look like a rockstar!

The PowerShell Language

PowerShell Programming Constructs Variables Conditional Statements Loops Functions Built-in Error Handling Modules

Variables Variables are a reference to data or information Supports your standard data types Identified by a leading “$” character Not a strongly typed language Special variables

Custom Objects Custom objects are a collection of related data Makes it easy to pass related data in a script Referenced similarly to a variable

Conditionals Check if a statement is true or false Comparison operators -eq -ne -gt- ge -lt -le -like -match -contains -and -or

Loops Allow us to repeat a block of code until a condition is met while do while do until for foreach

Functions Functions bring reusability to a script Functions should do 1 thing and do it well Functions return all output to the caller

Error Handling Not all errors are terminating Can control ErrorAction at many levels Script, Function, Cmdlet Try/Catch/Finally Exit codes

Modules Modules are collections of related cmdlets, providers, functions, variables, aliases. Module types Script Binary Manifest Dynamic Built-In, Custom and Vendor Modules

SQL Server Module (SQLPS)

What does SQLPS Include? The SQLSERVER provider SQL Management Object Libraries (SMO) 34 SQL Server Cmdlets

SQLSERVER: Provider Browse SQL Server like a directory structure Used in conjunction with SMO Used with Cmdlets

SQL Management Objects (SMO) SMO allows you to manage SQL Server SQL Instance settings Database settings and configuration Perform DDL tasks on databases Script database objects Manage SQL Agent jobs

SQL Server Cmdlets Cmdlets provide functionality to perform a number of SQL Server tasks. Invoke-Sqlcmd Backup-SqlDatabase Restore-SqlDatabase Manage AlwaysOn Availability Groups

Demos

Questions?

Image Credits