-
Notifications
You must be signed in to change notification settings - Fork 7
/
PlatformOpsToolbox.ps1
189 lines (156 loc) · 4.93 KB
/
PlatformOpsToolbox.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }
$MainDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$ToolsDir = Join-Path -Path $MainDir -ChildPath \MiscScripts\Windows
$PreReqDir = Join-Path -Path $MainDir -ChildPath \InstallationValidator\Windows
$InstallerDir = Join-Path -Path $MainDir -ChildPath \AutomaticInstaller\Windows
$global:xExitSession=$false
function exitCode
{
if($?) {
Write-Host "The last command executed successfully"
} else {
write-host "The last command failed"
}
}
# Verify if the OutSystems Platform Server is installed
try{
$OS = Get-ItemProperty HKLM:\SOFTWARE\OutSystems\Installer\Server -ErrorAction SilentlyContinue
}
catch{
Write-Warning "Outsystems Platform Server is not installed on this server."
}
function MainMenu
{
param (
[string]$Title = 'PlatformOps ToolBox'
)
Clear-Host
Write-Host "================ $Title ================"
Write-Host " "
Write-Host "1: Type '1' to access the OutSytems Platform pre-requirements menu."
if(!$OS){
Write-Host " "
Write-Host "2: Type '2' to run the OutSytems Platform tuning reccomendations script."
}
Write-Host " "
Write-Host "Quit: Type anything else to quit."
Write-Host " "
$selectedMain = Read-Host "Please type your selection"
switch ($selectedMain)
{
1 {
ValidatorMenu
} 2 {
TuningMenu
} default {
$global:xExitSession=$true;
}
}
}
function ValidatorMenu
{
param (
[string]$Title = 'OutSystems Platform Pre-Requirements Menu'
)
Clear-Host
Write-Host "================ $Title ================"
Write-Host " "
Write-Host "1: Type 1 to validate OutSystems Platform Pre-Requirements on this server"
Write-Host " "
Write-Host "2: Type 2 to install OutSystems Platform Pre-Requirements"
Write-Host " "
Write-Host "0: Type 0 to go back to the Main Menu"
Write-Host " "
Write-Host "Quit: Type anything else to quit."
Write-Host " "
$selectedTools = Read-Host "Please type your selection"
switch ($selectedTools)
{
1 {
'You chose OutSystems Platform Pre-Requirements validation'
& $PreReqDir\Installation_Validator.ps1
exitCode
pause
} 2 {
'You chose OutSystems Platform Pre-Requirements installation'
& $PreReqDir\Pre-Requirements_Installator.ps1 -ScriptPath $MainDir
exitCode
pause
} 0 {
} default {
$global:xExitSession=$true;
}
}
}
function TuningMenu
{
param (
[string]$Title = 'OutSystems Platform Pre-Requirements Menu'
)
Clear-Host
Write-Host "================ $Title ================"
Write-Host " "
Write-Host "1: Type 1 to validate OutSystems Platform Pre-Requirements on this server"
Write-Host " "
Write-Host "2: Type 2 to install OutSystems Platform Pre-Requirements"
Write-Host " "
Write-Host "0: Type 0 to go back to the Main Menu"
Write-Host " "
Write-Host "Quit: Type anything else to quit."
Write-Host " "
$selectedTools = Read-Host "Please type your selection"
switch ($selectedTools)
{
1 {
'You chose OutSystems Platform Pre-Requirements validation'
& $PreReqDir\Installation_Validator.ps1
exitCode
pause
} 2 {
'You chose OutSystems Platform Pre-Requirements installation'
& $PreReqDir\Pre-Requirements_Installator.ps1 -ScriptPath $MainDir
exitCode
pause
} 0 {
} default {
$global:xExitSession=$true;
}
}
}
function TuningMenu
{
param (
[string]$Title = 'OutSystems Platform Tuning Script'
)
Clear-Host
Write-Host "================ $Title ================"
Write-Host " "
Write-Host "This script will change all parameters as described on the OutSystems checklist regarding IIS, Windows and ASP tunables. "
Write-Host " "
Write-Host "================ Run the Tuning Script ================ "
Write-Host " "
Write-Host " "
Write-Host "1: Type 1 to run the script."
Write-Host " "
Write-Host "Quit: Type anything else to quit."
Write-Host " "
$selectedTools = Read-Host "Please type your selection"
switch ($selectedTools)
{
1 {
'You chose OutSystems Platform Pre-Requirements validation'
& $InstallerDir\OutSystems_Platform_Tunning.ps1
exitCode
pause
} 0 {
} default {
$global:xExitSession=$true;
}
}
}
MainMenu
If ($xExitSession){
exit
}else{
& "$MainDir\PlatformOpsToolbox.ps1" #… Loop the function
}