Inventory
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
Pre-requisites are -
- 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
SQLList.txt
apdbsp15
apdbsp17\CRM2011
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
- InstanceName
- ComputerNamePhysicalNetBIOS
- NetName
- OS
- OSVersion
- Platform
- Product
- edition
- Version
- VersionString
- ProductLevel
- DatabaseCount
- HasNullSaPassword
- IsCaseSensitive
- IsFullTextInstalled
- Language
- LoginMode
- Processors
- PhysicalMemory
- MaxMemory
- MinMemory
- IsSingleUser
- IsClustered
- Collation
- MasterDBLogPath
- MasterDBPath
- ErrorLogPath
- BackupDirectory
- DefaultLog
- ResourceLastUpdatetime
- AuditLevel
- DefaultFile
- xp_cmdshell
- Domain
- IPAddress
http://gallery.technet.microsoft.com/PowerShell-SQL-Inventory-e9b92dac
PS C:\> .\SQLServerInventory.ps1 -InputFileName C:\SQLserver.txt -DirectoryToSaveTo C:\ -To pram@abc.com -From pram@abc.com -SMTP mail.abc.com
SSAS Inventory
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
- Name
- ConnectionString
- Domain Name
- OS
- CPU
- TotalRAM
- FreeRAM
- UsedRAM
- Version
- Edition
- EditionID
- ProductLEvel
- ProductName
- Isloaded
- DataDir
- Tempdir
- LogDir
- BackupDir
- CubeDatabaseCount
- CubeDatabaseList
- CreatedTimestmp
- LastSchemaUpdate
- Uptime
- IPAddress
http://gallery.technet.microsoft.com/Powershell-Automatic-SSAS-db510158
PSC:\>.\SSASInventoryExcel.ps1 -InputFileName C:\SSASList.txt -DirectoryToSaveTo c:\ -OutputFileName SSASInventoryExcel
SSRS Inventory:-
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
- Name
- Domain Name
- OS
- DatabaseServerName
- CPU
- TotalRAM
- FreeRAM
- UsedRAM
- Version
- DatabaseName
- ExtendedProtectionLevel
- ExtendedProtectionScenario
- InstanceName
- SenderEmailAddress
- SendUsingSMTPServer
- ServiceName
- SMTPServer
- VirtualDirectoryReportManager
- VirtualDirectoryReportServer
- IsInitialized
- IsReportManagerEnabled
- IsSharePointIntegrated
- IsWebServiceEnabled
- IsWindowsServiceEnabled
- MachineAccountIdentity
- PathName
- SecureConnectionLevel
- WindowsServiceIdentityActual
- WindowsServiceIdentityConfigured
- ConnectionPoolSize
- DatabaseQueryTimeout
- Uptime
- IPAddress
http://gallery.technet.microsoft.com/PowerShell-SSRS-Inventory-de5d2682
PS C:\> .\SSRSInventory.ps1 -InputFileName C:\SSRSList.txt -DirectoryToSaveTo C:\ -To pram@abc.com -From pram@abc.com -SMTP mail.abc.com
Reference:-
http://technet.microsoft.com/en-us/library/ms162169.aspx
http://technet.microsoft.com/en-us/library/ms124924.aspx
http://technet.microsoft.com/en-us/library/ms154648.aspx
http://www.mssqltips.com/sqlservertip/1826/getting-started-with-sql-server-management-objects-smo/