Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
ErrorDumpDirectory from the instance's setup configuration, which can be
used with `Get-ChildItem` and `Get-Content` to access service logs, portal
logs, and memory dumps.
- Added public command `Get-SqlDscRSExecutionLog` to query execution log entries
from the `ExecutionLog3` view in the report server database. Supports filtering
by date range, user name, report path, and maximum rows. Includes connection
parameters **Credential**, **LoginType**, **Encrypt**, and **StatementTimeout**.
- Added public command `Test-SqlDscRSAccessible` to verify that SQL Server
Reporting Services or Power BI Report Server web sites are accessible.
Supports both CIM configuration input (with dynamic `-Site` parameter) and
Expand Down Expand Up @@ -233,6 +237,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
by calling the `InitializeReportServer` CIM method. Used to complete initial
configuration after database and URL setup
([issue #2014](https://github.com/dsccommunity/SqlServerDsc/issues/2014)).
- Added public command `Get-SqlDscRSIPAddress` to list IP addresses available
for URL reservations. Wraps the `ListIPAddresses` CIM method.
- Added public command `Get-SqlDscRSDatabaseInstallation` to determine whether
a specific report server database is a Reporting Services database. Wraps
the `ListReportServersInDatabase` CIM method.
- Added public command `Request-SqlDscRSDatabaseUpgradeScript` to generate a
T-SQL script for upgrading the report server database schema. Wraps the
`GenerateDatabaseUpgradeScript` CIM method.
Expand Down
6 changes: 6 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,9 @@ stages:
# Group 5 - Post-initialization validation
'tests/Integration/Commands/Post.Initialization.RS.Integration.Tests.ps1'
'tests/Integration/Commands/Get-SqlDscRSUrl.Integration.Tests.ps1'
'tests/Integration/Commands/Get-SqlDscRSIPAddress.Integration.Tests.ps1'
'tests/Integration/Commands/Get-SqlDscRSDatabaseInstallation.Integration.Tests.ps1'
'tests/Integration/Commands/Get-SqlDscRSExecutionLog.Integration.Tests.ps1'
# Group 6 - Service account change
'tests/Integration/Commands/Set-SqlDscRSServiceAccount.Integration.Tests.ps1'
'tests/Integration/Commands/Get-SqlDscRSServiceAccount.Integration.Tests.ps1'
Expand Down Expand Up @@ -683,6 +686,9 @@ stages:
# Group 5 - Post-initialization validation
'tests/Integration/Commands/Post.Initialization.RS.Integration.Tests.ps1'
'tests/Integration/Commands/Get-SqlDscRSUrl.Integration.Tests.ps1'
'tests/Integration/Commands/Get-SqlDscRSIPAddress.Integration.Tests.ps1'
'tests/Integration/Commands/Get-SqlDscRSDatabaseInstallation.Integration.Tests.ps1'
'tests/Integration/Commands/Get-SqlDscRSExecutionLog.Integration.Tests.ps1'
# Group 6 - Service account change
'tests/Integration/Commands/Set-SqlDscRSServiceAccount.Integration.Tests.ps1'
'tests/Integration/Commands/Get-SqlDscRSServiceAccount.Integration.Tests.ps1'
Expand Down
111 changes: 111 additions & 0 deletions source/Public/Get-SqlDscRSDatabaseInstallation.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<#
.SYNOPSIS
Gets the report server installations registered in the database.

.DESCRIPTION
Gets the Reporting Services installations registered in the report
server database by calling the `ListReportServersInDatabase` method
on the `MSReportServer_ConfigurationSetting` CIM instance.

This command returns information about all report server installations
that are configured to use the same report server database, which is
useful in scale-out deployment scenarios.

The configuration CIM instance can be obtained using the
`Get-SqlDscRSConfiguration` command and passed via the pipeline.

.PARAMETER Configuration
Specifies the `MSReportServer_ConfigurationSetting` CIM instance for
the Reporting Services instance. This can be obtained using the
`Get-SqlDscRSConfiguration` command. This parameter accepts pipeline
input.

.EXAMPLE
Get-SqlDscRSConfiguration -InstanceName 'SSRS' | Get-SqlDscRSDatabaseInstallation

Gets all report server installations registered in the database.

.EXAMPLE
$config = Get-SqlDscRSConfiguration -InstanceName 'SSRS'
Get-SqlDscRSDatabaseInstallation -Configuration $config

Gets report server installations using a stored configuration object.

.INPUTS
`Microsoft.Management.Infrastructure.CimInstance`

Accepts MSReportServer_ConfigurationSetting CIM instance via pipeline.

.OUTPUTS
`System.Management.Automation.PSCustomObject`

Returns objects with properties: InstallationID, MachineName,
InstanceName, and IsInitialized.

.NOTES
This command calls the CIM/WMI provider method `ListReportServersInDatabase`
using `Invoke-RsCimMethod`.

.LINK
https://docs.microsoft.com/en-us/sql/reporting-services/wmi-provider-library-reference/configurationsetting-method-listreportserversindatabase
#>
function Get-SqlDscRSDatabaseInstallation
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('UseSyntacticallyCorrectExamples', '', Justification = 'Because the examples use pipeline input the rule cannot validate.')]
[CmdletBinding()]
[OutputType([System.Management.Automation.PSCustomObject])]
param
(
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[System.Object]
$Configuration
)

process
{
$instanceName = $Configuration.InstanceName

Write-Verbose -Message ($script:localizedData.Get_SqlDscRSDatabaseInstallation_Getting -f $instanceName)

$invokeRsCimMethodParameters = @{
CimInstance = $Configuration
MethodName = 'ListReportServersInDatabase'
}

try
{
$result = Invoke-RsCimMethod @invokeRsCimMethodParameters -ErrorAction 'Stop'

<#
The WMI method returns multiple parallel arrays:
- InstallationID: Array of installation IDs
- MachineName: Array of machine names
- InstanceName: Array of instance names
- IsInitialized: Array of initialization states
#>
if ($result.InstallationID)
{
for ($i = 0; $i -lt $result.InstallationID.Count; $i++)
{
[PSCustomObject] @{
InstallationID = $result.InstallationID[$i]
MachineName = $result.MachineName[$i]
InstanceName = $result.InstanceName[$i]
IsInitialized = $result.IsInitialized[$i]
}
}
}
}
catch
{
$PSCmdlet.ThrowTerminatingError(
[System.Management.Automation.ErrorRecord]::new(
($script:localizedData.Get_SqlDscRSDatabaseInstallation_FailedToGet -f $instanceName, $_.Exception.Message),
'GSRSDI0001',
[System.Management.Automation.ErrorCategory]::InvalidOperation,
$Configuration
)
)
}
}
}
Loading
Loading