MCPcopy Create free account
hub / github.com/Azure/powershell / getLatestModuleScript

Method getLatestModuleScript

src/Utilities/ScriptBuilder.ts:9–25  ·  view source on GitHub ↗
(moduleName: string)

Source from the content-addressed store, hash-verified

7 script: string = "";
8
9 getLatestModuleScript(moduleName: string): string {
10 const command: string = `Get-Module -Name ${moduleName} -ListAvailable | Sort-Object Version -Descending | Select-Object -First 1`;
11 this.script += `try {
12 $ErrorActionPreference = "Stop"
13 $WarningPreference = "SilentlyContinue"
14 $output = @{}
15 $data = ${command}
16 $output['${Constants.AzVersion}'] = $data.Version.ToString()
17 $output['${Constants.Success}'] = "true"
18 }
19 catch {
20 $output['${Constants.Error}'] = $_.exception.Message
21 }
22 return ConvertTo-Json $output`;
23 core.debug(`GetLatestModuleScript: ${this.script}`);
24 return this.script;
25 }
26
27 checkModuleVersionScript(moduleName: string, version: string) {
28 const command: string = `Get-Module -Name ${moduleName} -ListAvailable | Where-Object Version -match ${version}`;

Callers 1

getLatestModuleMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected