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

Summary


In this chapter, we saw a number of snippets that allow us to scope out our SQL Server instance. A combination of WMI cmdlets and SMO script come in handy when using PowerShell to profile the instance and its environment. WMI can be quite helpful, especially when looking at system resources (such as CPU, memory, network, and disk space), while SMO is indispensable when programmatically listing or changing SQL Server properties. Using SMO, we saw how to list current instance settings, query SQL Server error logs, change service accounts, change audit-level settings, and adjust an instance's default backup directory property. This is just a glimpse of what you can do with SQL Server using PowerShell.

In the next chapter, we will look at how to do basic SQL Server administration tasks using PowerShell and SMO.