Accessing SQL Server Databases from PowerShell

SQL Server is the Database engine used for all the enterprise tools part of the Microsoft ecosystem and PowerShell is the most popular scripting language. This course will teach you how to use PowerShell to read and write data from/to SQL Databases.
Course info
Rating
(35)
Level
Beginner
Updated
Oct 4, 2017
Duration
55m
Table of contents
Description
Course info
Rating
(35)
Level
Beginner
Updated
Oct 4, 2017
Duration
55m
Description

PowerShell is an awesome tool, and as an IT pro or a Developer you probably want to use its powerful automation potential to automate your own tasks. SQL Server is the database software of choice for organizations running in the Microsoft ecosystem. Instead of storing information from your PowerShell scripts in CSV or text files, you can store this information into a SQL Database and then use SQL Server's powerful reporting tools to create beautiful looking reports and historical data. In this course, Accessing SQL Server Databases from PowerShell, you'll learn how to use PowerShell to read and write data from/to a SQL Server database. First, you'll discover how to get the required PowerShell Module and how to connect to both a local and a remote SQL Server. Next, you'll explore how to use PowerShell to read data from a SQL Table. Finally, you'll learn how to use PowerShell to write information to an existing, or a brand-new SQL database. When you're finished with this course, you'll have the skills and knowledge of PowerShell needed to access SQL Server databases from PowerShell.

About the author
About the author

Vlad is a SharePoint and Office 365 Consultant specializing in SharePoint and SharePoint Online deployments as well as hybrid scenarios. As a Pluralsight Author, Microsoft Certified Trainer, and recognized international speaker, Vlad has helped thousands of users and IT Pros across the globe to better understand and to get the most out of SharePoint. Vlad is also a Microsoft Most Valuable Professional (MVP) in SharePoint since 2013 and has his own blog at www.absolute-sharepoint.com and he often shares his knowledge by speaking at local conferences and community events. Vlad also blogs at CMSWire as well as Computerworld and is often featured in other Microsoft sites such as Redmond Channel Partner. In Addition, Vlad is the recipient of the "Top 25 Office 365 Influencers" award, showcasing him as one of the most influential Office 365 specialists in 2015 demonstrating his expertise and passion for Microsoft's shift towards the cloud in the past years.

More from the author
Computer Fundamentals: Networking
Beginner
2h 12m
Jan 22, 2019
More courses by Vlad Catrinescu
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone. My name is Vlad Catrinescu, and welcome to my course, Accessing SQL Server Databases from PowerShell. I'm a Microsoft MVP and independent consultant from Montreal, Canada. Whether you're looking to store data or to create important historical and trend reports in PowerShell, SQL is probably one of the best locations to save your information. In this course, you'll learn how to use PowerShell to read and write data from or to a SQL Server database. Some of the major topics that we'll cover include connecting to a local or remote SQL Server, reading data from a SQL database, and writing data to SQL Server database. By the end of this course, you'll be able to use PowerShell to read or write information to a SQL Server database. Before beginning this course, you should be familiar with the basics of PowerShell, as well as the basics of SQL Server. From here, you should feel comfortable diving into other PowerShell topics with courses such as Working with CSV Data in PowerShell, Working with XML Data in PowerShell, and Reporting with PowerShell HTML and Enhanced HTML. I hope you'll join me on this journey to learn PowerShell with the Accessing SQL Server Databases from PowerShell course at Pluralsight.

Connecting to SQL Server
Hello, and welcome to this course on Accessing SQL Server Databases from PowerShell. My name is Vlad Catrinescu, and I will be your instructor for this course. In this module, we'll learn how to connect to SQL Server. While there are multiple ways to connect to SQL, we will focus this course on the SqlServer PowerShell module, which is the recommended way of administrating SQL through PowerShell. We will first start the course with learning how to get this module from the PowerShell Gallery and install it on our computer. We will then learn how we can run PowerShell cmdlets on a local server, as well as on a remote server when we have to use different credentials to be able to do our cmdlets.

Reading Data from a SQL Database
Hello, and welcome to this course on Accessing SQL Server Databases from PowerShell. My name is Vlad Catrinescu, and I will be your instructor for this course. In this module, we will learn how to read data from a SQL Server database. We will first start this module with the basics of reading data from a SQL table by using PowerShell. This can come in useful if you want to read data from a table and do actions in other system exterior to SQL, or if you want to create reports and, for example, read data from a SQL Server and easily save it as a CSV or Excel file so you can send it to non-IT users so it's really easy for them to view. Afterwards, we will look at how we can do a bit more advanced things such as filtering so we only get the columns we want from the table, as well as how to use views in case we want to have complicated joins or more complicated filtering. Instead of querying directly on a table, we can query a view as well. So we will learn how to also do that from PowerShell. Let's get started.

Writing Information into a SQL Database
Hello, and welcome to this course on Accessing SQL Server Databases from PowerShell. My name is Vlad Catrinescu, and I will be your instructor for this course. In this module, we will learn how to write data into a SQL Server database. We will first start this module with the basics of writing data into an existing SQL table by using PowerShell. Afterwards, we will look at how we can get information from other sources like a CSV file and write this information directly into a new SQL table. Writing information to a SQL table can become really useful if, for example, you want to get the information about some performance monitors or maybe the event viewer and so on from different sources and write them directly into a SQL table with this week's date. And then you can easily do reporting on only that table for that certain week. And then you can use the events or you can use the information in that table to assign tasks to make sure that those are fixed and so on. So, let's get started.