Skip to content

Commit 21e4795

Browse files
Get-DbaService - Add PowerBI Report Server detection (#10298)
1 parent bee08f8 commit 21e4795

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

private/functions/Get-DbaReportingService.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ function Get-DbaReportingService {
116116
if ($serviceArray -notcontains $($service.ServiceName)) {
117117
if (!$InstanceName -or $service.InstanceName -in $InstanceName) {
118118
#Add other properties and methods
119-
Add-Member -Force -InputObject $service -MemberType NoteProperty -Name ServiceType -Value 'SSRS'
119+
$reportServiceType = if ($namespace.Name -eq "RS_PBIRS") { "PowerBI" } else { "SSRS" }
120+
Add-Member -Force -InputObject $service -MemberType NoteProperty -Name ServiceType -Value $reportServiceType
120121
Add-Member -Force -InputObject $service -MemberType AliasProperty -Name StartName -Value WindowsServiceIdentityActual
121122

122123
try {

public/Get-DbaService.ps1

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function Get-DbaService {
3030
3131
.PARAMETER Type
3232
Filters results to specific SQL Server service types such as Database Engine, SQL Agent, or Reporting Services.
33-
Use this when troubleshooting specific service types or performing targeted service management operations. Can be one of the following: "Agent", "Browser", "Engine", "FullText", "SSAS", "SSIS", "SSRS", "PolyBase", "Launchpad"
33+
Use this when troubleshooting specific service types or performing targeted service management operations. Can be one of the following: "Agent", "Browser", "Engine", "FullText", "SSAS", "SSIS", "SSRS", "PolyBase", "Launchpad", "PowerBI"
3434
3535
.PARAMETER ServiceName
3636
Specifies exact Windows service names to retrieve, bypassing automatic service discovery.
@@ -66,7 +66,7 @@ function Get-DbaService {
6666
Default display properties (via Select-DefaultView):
6767
- ComputerName: The name of the computer hosting the service
6868
- ServiceName: The Windows service name (e.g., MSSQLSERVER, SQLSERVERAGENT)
69-
- ServiceType: The type of SQL Server service (Engine, Agent, FullText, SSIS, SSAS, SSRS, Browser, PolyBase, Launchpad, Unknown)
69+
- ServiceType: The type of SQL Server service (Engine, Agent, FullText, SSIS, SSAS, SSRS, Browser, PolyBase, Launchpad, PowerBI, Unknown)
7070
- InstanceName: The SQL Server instance name associated with the service
7171
- DisplayName: The friendly display name of the service
7272
- StartName: The user account under which the service runs
@@ -150,7 +150,7 @@ function Get-DbaService {
150150
[DbaInstanceParameter[]]$SqlInstance,
151151
[PSCredential]$Credential,
152152
[Parameter(ParameterSetName = "Search")]
153-
[ValidateSet("Agent", "Browser", "Engine", "FullText", "SSAS", "SSIS", "SSRS", "PolyBase", "Launchpad")]
153+
[ValidateSet("Agent", "Browser", "Engine", "FullText", "SSAS", "SSIS", "SSRS", "PolyBase", "Launchpad", "PowerBI")]
154154
[string[]]$Type,
155155
[Parameter(ParameterSetName = "ServiceName")]
156156
[string[]]$ServiceName,
@@ -219,10 +219,14 @@ function Get-DbaService {
219219
$services = @()
220220
$outputServices = @()
221221

222-
if (!$Type -or 'SSRS' -in $Type) {
222+
if (!$Type -or 'SSRS' -in $Type -or 'PowerBI' -in $Type) {
223223
Write-Message -Level Verbose -Message "Getting SQL Reporting Server services on $computer" -Target $computer
224224
$reportingServices = Get-DbaReportingService -ComputerName $resolvedComputerName -InstanceName $InstanceName -Credential $Credential -ServiceName $ServiceName
225-
$outputServices += $reportingServices
225+
if ($Type) {
226+
$outputServices += $reportingServices | Where-Object ServiceType -in $Type
227+
} else {
228+
$outputServices += $reportingServices
229+
}
226230
}
227231

228232
Write-Message -Level Verbose -Message "Getting SQL Server namespaces on $computer" -Target $computer

0 commit comments

Comments
 (0)