Book Image

PowerShell for SQL Server Essentials

By : Donabel Santos
Book Image

PowerShell for SQL Server Essentials

By: Donabel Santos

Overview of this book

Table of Contents (15 chapters)
PowerShell for SQL Server Essentials
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Implementing Reusability with Functions and Modules
Index

Chapter 5. Querying SQL Server with PowerShell

We can query SQL Server from within PowerShell. This chapter illustrates different ways in which we can send and execute queries in SQL Server using PowerShell, and also evaluate when it is appropriate to use this method to do the job.

The topics that will be covered in this chapter are as follows:

  • To PowerShell or not to PowerShell

  • Sending queries to SQL Server

  • Fixing orphaned users

  • Getting fragmentation data

  • Backing up and restoring databases

  • Exporting data using bcp