Skip to content

Commit a872c8c

Browse files
committed
Add functions for installing, repairing, and uninstalling SQL Server Power BI Report Server
1 parent 13de1b1 commit a872c8c

File tree

6 files changed

+824
-0
lines changed

6 files changed

+824
-0
lines changed
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
<#
2+
.SYNOPSIS
3+
Installs SQL Server Power BI Report Server.
4+
5+
.DESCRIPTION
6+
Installs SQL Server Power BI Report Server using the provided setup executable.
7+
8+
.PARAMETER AcceptLicensingTerms
9+
Required parameter to be able to run unattended install. By specifying this
10+
parameter you acknowledge the acceptance of all license terms and notices for
11+
the specified features, the terms and notices that the setup executable
12+
normally asks for.
13+
14+
.PARAMETER MediaPath
15+
Specifies the path where to find the SQL Server installation media. On this
16+
path the SQL Server setup executable must be found.
17+
18+
.PARAMETER ProductKey
19+
Specifies the product key to use for the installation, e.g. '12345-12345-12345-12345-12345'.
20+
This parameter is mutually exclusive with the parameter Edition.
21+
22+
.PARAMETER EditionUpgrade
23+
Upgrades the edition of the installed product. Requires that either the
24+
ProductKey or the Edition parameter is also assigned. By default no edition
25+
upgrade is performed.
26+
27+
.PARAMETER Edition
28+
Specifies a free custom edition to use for the installation. This parameter
29+
is mutually exclusive with the parameter ProductKey.
30+
31+
.PARAMETER LogPath
32+
Specifies the file path where to write the log files, e.g. 'C:\Logs\Install.log'.
33+
By default log files are created under %TEMP%.
34+
35+
.PARAMETER InstallFolder
36+
Specifies the folder where to install the product, e.g. 'C:\Program Files\Power BI Report Server'.
37+
By default the product is installed under the default installation folder.
38+
39+
Reporting Services: %ProgramFiles%\Microsoft SQL Server Reporting Services
40+
PI Report Server: %ProgramFiles%\Microsoft Power BI Report Server
41+
42+
.PARAMETER SuppressRestart
43+
Suppresses the restart of the computer after the installation is finished.
44+
By default the computer is restarted after the installation is finished.
45+
46+
.PARAMETER Timeout
47+
Specifies how long to wait for the setup process to finish. Default value
48+
is `7200` seconds (2 hours). If the setup process does not finish before
49+
this time, an exception will be thrown.
50+
51+
.PARAMETER Force
52+
If specified the command will not ask for confirmation. Same as if Confirm:$false
53+
is used.
54+
55+
.EXAMPLE
56+
Install-SqlDscBIReportServer -AcceptLicensingTerms -MediaPath 'E:\PowerBIReportServer.exe'
57+
58+
Installs Power BI Report Server with default settings.
59+
60+
.EXAMPLE
61+
Install-SqlDscBIReportServer -AcceptLicensingTerms -MediaPath 'E:\PowerBIReportServer.exe' -ProductKey '12345-12345-12345-12345-12345'
62+
63+
Installs Power BI Report Server using a product key.
64+
65+
.EXAMPLE
66+
Install-SqlDscBIReportServer -AcceptLicensingTerms -MediaPath 'E:\PowerBIReportServer.exe' -Edition 'Evaluation' -InstallFolder 'C:\Program Files\Power BI Report Server'
67+
68+
Installs Power BI Report Server in evaluation edition to a custom folder.
69+
70+
.EXAMPLE
71+
Install-SqlDscBIReportServer -AcceptLicensingTerms -MediaPath 'E:\PowerBIReportServer.exe' -ProductKey '12345-12345-12345-12345-12345' -EditionUpgrade -LogPath 'C:\Logs\PowerBIReportServer_Install.log'
72+
73+
Installs Power BI Report Server and upgrades the edition using a product key. Also specifies a custom log path.
74+
#>
75+
function Install-SqlDscBIReportServer
76+
{
77+
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSShouldProcess', '', Justification = 'Because ShouldProcess is used in Invoke-SetupAction')]
78+
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')]
79+
[OutputType()]
80+
param
81+
(
82+
[Parameter(Mandatory = $true)]
83+
[System.Management.Automation.SwitchParameter]
84+
$AcceptLicensingTerms,
85+
86+
[Parameter(Mandatory = $true)]
87+
[System.String]
88+
$MediaPath,
89+
90+
[Parameter()]
91+
[System.String]
92+
$ProductKey,
93+
94+
[Parameter()]
95+
[System.Management.Automation.SwitchParameter]
96+
$EditionUpgrade,
97+
98+
[Parameter()]
99+
[ValidateSet('Development', 'Evaluation', 'ExpressAdvanced')]
100+
[System.String]
101+
$Edition,
102+
103+
[Parameter()]
104+
[System.String]
105+
$LogPath,
106+
107+
[Parameter()]
108+
[System.String]
109+
$InstallFolder,
110+
111+
[Parameter()]
112+
[System.Management.Automation.SwitchParameter]
113+
$SuppressRestart,
114+
115+
[Parameter()]
116+
[System.UInt32]
117+
$Timeout = 7200,
118+
119+
[Parameter()]
120+
[System.Management.Automation.SwitchParameter]
121+
$Force
122+
)
123+
124+
Invoke-ReportServerSetupAction -Install @PSBoundParameters
125+
}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
<#
2+
.SYNOPSIS
3+
Repairs an existing SQL Server Power BI Report Server installation.
4+
5+
.DESCRIPTION
6+
Repairs an existing SQL Server Power BI Report Server installation using
7+
the provided setup executable.
8+
9+
.PARAMETER AcceptLicensingTerms
10+
Required parameter to be able to run unattended repair. By specifying this
11+
parameter you acknowledge the acceptance of all license terms and notices for
12+
the specified features, the terms and notices that the setup executable
13+
normally asks for.
14+
15+
.PARAMETER MediaPath
16+
Specifies the path where to find the SQL Server installation media. On this
17+
path the SQL Server setup executable must be found.
18+
19+
.PARAMETER ProductKey
20+
Specifies the product key to use for the repair, e.g. '12345-12345-12345-12345-12345'.
21+
This parameter is mutually exclusive with the parameter Edition.
22+
23+
.PARAMETER EditionUpgrade
24+
Upgrades the edition of the installed product. Requires that either the
25+
ProductKey or the Edition parameter is also assigned. By default no edition
26+
upgrade is performed.
27+
28+
.PARAMETER Edition
29+
Specifies a free custom edition to use for the repair. This parameter
30+
is mutually exclusive with the parameter ProductKey.
31+
32+
.PARAMETER LogPath
33+
Specifies the file path where to write the log files, e.g. 'C:\Logs\Repair.log'.
34+
By default log files are created under %TEMP%.
35+
36+
.PARAMETER InstallFolder
37+
Specifies the folder where to install the product, e.g. 'C:\Program Files\Power BI Report Server'.
38+
By default the product is installed under the default installation folder.
39+
40+
PI Report Server: %ProgramFiles%\Microsoft Power BI Report Server
41+
42+
.PARAMETER SuppressRestart
43+
Suppresses the restart of the computer after the repair is finished.
44+
By default the computer is restarted after the repair is finished.
45+
46+
.PARAMETER Timeout
47+
Specifies how long to wait for the setup process to finish. Default value
48+
is `7200` seconds (2 hours). If the setup process does not finish before
49+
this time, an exception will be thrown.
50+
51+
.PARAMETER Force
52+
If specified the command will not ask for confirmation. Same as if Confirm:$false
53+
is used.
54+
55+
.EXAMPLE
56+
Repair-SqlDscBIReportServer -AcceptLicensingTerms -MediaPath 'E:\PowerBIReportServer.exe'
57+
58+
Repairs Power BI Report Server with default settings.
59+
60+
.EXAMPLE
61+
Repair-SqlDscBIReportServer -AcceptLicensingTerms -MediaPath 'E:\PowerBIReportServer.exe' -ProductKey '12345-12345-12345-12345-12345' -EditionUpgrade
62+
63+
Repairs Power BI Report Server and upgrades the edition using a
64+
product key.
65+
66+
.EXAMPLE
67+
Repair-SqlDscBIReportServer -AcceptLicensingTerms -MediaPath 'E:\PowerBIReportServer.exe' -LogPath 'C:\Logs\PowerBIReportServer_Repair.log'
68+
69+
Repairs Power BI Report Server and specifies a custom log path.
70+
#>
71+
function Repair-SqlDscBIReportServer
72+
{
73+
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSShouldProcess', '', Justification = 'Because ShouldProcess is used in Invoke-SetupAction')]
74+
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')]
75+
[OutputType()]
76+
param
77+
(
78+
[Parameter(Mandatory = $true)]
79+
[System.Management.Automation.SwitchParameter]
80+
$AcceptLicensingTerms,
81+
82+
[Parameter(Mandatory = $true)]
83+
[System.String]
84+
$MediaPath,
85+
86+
[Parameter()]
87+
[System.String]
88+
$ProductKey,
89+
90+
[Parameter()]
91+
[System.Management.Automation.SwitchParameter]
92+
$EditionUpgrade,
93+
94+
[Parameter()]
95+
[ValidateSet('Development', 'Evaluation', 'ExpressAdvanced')]
96+
[System.String]
97+
$Edition,
98+
99+
[Parameter()]
100+
[System.String]
101+
$LogPath,
102+
103+
[Parameter()]
104+
[System.String]
105+
$InstallFolder,
106+
107+
[Parameter()]
108+
[System.Management.Automation.SwitchParameter]
109+
$SuppressRestart,
110+
111+
[Parameter()]
112+
[System.UInt32]
113+
$Timeout = 7200,
114+
115+
[Parameter()]
116+
[System.Management.Automation.SwitchParameter]
117+
$Force
118+
)
119+
120+
Invoke-ReportServerSetupAction -Repair @PSBoundParameters
121+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<#
2+
.SYNOPSIS
3+
Uninstalls SQL Server Power BI Report Server.
4+
5+
.DESCRIPTION
6+
Uninstalls SQL Server Power BI Report Server using the provided setup executable.
7+
8+
.PARAMETER MediaPath
9+
Specifies the path where to find the SQL Server installation media. On this
10+
path the SQL Server setup executable must be found.
11+
12+
.PARAMETER LogPath
13+
Specifies the file path where to write the log files, e.g. 'C:\Logs\Uninstall.log'.
14+
By default log files are created under %TEMP%.
15+
16+
.PARAMETER SuppressRestart
17+
Suppresses the restart of the computer after the uninstallation is finished.
18+
By default the computer is restarted after the uninstallation is finished.
19+
20+
.PARAMETER Timeout
21+
Specifies how long to wait for the setup process to finish. Default value
22+
is `7200` seconds (2 hours). If the setup process does not finish before
23+
this time, an exception will be thrown.
24+
25+
.PARAMETER Force
26+
If specified the command will not ask for confirmation. Same as if Confirm:$false
27+
is used.
28+
29+
.EXAMPLE
30+
Uninstall-SqlDscBIReportServer -MediaPath 'E:\PowerBIReportServer.exe'
31+
32+
Uninstalls Power BI Report Server.
33+
34+
.EXAMPLE
35+
Uninstall-SqlDscBIReportServer -MediaPath 'E:\PowerBIReportServer.exe' -LogPath 'C:\Logs\PowerBIReportServer_Uninstall.log'
36+
37+
Uninstalls Power BI Report Server and specifies a custom log path.
38+
39+
.EXAMPLE
40+
Uninstall-SqlDscBIReportServer -MediaPath 'E:\PowerBIReportServer.exe' -Force
41+
42+
Uninstalls Power BI Report Server without prompting for confirmation.
43+
#>
44+
function Uninstall-SqlDscBIReportServer
45+
{
46+
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSShouldProcess', '', Justification = 'Because ShouldProcess is used in Invoke-SetupAction')]
47+
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')]
48+
[OutputType()]
49+
param
50+
(
51+
[Parameter(Mandatory = $true)]
52+
[System.String]
53+
$MediaPath,
54+
55+
[Parameter()]
56+
[System.String]
57+
$LogPath,
58+
59+
[Parameter()]
60+
[System.Management.Automation.SwitchParameter]
61+
$SuppressRestart,
62+
63+
[Parameter()]
64+
[System.UInt32]
65+
$Timeout = 7200,
66+
67+
[Parameter()]
68+
[System.Management.Automation.SwitchParameter]
69+
$Force
70+
)
71+
72+
Invoke-ReportServerSetupAction -Uninstall @PSBoundParameters
73+
}

0 commit comments

Comments
 (0)