Skip to content

Commit 23e70aa

Browse files
committed
Fixed crash in Script Rule discovery logic
1 parent 039e46c commit 23e70aa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Engine/ScriptAnalyzer.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,12 @@ public List<ExternalRule> GetExternalRule(string[] moduleNames)
231231
string script = string.Format(CultureInfo.CurrentCulture, "Get-Module -Name '{0}' -ListAvailable", moduleName);
232232
shortModuleName = posh.AddScript(script).Invoke<PSModuleInfo>().First().Name;
233233

234+
// Invokes Update-Help for this module
235+
// Required since when invoking Get-Help later on, the cmdlet prompts for Update-Help interactively
236+
// By invoking Update-Help first, Get-Help will not prompt for downloading help later
237+
script = string.Format(CultureInfo.CurrentCulture, "Update-Help -Module '{0}' -Force", shortModuleName);
238+
posh.AddScript(script).Invoke();
239+
234240
// Invokes Get-Command and Get-Help for each functions in the module.
235241
script = string.Format(CultureInfo.CurrentCulture, "Get-Command -Module '{0}'", shortModuleName);
236242
var psobjects = posh.AddScript(script).Invoke();

0 commit comments

Comments
 (0)