Inventory is a vital information,whether you’re a consultant or an in-house DBA, you need to have a reliable inventory of the servers you manage.This inventory can take any number of forms but, ideally, will allow some aggregation of information. When server hardware or software changes are taking place, it’s easy to forget that the inventory has to be updated as well. For this reason, I like to have a script that creates the inventory, rather than have to keep a manual log of changes as they occur.
It has five mandatory parameters
- InputFileName – Text File contains a list of SQL/SSAS/SSRS Servers -C:\Server.txt(Example)
- DirectoryToSave – Folder where you want to store the file
- ToID – To email Address
- FromID – From Email Address
- SMTP – SMTP Adress
- Windows PowerShell 2.0 must be installed
- Permission to access all SQL instances
- Permission to create a outputFile
Windows PowerShell 2.0 is installed by default on newer versions of the Windows operating systems.You must install a SQL Server feature that includes the SQL Server PowerShell (SQLPS) module and client libraries. The easiest way to do this is by installing SQL Server Management Studio, which includes the PowerShell feature and client libraries automatically. The SQL Server PowerShell (SQLPS) module contains the PowerShell providers and cmdlets for all SQL Server features.
The all three PowerShell scripts requires an input file, Directory to Save and Email parameters
For Example :-The C:\SQLList.txt file should list of SQL instances
SQL Server Management Objects (SMO) is a collection of objects that are designed for programming all aspects of managing Microsoft SQL Server
The output is comprises of following columns
PS C:\> .\SQLServerInventory.ps1 -InputFileName C:\SQLserver.txt -DirectoryToSaveTo C:\ -To email@example.com -From firstname.lastname@example.org -SMTP mail.abc.com
PowerShell allows me to do just that. PowerShell makes it easy to issue WMI (Windows Management Instrumentation) and AMO’s to pull the required details.
Analysis Management Objects (AMO) is the complete library of programmatically accessed objects that enables an application to manage a running instance of Microsoft SQL Server Analysis Services. This section explains AMO concepts, focusing on major objects, how and when to use them, and the way they are interrelated.
The 24 columns output are listed are given below
- Domain Name
PSC:\>.\SSASInventoryExcel.ps1 -InputFileName C:\SSASList.txt -DirectoryToSaveTo c:\ -OutputFileName SSASInventoryExcel
The MSReportServer_ConfigurationSetting class represents the installation and runtime parameters of a report server instance. These parameters are stored in the configuration file for the report server
The 33 columns output are listed are given below
- Domain Name
PS C:\> .\SSRSInventory.ps1 -InputFileName C:\SSRSList.txt -DirectoryToSaveTo C:\ -To email@example.com -From firstname.lastname@example.org -SMTP mail.abc.com