Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
"hotfixes",
"checkpointing",
"HRESULT",
"RSDB"
"RSDB",
"RSIP"
],
"cSpell.ignorePaths": [
".git"
Expand Down
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
46 changes: 46 additions & 0 deletions source/Classes/002.ReportServerIPAddress.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<#
.SYNOPSIS
Represents an IP address entry returned by the ListIPAddresses CIM method.

.DESCRIPTION
This class represents an IP address available on the report server machine,
including the IP version (V4 or V6) and whether it is DHCP-enabled.

.PARAMETER IPAddress
The IP address string.

.PARAMETER IPVersion
The version of the IP address. Values are 'V4' for IPv4 or 'V6' for IPv6.

.PARAMETER IsDhcpEnabled
Indicates whether the IP address is DHCP-enabled. If true, the IP address
is dynamic and should not be used for TLS bindings.

.EXAMPLE
[ReportServerIPAddress]::new()

Creates a new empty ReportServerIPAddress instance.

.EXAMPLE
$ipAddress = [ReportServerIPAddress]::new()
$ipAddress.IPAddress = '192.168.1.1'
$ipAddress.IPVersion = 'V4'
$ipAddress.IsDhcpEnabled = $false

Creates a new ReportServerIPAddress instance with property values.
#>
class ReportServerIPAddress
{
[System.String]
$IPAddress

[System.String]
$IPVersion

[System.Boolean]
$IsDhcpEnabled

ReportServerIPAddress()
{
}
}
112 changes: 112 additions & 0 deletions source/Public/Get-SqlDscRSDatabaseInstallation.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<#
.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:
- Length: Number of entries in the arrays
- InstallationID: Array of installation IDs
- MachineName: Array of machine names
- InstanceName: Array of instance names
- IsInitialized: Array of initialization states
#>
if ($result.Length -gt 0)
{
for ($i = 0; $i -lt $result.Length; $i++)
{
[PSCustomObject] @{
InstallationID = $result.InstallationIDs[$i]
MachineName = $result.MachineNames[$i]
InstanceName = $result.InstanceNames[$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