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 4. Basic SQL Server Administration

In this chapter, we will look at how to accomplish typical SQL Server administration tasks by using PowerShell. Although you were introduced to SQL Server-specific cmdlets in the previous chapters, these cmdlets are still quite few. Many of the tasks that we will see can be accomplished by using SQL Server Management Objects (SMO). As we encounter new SMO classes, it is best to verify the properties and methods of that class using Get-Help, or by directly visiting the TechNet or MSDN website.

The topics covered in this chapter include how to perform the following tasks:

  • Listing databases and tables

  • Adding files and filegroups

  • Scripting database objects

  • Attaching and detaching databases

  • Backing up and restoring databases

  • Reorganizing or rebuilding indexes

  • Managing logins, users, and permissions

  • Listing policies

  • Managing jobs