Chapter 25. Inventory database table statistics using PowerShell and SQL Server Management Objects
Robert C. Cain
SQL Server Management Objects, or SMO, were the only way to interact with SQL Server in the PowerShell v1 days. Although the release of the SQL Provider simplified interacting with SQL Server from PowerShell, there are still many reasons to understand and use SMO with PowerShell. Performance increases, finely tuned control, and access to a large base of existing code samples are but a few of the benefits to understanding and using SMO.
In this chapter you’ll create a script to inventory all of the databases on an instance of a SQL Server. The script will query the databases to get statistics for each table in each database—things ...
Get PowerShell Deep Dives now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.