Get SCSM 2012 Database Info PowerShell Script

binoculars-880788_1920

So over the last several years I have had the need to discover what the name of both the Database and Database Servers are for System Center Service Manager. The below script will pull the data from the registry. For right now you can run it both on DataWarehouse Management Server or the Management Server, but you will get an error for Reporting Database Details when ran on the SCSM Management Server. This will work with SCSM 2010, 2012, 2012 R2. (I haven’t gotten a chance to confirm 2016 registry locations yet but I will be sure to update once I do.)  When I get some time, I think I will wrap this up in a module or function and publish it to codeplex. I will be sure to update this post once I have done that.


########################################################
# Version 1.0
# Author Date: 1/11/2017
# Author: Josh Ancel
# Get-SCSMDatabasesInfo.ps1
#
########################################################

$dbInfo = Get-ItemProperty "hklm:\software\microsoft\system center\2010\common\database"
$reportingDBInfo = Get-ItemProperty "hklm:\software\microsoft\system center\2010\common\reporting"

Write-Host "Database Details" -foreground "yellow"
$dbInfo | fl -Property DatabaseServerName, DatabaseName, RepositoryDatabaseName, DataMartDatabaseName, OMDataMartDatabaseName, CMDataMartDatabaseName, StagingDatabaseName, RepositorySQLInstance, DataMartSQLInstance, OMDataMartSQLInstance, CMDataMartSQLInstance, StagingSQLInstance

Write-Host "Reporting Database Details" -foreground "yellow"
$reportingDBInfo | fl -Property Server, ServerInstance, WebSeviceURL
#EOF

Another little piece of Code you can run on your on your SCSM Management Servers to get you SCSM SQL Server Analysis Database is below. This will tell you what server and instance your DWASDataBase is running on.

$class= get-scclass –Name Microsoft.SystemCenter.ResourceAccessLayer.ASResourceStore –ComputerName DataWarehouseManagmentServerName  
$OLAPServer= get-scclassinstance –class $class –ComputerName DataWarehouseManagmentServerName
$OLAPServer.Server
$OLAPServer.DataService

citation: https://technet.microsoft.com/en-us/library/dn464298(v=sc.12).aspx 

 

I hope this helps others as much as it has helped me!

Good Luck!

 

Leave a comment