SQL Server provides durable storage for structured data collected by automation. PowerShell commands can create tables, insert objects, retrieve rows, and support scheduled reporting through SSRS. section 26.3 section 26.6
A practical PowerShell integration follows a repeatable pattern:
- Open a System.Data.SqlClient.SqlConnection with a connection string, then close it after the operation. section 26.3
- Build SQL in a here-string, create a SqlCommand, assign its connection and command text, and execute it. section 26.3
- Read query results with a DataReader and translate database column names into useful PowerShell object properties. section 26.5
Disk inventory database
A New-DiskInfoSQLTable command creates a diskinfo table only when needed, while Import-DiskInfoFromSQL selects rows ordered by DateAdded and returns disk objects with properties such as ComputerName, Drive, Size, and FreeSpace.


