|
63 | 63 | If specified the command will not ask for confirmation. Same as if Confirm:$false |
64 | 64 | is used. |
65 | 65 |
|
| 66 | + .PARAMETER PassThru |
| 67 | + If specified the command will return the setup process exit code. |
| 68 | +
|
66 | 69 | .LINK |
67 | 70 | https://learn.microsoft.com/en-us/power-bi/report-server/install-report-server |
68 | 71 | https://learn.microsoft.com/en-us/sql/reporting-services/install-windows/install-reporting-services |
69 | 72 |
|
70 | 73 | .OUTPUTS |
71 | | - None. |
| 74 | + When PassThru is specified the function will return the setup process exit |
| 75 | + code as System.Int32. Otherwise, the function does not generate any output. |
72 | 76 |
|
73 | 77 | .EXAMPLE |
74 | 78 | Invoke-ReportServerSetupAction -Install -AcceptLicensingTerms -MediaPath 'E:\SQLServerReportingServices.exe' |
|
99 | 103 | Invoke-ReportServerSetupAction -Uninstall -MediaPath 'E:\SQLServerReportingServices.exe' -Force |
100 | 104 |
|
101 | 105 | Uninstalls SQL Server Reporting Services without prompting for confirmation. |
| 106 | +
|
| 107 | + .EXAMPLE |
| 108 | + $exitCode = Invoke-ReportServerSetupAction -Install -AcceptLicensingTerms -MediaPath 'E:\SQLServerReportingServices.exe' -PassThru |
| 109 | +
|
| 110 | + Installs SQL Server Reporting Services and returns the setup process exit code. |
102 | 111 | #> |
103 | 112 | function Invoke-ReportServerSetupAction |
104 | 113 | { |
105 | 114 | [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')] |
106 | | - [OutputType()] |
| 115 | + [OutputType([System.Int32])] |
107 | 116 | param |
108 | 117 | ( |
109 | 118 | [Parameter(ParameterSetName = 'Install', Mandatory = $true)] |
@@ -180,7 +189,11 @@ function Invoke-ReportServerSetupAction |
180 | 189 |
|
181 | 190 | [Parameter()] |
182 | 191 | [System.Management.Automation.SwitchParameter] |
183 | | - $Force |
| 192 | + $Force, |
| 193 | + |
| 194 | + [Parameter()] |
| 195 | + [System.Management.Automation.SwitchParameter] |
| 196 | + $PassThru |
184 | 197 | ) |
185 | 198 |
|
186 | 199 | if ($Force.IsPresent -and -not $Confirm) |
@@ -328,5 +341,10 @@ function Invoke-ReportServerSetupAction |
328 | 341 | '{0} {1}' -f $setupExitMessage, ($script:localizedData.SetupAction_SetupSuccessful) |
329 | 342 | ) |
330 | 343 | } |
| 344 | + |
| 345 | + if ($PassThru.IsPresent) |
| 346 | + { |
| 347 | + return $processExitCode |
| 348 | + } |
331 | 349 | } |
332 | 350 | } |
0 commit comments