You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Powershell 7+ ship with help included, but 5.1 does not on Windows Servers and CI. The secure devops pipeline also does not allow internet access, so we must update help from our local repository source.
197
+
198
+
# Only commands in Microsoft.PowerShell.Utility can be tested for help so as to minimize the repository storage.
199
+
# This requires admin rights
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.
202
+
203
+
$installHelpScript= {
204
+
$ErrorActionPreference='Stop'
205
+
if ((Get-HelpInvoke-RestMethod).remarks -notlike'Get-Help cannot find the Help files*') {
206
+
Write-Host-Fore Green 'Powershell 5.1 Utility Help is already installed'
207
+
return
208
+
}
209
+
210
+
# Cant use requires RunAsAdministrator because PS isn't smart enough to know this is a subscript.
211
+
if (-not [Security.Principal.WindowsPrincipal]::new([Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
212
+
throw'Windows PowerShell Update-Help requires admin rights. Please re-run the script in an elevated powershell session.'
213
+
}
214
+
215
+
# We store our local copy of help files here for testing as some pipelines disallow internet access
216
+
$helpPath='{{HELPPATH}}'
217
+
218
+
Write-Host-Fore Magenta "Powershell 5.1 Utility Help is not installed, installing from $helpPath"
Windows PowerShell does not have updated help in CI by default and we utilize a private Azure Devops repo for builds that has no internet access. The completion tests validate the Windows Help so we update it offline from here so these tests can work.
1
+
Windows PowerShell does not have updated help in CI by default and we utilize a private Azure Devops repo for builds that has no internet access. The completion tests validate the Windows Help so we update it offline from here so these tests can work. The help is updated as part of the build pipeline in PowerShellEditorServices.build.ps1 for PS5 only.
0 commit comments