Last active
January 9, 2019 23:10
-
-
Save sqldeployhelmet/64905dad4d70c797b631aa5680e02c06 to your computer and use it in GitHub Desktop.
PS commands to get SSRS details
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$servername = 'myserver' | |
$key = "Software\\Microsoft\\Microsoft SQL Server" | |
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $server) | |
$regKey = $reg.OpenSubKey($key) | |
$keys = $regKey.GetSubKeyNames() | |
$v = 0 | |
foreach($k in $keys) | |
{ | |
if(( $k -match 'MSRS[\d\d].') -and ($k -notcontains '\@')) | |
{ | |
$pv = $k.Substring(4, 2) | |
if ($v -le $pv) | |
{ | |
$v = $pv | |
$rs = "RS_" + $k.Substring($k.IndexOf('.') + 1) | |
} | |
} | |
} | |
$nspace = "root\Microsoft\SQLServer\ReportServer\$rs\v$v\Admin" | |
$RSServers = Get-WmiObject -Namespace $nspace -class MSReportServer_ConfigurationSetting -ComputerName $servername -ErrorVariable perror -ErrorAction SilentlyContinue | |
foreach ($r in $RSServers) | |
{ | |
#https://docs.microsoft.com/en-us/sql/reporting-services/wmi-provider-library-reference/msreportserver-configurationsetting-members?view=sql-server-2017 | |
$ssrsHost = $r.InstanceName | |
$ssrsVers = $r.version | |
$ssrsDB = $r.DatabaseName | |
$ssrsShare = $r.IsSharePointIntegrated | |
$ssrsService = $r.ServiceName | |
$vPath = $r.VirtualDirectoryReportServer | |
$urls = $r.ListReservedUrls() | |
$urls = $urls.UrlString[0] | |
$urls = $urls.Replace('+', $servername) + "/$vPath" | |
# do a thing with this specific SSRS instance details | |
$ssrsHost | |
$ssrsVers | |
$ssrsDB | |
$ssrsShare | |
$ssrsService | |
$vPath | |
$urls | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment