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

Checking enabled features


SQL has many features. We can find out if certain features are enabled by using SMO and PowerShell. To determine this, you need to access the object that owns that feature. For example, some features are available to be queried once you create an SMO server object:

Import-Module SQLPS -DisableNameChecking

#current server name
$servername = "ROGUE"

$server = New-Object "Microsoft.SqlServer.Management.Smo.Server" $servername

$server | 
Select-Object IsClustered, ClusterName, 
FilestreamLevel,
IsFullTextInstalled,
LinkedServers,
IsHadrEnabled,
AvailabilityGroups

In the preceding script, we can easily find out the following parameters:

  • Is the server clustered (IsClustered)?

  • Does it support FileStream and to what level (FilestreamLevel)?

  • Is FullText installed (IsFullTextInstalled)?

  • Are there any configured linked servers in the system (LinkedServers)?

  • Is AlwaysOn enabled (IsHadrEnabled) and are any availability groups configured (AvailabilityGroups)?

There are also a number...