-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstaller.ps1
More file actions
576 lines (498 loc) · 19.8 KB
/
installer.ps1
File metadata and controls
576 lines (498 loc) · 19.8 KB
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
[CmdletBinding()]
param()
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
function Write-Status {
param(
[Parameter(Mandatory = $true)]
[string]$Message,
[ConsoleColor]$Color = [ConsoleColor]::Gray
)
Write-Host $Message -ForegroundColor $Color
}
function Invoke-VerificationCheck {
param(
[Parameter(Mandatory = $true)]
[string]$Label,
[Parameter(Mandatory = $true)]
[scriptblock]$Check
)
# Print the check label first, keep the final result on the same line,
# and stop the installer immediately if the check throws.
Write-Host " Checking: $Label... " -NoNewline
try {
$result = & $Check
Write-Host 'PASS' -ForegroundColor Green
return $result
}
catch {
Write-Host 'FAIL' -ForegroundColor Red
throw
}
}
function Test-IsAdministrator {
$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal($identity)
return $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
}
function Test-FileExists {
param(
[Parameter(Mandatory = $true)]
[string]$Path
)
if (-not (Test-Path -LiteralPath $Path)) {
throw "Required file is missing: $Path"
}
}
function Initialize-StateFile {
param(
[Parameter(Mandatory = $true)]
[string]$Path
)
$defaultState = [pscustomobject]@{
status = 'unlocked'
generation = [guid]::NewGuid().Guid
lastActionUtc = (Get-Date).ToUniversalTime().ToString('o')
}
if (-not (Test-Path -LiteralPath $Path)) {
$defaultState | ConvertTo-Json -Depth 5 | Set-Content -LiteralPath $Path -Encoding UTF8
return
}
try {
$raw = Get-Content -LiteralPath $Path -Raw -Encoding UTF8
if ([string]::IsNullOrWhiteSpace($raw)) {
throw 'state.json is empty.'
}
$parsed = $raw | ConvertFrom-Json
if ([string]::IsNullOrWhiteSpace([string]$parsed.status)) {
throw 'state.json is missing status.'
}
if ([string]::IsNullOrWhiteSpace([string]$parsed.generation)) {
throw 'state.json is missing generation.'
}
if ([string]::IsNullOrWhiteSpace([string]$parsed.lastActionUtc)) {
throw 'state.json is missing lastActionUtc.'
}
}
catch {
# If the current file is missing, empty, or malformed, repair it in place
# instead of leaving the runtime components to fail later.
$defaultState | ConvertTo-Json -Depth 5 | Set-Content -LiteralPath $Path -Encoding UTF8
}
}
function Set-VideoConLock {
param(
[Parameter(Mandatory = $true)]
[ValidateRange(0, 86400)]
[int]$Seconds
)
# Always write both AC and DC because the feature must behave the same on
# mains power and battery unless explicitly changed later.
$output = & powercfg /setacvalueindex SCHEME_CURRENT SUB_VIDEO VIDEOCONLOCK $Seconds 2>&1
if ($LASTEXITCODE -ne 0) {
throw "powercfg /setacvalueindex failed (exit code $LASTEXITCODE). Output: $($output -join [Environment]::NewLine)"
}
$output = & powercfg /setdcvalueindex SCHEME_CURRENT SUB_VIDEO VIDEOCONLOCK $Seconds 2>&1
if ($LASTEXITCODE -ne 0) {
throw "powercfg /setdcvalueindex failed (exit code $LASTEXITCODE). Output: $($output -join [Environment]::NewLine)"
}
$output = & powercfg /setactive SCHEME_CURRENT 2>&1
if ($LASTEXITCODE -ne 0) {
throw "powercfg /setactive failed (exit code $LASTEXITCODE). Output: $($output -join [Environment]::NewLine)"
}
}
function Get-VideoConLockValues {
$output = & powercfg /q SCHEME_CURRENT SUB_VIDEO VIDEOCONLOCK 2>&1
if ($LASTEXITCODE -ne 0) {
throw "Failed to query VIDEOCONLOCK. Output: $($output -join [Environment]::NewLine)"
}
$text = ($output -join [Environment]::NewLine)
$acMatch = [regex]::Match($text, 'Current AC Power Setting Index:\s+0x([0-9a-fA-F]+)')
$dcMatch = [regex]::Match($text, 'Current DC Power Setting Index:\s+0x([0-9a-fA-F]+)')
if (-not $acMatch.Success -or -not $dcMatch.Success) {
throw 'Unable to parse VIDEOCONLOCK AC/DC values from powercfg output.'
}
[pscustomobject]@{
AC = [Convert]::ToInt32($acMatch.Groups[1].Value, 16)
DC = [Convert]::ToInt32($dcMatch.Groups[1].Value, 16)
Raw = $text
}
}
function Remove-ExistingTaskIfPresent {
param(
[Parameter(Mandatory = $true)]
[string]$TaskName
)
$existing = Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue
if ($null -eq $existing) {
return
}
Stop-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue
Unregister-ScheduledTask -TaskName $TaskName -Confirm:$false -ErrorAction Stop
$deadline = (Get-Date).AddSeconds(5)
do {
Start-Sleep -Milliseconds 200
$stillThere = Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue
if ($null -eq $stillThere) {
return
}
} while ((Get-Date) -lt $deadline)
throw "Existing task could not be removed cleanly: $TaskName"
}
function Register-TaskFromXml {
param(
[Parameter(Mandatory = $true)]
[string]$TaskName,
[Parameter(Mandatory = $true)]
[string]$Xml,
[string[]]$ExpectedStates = @('Ready')
)
Remove-ExistingTaskIfPresent -TaskName $TaskName
Register-ScheduledTask -TaskName $TaskName -Xml $Xml -ErrorAction Stop | Out-Null
Enable-ScheduledTask -TaskName $TaskName -ErrorAction Stop | Out-Null
# Verify the new task immediately after registration so task creation fails
# early instead of surfacing much later in post-install verification.
$null = Assert-TaskReady -TaskName $TaskName -AllowedStates $ExpectedStates
}
function Assert-TaskReady {
param(
[Parameter(Mandatory = $true)]
[string]$TaskName,
[string[]]$AllowedStates = @('Ready', 'Running')
)
$task = Get-ScheduledTask -TaskName $TaskName -ErrorAction Stop
if (-not $task.Settings.Enabled) {
throw "Task is disabled: $TaskName"
}
if ($AllowedStates -notcontains [string]$task.State) {
throw "Task $TaskName is in unexpected state '$($task.State)'. Expected one of: $($AllowedStates -join ', ')"
}
return $task
}
function Assert-StateFileValid {
param(
[Parameter(Mandatory = $true)]
[string]$Path
)
$state = Get-Content -LiteralPath $Path -Raw -Encoding UTF8 | ConvertFrom-Json
if ([string]::IsNullOrWhiteSpace([string]$state.status)) {
throw 'state.json is missing status.'
}
if ([string]::IsNullOrWhiteSpace([string]$state.generation)) {
throw 'state.json is missing generation.'
}
if ([string]::IsNullOrWhiteSpace([string]$state.lastActionUtc)) {
throw 'state.json is missing lastActionUtc.'
}
return $state
}
if (-not (Test-IsAdministrator)) {
Write-Host ''
Write-Status 'ERROR: installer.ps1 must be run from an elevated PowerShell window.' Red
Write-Status 'Open PowerShell with "Run as administrator" and run the installer again.' Yellow
Write-Host ''
exit 1
}
$Root = Split-Path -Parent $MyInvocation.MyCommand.Path
$InstallerPath = Join-Path $Root 'installer.ps1'
$UninstallerPath = Join-Path $Root 'uninstaller.ps1'
$ControllerPath = Join-Path $Root 'LockTimeoutController.ps1'
$RunHiddenPath = Join-Path $Root 'RunHidden.vbs'
$EnvVarName = 'TURN_OFF_SCREEN_ON_LOCK_UNINSTALL'
$DataDir = Join-Path $env:LOCALAPPDATA 'Turn-off-screen-on-lock'
if (-not (Test-Path -LiteralPath $DataDir)) {
New-Item -ItemType Directory -Path $DataDir -Force | Out-Null
}
$StatePath = Join-Path $DataDir 'state.json'
$TaskNameOnLock = 'Turn-off screen on lock - On Lock'
$TaskNameOnUnlock = 'Turn-off screen on lock - On Unlock'
$TaskNameOnWake = 'Turn-off screen on lock - On Wake'
$currentUserName = [Security.Principal.WindowsIdentity]::GetCurrent().Name
try {
Write-Status 'Starting installation...' Cyan
Write-Status "Root: $Root" DarkGray
Write-Status 'Validating required files...' Cyan
Test-FileExists -Path $InstallerPath
Test-FileExists -Path $ControllerPath
Test-FileExists -Path $RunHiddenPath
Write-Status 'Initializing runtime files...' Cyan
Initialize-StateFile -Path $StatePath
$BaselinePath = Join-Path $DataDir 'baseline.json'
$baselineExists = $false
if (Test-Path -LiteralPath $BaselinePath) {
try {
$existingBaseline = Get-Content -LiteralPath $BaselinePath -Raw -Encoding UTF8 | ConvertFrom-Json
if ($null -ne $existingBaseline.originalAC -and $null -ne $existingBaseline.originalDC) {
$baselineExists = $true
Write-Status 'Existing baseline.json found -- preserving original VIDEOCONLOCK values.' Cyan
}
}
catch {
# Malformed file -- will be overwritten below.
}
}
if (-not $baselineExists) {
Write-Status 'Saving original VIDEOCONLOCK values...' Cyan
$originalValues = Get-VideoConLockValues
$baseline = [pscustomobject]@{
originalAC = $originalValues.AC
originalDC = $originalValues.DC
savedAtUtc = (Get-Date).ToUniversalTime().ToString('o')
}
$baseline | ConvertTo-Json -Depth 5 | Set-Content -LiteralPath $BaselinePath -Encoding UTF8
}
$DefaultBaseline = 1
$DefaultWake = 300
$ConfigPath = Join-Path $DataDir 'config.json'
$configExists = $false
if (Test-Path -LiteralPath $ConfigPath) {
try {
$existingConfig = Get-Content -LiteralPath $ConfigPath -Raw -Encoding UTF8 | ConvertFrom-Json
if ($null -ne $existingConfig.baselineTimeoutSeconds -and $null -ne $existingConfig.wakeTimeoutSeconds) {
$configExists = $true
Write-Status 'Existing config.json found -- preserving user configuration.' Cyan
}
}
catch {
# Malformed file -- will be overwritten below.
}
}
if (-not $configExists) {
Write-Status 'Creating default config.json...' Cyan
$defaultConfig = [pscustomobject]@{
baselineTimeoutSeconds = $DefaultBaseline
wakeTimeoutSeconds = $DefaultWake
}
$defaultConfig | ConvertTo-Json -Depth 5 | Set-Content -LiteralPath $ConfigPath -Encoding UTF8
}
# Determine effective baseline: use existing config if present, otherwise default.
$baselineTimeout = $DefaultBaseline
if ($configExists) {
try {
$cfg = Get-Content -LiteralPath $ConfigPath -Raw -Encoding UTF8 | ConvertFrom-Json
if ($null -ne $cfg.baselineTimeoutSeconds) {
$val = [int]$cfg.baselineTimeoutSeconds
if ($val -ge 1 -and $val -le 86400) { $baselineTimeout = $val }
}
}
catch { }
Write-Status "Applying baseline VIDEOCONLOCK = $baselineTimeout seconds (from existing config)..." Cyan
} else {
Write-Status "Applying baseline VIDEOCONLOCK = $baselineTimeout seconds..." Cyan
}
Set-VideoConLock -Seconds $baselineTimeout
Write-Status 'Preparing task definitions...' Cyan
$escapedExe = [System.Security.SecurityElement]::Escape('wscript.exe')
$lockArgs = [System.Security.SecurityElement]::Escape("`"$RunHiddenPath`" OnLock")
$unlockArgs = [System.Security.SecurityElement]::Escape("`"$RunHiddenPath`" OnUnlock")
$wakeArgs = [System.Security.SecurityElement]::Escape("`"$RunHiddenPath`" PromoteOnWake")
$escapedUser = [System.Security.SecurityElement]::Escape($currentUserName)
$onLockXml = @"
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Author>$escapedUser</Author>
<Description>Marks the beginning of a new locked cycle.</Description>
</RegistrationInfo>
<Triggers>
<SessionStateChangeTrigger>
<Enabled>true</Enabled>
<StateChange>SessionLock</StateChange>
<UserId>$escapedUser</UserId>
</SessionStateChangeTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>$escapedUser</UserId>
<LogonType>InteractiveToken</LogonType>
<RunLevel>HighestAvailable</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>true</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>false</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT5M</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>$escapedExe</Command>
<Arguments>$lockArgs</Arguments>
</Exec>
</Actions>
</Task>
"@
$onUnlockXml = @"
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Author>$escapedUser</Author>
<Description>Restores the unlocked steady state and rearms the baseline timeout.</Description>
</RegistrationInfo>
<Triggers>
<SessionStateChangeTrigger>
<Enabled>true</Enabled>
<StateChange>SessionUnlock</StateChange>
<UserId>$escapedUser</UserId>
</SessionStateChangeTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>$escapedUser</UserId>
<LogonType>InteractiveToken</LogonType>
<RunLevel>HighestAvailable</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>true</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>false</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT5M</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>$escapedExe</Command>
<Arguments>$unlockArgs</Arguments>
</Exec>
</Actions>
</Task>
"@
$onWakeXml = @"
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Author>$escapedUser</Author>
<Description>Promotes VIDEOCONLOCK when the system exits Modern Standby while locked.</Description>
</RegistrationInfo>
<Triggers>
<EventTrigger>
<Enabled>true</Enabled>
<Subscription><QueryList><Query Id="0" Path="System"><Select Path="System">*[System[Provider[@Name='Microsoft-Windows-Kernel-Power'] and EventID=507]]</Select></Query></QueryList></Subscription>
</EventTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>$escapedUser</UserId>
<LogonType>InteractiveToken</LogonType>
<RunLevel>HighestAvailable</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>true</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>false</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT5M</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>$escapedExe</Command>
<Arguments>$wakeArgs</Arguments>
</Exec>
</Actions>
</Task>
"@
Write-Status 'Registering scheduled tasks (this might take a few seconds)...' Cyan
Register-TaskFromXml -TaskName $TaskNameOnLock -Xml $onLockXml -ExpectedStates @('Ready')
Register-TaskFromXml -TaskName $TaskNameOnUnlock -Xml $onUnlockXml -ExpectedStates @('Ready')
Register-TaskFromXml -TaskName $TaskNameOnWake -Xml $onWakeXml -ExpectedStates @('Ready')
Write-Status 'Setting uninstaller environment variable...' Cyan
[Environment]::SetEnvironmentVariable($EnvVarName, $null, 'User')
[Environment]::SetEnvironmentVariable($EnvVarName, $UninstallerPath, 'User')
Set-Item -Path "Env:\$EnvVarName" -Value $UninstallerPath
Write-Status 'Running post-install verification...' Cyan
Invoke-VerificationCheck -Label 'Support files exist' -Check {
Test-FileExists -Path $InstallerPath
Test-FileExists -Path $ControllerPath
Test-FileExists -Path $RunHiddenPath
$true
} | Out-Null
Invoke-VerificationCheck -Label 'state.json is valid' -Check {
Assert-StateFileValid -Path $StatePath
} | Out-Null
Invoke-VerificationCheck -Label "VIDEOCONLOCK AC/DC are both $baselineTimeout seconds" -Check {
$values = Get-VideoConLockValues
if ($values.AC -ne $baselineTimeout -or $values.DC -ne $baselineTimeout) {
throw "VIDEOCONLOCK verification failed. Expected AC=$baselineTimeout and DC=$baselineTimeout, found AC=$($values.AC) DC=$($values.DC)."
}
$values
} | Out-Null
Invoke-VerificationCheck -Label 'config.json is valid' -Check {
$c = Get-Content -LiteralPath $ConfigPath -Raw -Encoding UTF8 | ConvertFrom-Json
if ($null -eq $c.baselineTimeoutSeconds -or $null -eq $c.wakeTimeoutSeconds) {
throw 'config.json is missing required values.'
}
$c
} | Out-Null
Invoke-VerificationCheck -Label 'baseline.json is valid' -Check {
$b = Get-Content -LiteralPath $BaselinePath -Raw -Encoding UTF8 | ConvertFrom-Json
if ($null -eq $b.originalAC -or $null -eq $b.originalDC) {
throw 'baseline.json is missing required values.'
}
$b
} | Out-Null
Invoke-VerificationCheck -Label 'Uninstaller environment variable is set' -Check {
$persisted = [Environment]::GetEnvironmentVariable($EnvVarName, 'User')
if ($persisted -ne $UninstallerPath) {
throw "Expected $EnvVarName = '$UninstallerPath', found '$persisted'."
}
$true
} | Out-Null
Invoke-VerificationCheck -Label 'On Lock task exists, is enabled, and is in the correct state' -Check {
Assert-TaskReady -TaskName $TaskNameOnLock -AllowedStates @('Ready')
} | Out-Null
Invoke-VerificationCheck -Label 'On Unlock task exists, is enabled, and is in the correct state' -Check {
Assert-TaskReady -TaskName $TaskNameOnUnlock -AllowedStates @('Ready')
} | Out-Null
Invoke-VerificationCheck -Label 'On Wake task exists, is enabled, and is in the correct state' -Check {
Assert-TaskReady -TaskName $TaskNameOnWake -AllowedStates @('Ready')
} | Out-Null
Write-Host ''
Write-Status 'Installation completed successfully.' Green
Write-Host ''
}
catch {
Write-Host ''
Write-Status 'Installation failed.' Red
Write-Status $_.Exception.Message Yellow
Write-Host ''
throw
}