-
Notifications
You must be signed in to change notification settings - Fork 8
/
install-modules.ps1
128 lines (108 loc) · 3.93 KB
/
install-modules.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#requires -RunAsAdministrator
#requires -Version 5.1
param(
[switch] $Azure = $true
)
# Do not display progress (performance improvement)
$global:ProgressPreference = 'silentlyContinue'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Get-PackageProvider -Name Nuget -ForceBootstrap
#region "WebAdministration module"
# Module WebAdministration is required by Sitecore Install Framework
# This module is installed as part of Web-Server feature
if( (Get-Module -Name WebAdministration -ListAvailable) -eq $null )
{
If ( [bool](Get-Command -Name "Install-WindowsFeature" -ErrorAction SilentlyContinue) )
{
Install-WindowsFeature -Name Web-Server
}
else
{
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole
}
}
#endregion
#Temporary change default installation policy
$defaultPolicy = (Get-PSRepository -Name PSGallery).InstallationPolicy
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
if( $Azure -eq $true)
{
Install-Module Azure -MinimumVersion 5.1.2
Install-Module AzureRM.Profile
Install-Module AzureRM.Storage
Install-Module AzureRM.KeyVault
}
#region "Register Sitecore Gallery
if( (Get-PSRepository -Name SitecoreGallery -ErrorAction SilentlyContinue) -eq $null )
{
Write-Verbose "Configure SitecoreGallery repository"
Register-PSRepository -Name SitecoreGallery -SourceLocation https://sitecore.myget.org/F/sc-powershell/api/v2 -InstallationPolicy Trusted
}
#endregion
#region "SitecoreInstallFramework for Sitecore 9.1 and later"
if( (Get-Module -Name SitecoreInstallFramework -ListAvailable) -eq $null )
{
#If install-module is not available check https://www.microsoft.com/en-us/download/details.aspx?id=49186
Install-Module SitecoreInstallFramework -Scope AllUsers -Repository SitecoreGallery
}
else
{
Write-Verbose "SIF module already installed, update then"
Update-Module SitecoreInstallFramework -Force
}
#endregion
#region "SitecoreInstallFramework for Sitecore 9.0.x"
$sifModule = Get-Module -Name SitecoreInstallFramework -ListAvailable
if( $sifModule -eq $null -or $sifModule.Version -ne '1.2.1' )
{
#If install-module is not available check https://www.microsoft.com/en-us/download/details.aspx?id=49186
Install-Module SitecoreInstallFramework -Scope AllUsers -Repository SitecoreGallery -RequiredVersion 1.2.1 -AllowClobber
}
#endregion
#region "SitecoreFundamentals"
if( (Get-Module -Name SitecoreFundamentals -ListAvailable) -eq $null )
{
#If install-module is not available check https://www.microsoft.com/en-us/download/details.aspx?id=49186
Install-Module SitecoreFundamentals -Scope AllUsers -Repository SitecoreGallery
}
else
{
Write-Verbose "SitecoreFundamentals module already installed, update then"
Update-Module SitecoreFundamentals -Force
}
#endregion
#region "SitecoreInstallExtensions"
if( (Get-Module -Name SitecoreInstallExtensions -ListAvailable) -eq $null )
{
#If install-module is not available check https://www.microsoft.com/en-us/download/details.aspx?id=49186
Install-Module SitecoreInstallExtensions -Scope AllUsers -Repository PSGallery
}
else
{
Write-Verbose "SitecoreInstallExtensions module already installed, update then"
Update-Module SitecoreInstallExtensions -Force
}
#endregion
#region "SitecoreInstallAzure"
if( $Azure -eq $true)
{
if( (Get-Module -Name SitecoreInstallAzure -ListAvailable) -eq $null )
{
#If install-module is not available check https://www.microsoft.com/en-us/download/details.aspx?id=49186
Install-Module SitecoreInstallAzure -Scope AllUsers -Repository PSGallery
}
else
{
Write-Verbose "SitecoreInstallAzure module already installed, update then"
Update-Module SitecoreInstallAzure -Force
}
}
#endregion
#region "SqlServer module"
if( (Get-Module -Name SqlServer -ListAvailable) -eq $null )
{
Install-Module SqlServer
}
#endregion
Set-PSRepository PSGallery -InstallationPolicy $defaultPolicy
Get-Module Sitecore* -ListAvailable | Format-List