@@ -198,7 +198,7 @@ Task SetupHelpForTests {
198
198
# Only commands in Microsoft.PowerShell.Archive can be tested for help so as to minimize the repository storage.
199
199
# This requires admin rights for PS5.1
200
200
201
- # NOTE: You can run this task once as admin or update help separately, and continue to run tests as non-admin, if for instance developing locally.
201
+ # NOTE: You can run this task once as admin or update help separately, and continue to run tests as non-admin, if for instance developing locally.
202
202
203
203
$installHelpScript = {
204
204
param (
@@ -212,7 +212,7 @@ Task SetupHelpForTests {
212
212
}
213
213
214
214
if ((Get-Help Expand-Archive ).remarks -notlike ' Get-Help cannot find the Help files*' ) {
215
- Write-Host - Fore Green " PowerShell $PSVersion Archive Help is already installed"
215
+ Write-Host - ForegroundColor Green " PowerShell $PSVersion Archive help is already installed"
216
216
return
217
217
}
218
218
@@ -223,11 +223,11 @@ Task SetupHelpForTests {
223
223
).IsInRole(
224
224
[Security.Principal.WindowsBuiltInRole ]::Administrator
225
225
)) {
226
- throw ' Windows PowerShell Update-Help requires admin rights. Please re-run the script in an elevated powershell session. '
226
+ throw ' Windows PowerShell Update-Help requires admin rights. Please re-run the script in an elevated PowerShell session! '
227
227
}
228
228
}
229
229
230
- Write-Host - Fore Magenta " Powershell $PSVersion Archive Help is not installed, installing from $helpPath "
230
+ Write-Host - ForegroundColor Magenta " PowerShell $PSVersion Archive help is not installed, installing from $helpPath "
231
231
232
232
$updateHelpParams = @ {
233
233
Module = ' Microsoft.PowerShell.Archive'
@@ -237,42 +237,42 @@ Task SetupHelpForTests {
237
237
Verbose = $true
238
238
}
239
239
240
- # PS7+ does not require admin rights if currentuser is used for scope. 5 .1 does not have this option.
240
+ # PS7+ does not require admin rights if CurrentUser is used for scope. PS5 .1 does not have this option.
241
241
if ($PSEdition -ne ' Desktop' ) {
242
242
$updateHelpParams .' Scope' = ' CurrentUser'
243
243
}
244
- # Update the help, and capture verbose output
244
+ # Update the help and capture verbose output
245
245
$updateHelpOutput = Update-Help @updateHelpParams * > & 1
246
246
247
247
if ((Get-Help Expand-Archive ).remarks -like ' Get-Help cannot find the Help files*' ) {
248
248
throw " Failed to install PowerShell $PSVersion Help: $updateHelpOutput "
249
249
} else {
250
- Write-Host - Fore Green " Powershell $PSVersion Archive Help installed successfully"
250
+ Write-Host - ForegroundColor Green " PowerShell $PSVersion Archive help installed successfully"
251
251
}
252
252
}
253
253
254
- # Need this to inject the help file path, since PSScriptRoot won't work inside the script
254
+ # Need this to inject the help file path since PSScriptRoot won't work inside the script
255
255
$helpPath = Resolve-Path " $PSScriptRoot \test\PowerShellEditorServices.Test.Shared\PSHelp" - ErrorAction Stop
256
- Write-Host - Fore Magenta " Runner Help located at $helpPath "
256
+ Write-Build DarkMagenta " Runner help located at $helpPath "
257
257
258
258
if (Get-Command powershell.exe - CommandType Application - ea 0 ) {
259
- Write-Host - Fore Magenta ' Checking PowerShell 5.1 help'
259
+ Write-Build DarkMagenta ' Checking PowerShell 5.1 help'
260
260
& powershell.exe - NoProfile - NonInteractive - Command $installHelpScript - args $helpPath
261
261
if ($LASTEXITCODE -ne 0 ) {
262
- throw ' Failed to install PowerShell 5.1 Help. '
262
+ throw ' Failed to install PowerShell 5.1 help! '
263
263
}
264
264
}
265
265
266
266
if ($PwshDaily -and (Get-Command $PwshDaily - ea 0 )) {
267
- Write-Host - Fore Magenta " Checking PWSH Daily help at $PwshDaily "
267
+ Write-Build DarkMagenta " Checking PowerShell Daily help at $PwshDaily "
268
268
Invoke-BuildExec { & $PwshDaily - NoProfile - NonInteractive - Command $installHelpScript - args $helpPath }
269
269
if ($LASTEXITCODE -ne 0 ) {
270
- throw ' Failed to install PowerShell Daily Help. '
270
+ throw ' Failed to install PowerShell Daily help! '
271
271
}
272
272
}
273
273
274
274
if ($PSEdition -eq ' Core' ) {
275
- Write-Host - Fore Magenta ' Checking Runner Pwsh help'
275
+ Write-Build DarkMagenta ' Checking this PowerShell process ' s help'
276
276
& $installHelpScript $helpPath
277
277
}
278
278
}
0 commit comments