mirror of
https://github.com/actions/runner-images.git
synced 2025-12-15 06:08:07 +00:00
[Windows] Implement new directories hierarchy (#8616)
This commit is contained in:
committed by
GitHub
parent
84a7deae24
commit
d1f2c9a3be
189
images/windows/scripts/docs-gen/SoftwareReport.Android.psm1
Normal file
189
images/windows/scripts/docs-gen/SoftwareReport.Android.psm1
Normal file
@@ -0,0 +1,189 @@
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Helpers.psm1") -DisableNameChecking
|
||||
|
||||
function Split-TableRowByColumns {
|
||||
param(
|
||||
[string] $Row
|
||||
)
|
||||
return $Row.Split("|") | ForEach-Object { $_.trim() }
|
||||
}
|
||||
|
||||
function Get-AndroidSDKRoot {
|
||||
param(
|
||||
[string] $ComponentName
|
||||
)
|
||||
$path = Join-Path $env:ANDROID_HOME $ComponentName
|
||||
return "Location $path"
|
||||
}
|
||||
|
||||
function Get-AndroidSDKManagerPath {
|
||||
return Join-Path $env:ANDROID_HOME "cmdline-tools\latest\bin\sdkmanager.bat"
|
||||
}
|
||||
|
||||
function Get-AndroidInstalledPackages {
|
||||
$androidSDKManagerPath = Get-AndroidSDKManagerPath
|
||||
$androidSDKManagerList = cmd /c "$androidSDKManagerPath --list_installed 2>&1"
|
||||
$androidSDKManagerList = $androidSDKManagerList -notmatch "Warning"
|
||||
return $androidSDKManagerList
|
||||
}
|
||||
|
||||
function Build-AndroidTable {
|
||||
$packageInfo = Get-AndroidInstalledPackages
|
||||
return @(
|
||||
@{
|
||||
"Package" = "Android Command Line Tools"
|
||||
"Version" = Get-AndroidCommandLineToolsVersion
|
||||
},
|
||||
@{
|
||||
"Package" = "Android Emulator"
|
||||
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "Android Emulator"
|
||||
},
|
||||
@{
|
||||
"Package" = "Android SDK Build-tools"
|
||||
"Version" = Get-AndroidBuildToolVersions -PackageInfo $packageInfo
|
||||
},
|
||||
@{
|
||||
"Package" = "Android SDK Platforms"
|
||||
"Version" = Get-AndroidPlatformVersions -PackageInfo $packageInfo
|
||||
},
|
||||
@{
|
||||
"Package" = "Android SDK Platform-Tools"
|
||||
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "Android SDK Platform-Tools"
|
||||
},
|
||||
@{
|
||||
"Package" = "Android SDK Tools"
|
||||
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "Android SDK Tools"
|
||||
},
|
||||
@{
|
||||
"Package" = "Android Support Repository"
|
||||
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "Android Support Repository"
|
||||
},
|
||||
@{
|
||||
"Package" = "CMake"
|
||||
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "cmake"
|
||||
},
|
||||
@{
|
||||
"Package" = "Google APIs"
|
||||
"Version" = Get-AndroidGoogleAPIsVersions -PackageInfo $packageInfo
|
||||
},
|
||||
@{
|
||||
"Package" = "Google Play services"
|
||||
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "Google Play services"
|
||||
},
|
||||
@{
|
||||
"Package" = "Google Repository"
|
||||
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "Google Repository"
|
||||
},
|
||||
@{
|
||||
"Package" = "NDK"
|
||||
"Version" = Get-AndroidNdkVersions -PackageInfo $packageInfo
|
||||
},
|
||||
@{
|
||||
"Package" = "SDK Patch Applier v4"
|
||||
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "SDK Patch Applier v4"
|
||||
}
|
||||
) | Where-Object { $_.Version } | ForEach-Object {
|
||||
[PSCustomObject] @{
|
||||
"Package Name" = $_.Package
|
||||
"Version" = $_.Version
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Get-AndroidPackageVersions {
|
||||
param (
|
||||
[Parameter(Mandatory)]
|
||||
[object] $PackageInfo,
|
||||
[Parameter(Mandatory)]
|
||||
[object] $MatchedString
|
||||
)
|
||||
|
||||
$versions = $packageInfo | Where-Object { $_ -Match $MatchedString } | ForEach-Object {
|
||||
$packageInfoParts = Split-TableRowByColumns $_
|
||||
return $packageInfoParts[1]
|
||||
}
|
||||
return ($versions -Join "<br>")
|
||||
}
|
||||
|
||||
function Get-AndroidPlatformVersions {
|
||||
param (
|
||||
[Parameter(Mandatory)]
|
||||
[object] $PackageInfo
|
||||
)
|
||||
|
||||
$versions = $packageInfo | Where-Object { $_ -Match "Android SDK Platform " } | ForEach-Object {
|
||||
$packageInfoParts = Split-TableRowByColumns $_
|
||||
$revision = $packageInfoParts[1]
|
||||
$version = $packageInfoParts[0].split(";")[1]
|
||||
return "$version (rev $revision)"
|
||||
}
|
||||
[array]::Reverse($versions)
|
||||
return ($versions -Join "<br>")
|
||||
}
|
||||
|
||||
function Get-AndroidCommandLineToolsVersion {
|
||||
$commandLineTools = Get-AndroidSDKManagerPath
|
||||
(cmd /c "$commandLineTools --version 2>NUL" | Out-String).Trim() -match "(?<version>^(\d+\.){1,}\d+$)" | Out-Null
|
||||
$commandLineToolsVersion = $Matches.Version
|
||||
return $commandLineToolsVersion
|
||||
}
|
||||
|
||||
function Get-AndroidBuildToolVersions {
|
||||
param (
|
||||
[Parameter(Mandatory)]
|
||||
[object] $PackageInfo
|
||||
)
|
||||
|
||||
$versions = $packageInfo | Where-Object { $_ -Match "Android SDK Build-Tools" } | ForEach-Object {
|
||||
$packageInfoParts = Split-TableRowByColumns $_
|
||||
return $packageInfoParts[1]
|
||||
}
|
||||
$groupVersions = @()
|
||||
$versions | ForEach-Object {
|
||||
$majorVersion = $_.Split(".")[0]
|
||||
$groupVersions += $versions | Where-Object { $_.StartsWith($majorVersion) } | Join-String -Separator " "
|
||||
}
|
||||
return ($groupVersions | Sort-Object -Descending -Unique | Join-String -Separator "<br>")
|
||||
}
|
||||
|
||||
function Get-AndroidGoogleAPIsVersions {
|
||||
param (
|
||||
[Parameter(Mandatory)]
|
||||
[object] $PackageInfo
|
||||
)
|
||||
|
||||
$versions = $packageInfo | Where-Object { $_ -Match "addon-google_apis" } | ForEach-Object {
|
||||
$packageInfoParts = Split-TableRowByColumns $_
|
||||
return $packageInfoParts[0].split(";")[1]
|
||||
}
|
||||
return ($versions -Join "<br>")
|
||||
}
|
||||
|
||||
function Get-AndroidNdkVersions {
|
||||
param (
|
||||
[Parameter(Mandatory)]
|
||||
[object] $PackageInfo
|
||||
)
|
||||
|
||||
$ndkDefaultFullVersion = Get-ChildItem $env:ANDROID_NDK_HOME -Name
|
||||
|
||||
$versions = $packageInfo | Where-Object { $_ -Match "ndk;" } | ForEach-Object {
|
||||
$version = (Split-TableRowByColumns $_)[1]
|
||||
if ($version -eq $ndkDefaultFullVersion) {
|
||||
$version += " (default)"
|
||||
}
|
||||
$version
|
||||
}
|
||||
return ($versions -Join "<br>")
|
||||
}
|
||||
|
||||
function Build-AndroidEnvironmentTable {
|
||||
$androidVersions = Get-Item env:ANDROID_*
|
||||
|
||||
$shoulddResolveLink = 'ANDROID_NDK', 'ANDROID_NDK_HOME', 'ANDROID_NDK_ROOT', 'ANDROID_NDK_LATEST_HOME'
|
||||
return $androidVersions | Sort-Object -Property Name | ForEach-Object {
|
||||
[PSCustomObject] @{
|
||||
"Name" = $_.Name
|
||||
"Value" = if ($shoulddResolveLink.Contains($_.Name )) { Get-PathWithLink($_.Value) } else {$_.Value}
|
||||
}
|
||||
}
|
||||
}
|
||||
100
images/windows/scripts/docs-gen/SoftwareReport.Browsers.psm1
Normal file
100
images/windows/scripts/docs-gen/SoftwareReport.Browsers.psm1
Normal file
@@ -0,0 +1,100 @@
|
||||
$browsers = @{
|
||||
chrome = @{
|
||||
Name="Google Chrome";
|
||||
File="chrome.exe"
|
||||
};
|
||||
edge = @{
|
||||
Name="Microsoft Edge";
|
||||
File="msedge.exe"
|
||||
};
|
||||
firefox = @{
|
||||
Name="Mozilla Firefox";
|
||||
File="firefox.exe"
|
||||
}
|
||||
}
|
||||
|
||||
$webDrivers = @{
|
||||
chrome = @{
|
||||
Name="Chrome Driver";
|
||||
Path="C:\SeleniumWebDrivers\ChromeDriver"
|
||||
};
|
||||
edge = @{
|
||||
Name="Microsoft Edge Driver";
|
||||
Path="C:\SeleniumWebDrivers\EdgeDriver"
|
||||
};
|
||||
firefox = @{
|
||||
Name="Gecko Driver";
|
||||
Path="C:\SeleniumWebDrivers\GeckoDriver"
|
||||
};
|
||||
iexplorer = @{
|
||||
Name="IE Driver";
|
||||
Path="C:\SeleniumWebDrivers\IEDriver"
|
||||
}
|
||||
}
|
||||
|
||||
function Build-BrowserSection {
|
||||
return @(
|
||||
$(Get-BrowserVersion -Browser "chrome"),
|
||||
$(Get-SeleniumWebDriverVersion -Driver "chrome"),
|
||||
$(Get-BrowserVersion -Browser "edge"),
|
||||
$(Get-SeleniumWebDriverVersion -Driver "edge"),
|
||||
$(Get-BrowserVersion -Browser "firefox"),
|
||||
$(Get-SeleniumWebDriverVersion -Driver "firefox"),
|
||||
$(Get-SeleniumWebDriverVersion -Driver "iexplorer"),
|
||||
$(Get-SeleniumVersion)
|
||||
)
|
||||
}
|
||||
|
||||
function Get-BrowserVersion {
|
||||
param(
|
||||
[string] $Browser
|
||||
)
|
||||
$browserName = $browsers.$Browser.Name
|
||||
$browserFile = $browsers.$Browser.File
|
||||
$registryKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\$browserFile"
|
||||
$browserVersion = (Get-Item (Get-ItemProperty $registryKey)."(Default)").VersionInfo.FileVersion
|
||||
return [ToolVersionNode]::new($browserName, $browserVersion)
|
||||
}
|
||||
|
||||
function Get-SeleniumWebDriverVersion {
|
||||
param(
|
||||
[string] $Driver
|
||||
)
|
||||
$driverName = $webDrivers.$Driver.Name
|
||||
$driverPath = $webDrivers.$Driver.Path
|
||||
$versionFileName = "versioninfo.txt";
|
||||
$webDriverVersion = Get-Content -Path "$driverPath\$versionFileName"
|
||||
return [ToolVersionNode]::new($driverName, $webDriverVersion)
|
||||
}
|
||||
|
||||
function Get-SeleniumVersion {
|
||||
$seleniumBinaryName = (Get-ToolsetContent).selenium.binary_name
|
||||
$fullSeleniumVersion = (Get-ChildItem "C:\selenium\${seleniumBinaryName}-*").Name -replace "${seleniumBinaryName}-"
|
||||
return [ToolVersionNode]::new("Selenium server", $fullSeleniumVersion)
|
||||
}
|
||||
|
||||
function Build-BrowserWebdriversEnvironmentTable {
|
||||
return @(
|
||||
@{
|
||||
"Name" = "CHROMEWEBDRIVER"
|
||||
"Value" = $env:CHROMEWEBDRIVER
|
||||
},
|
||||
@{
|
||||
"Name" = "EDGEWEBDRIVER"
|
||||
"Value" = $env:EDGEWEBDRIVER
|
||||
},
|
||||
@{
|
||||
"Name" = "GECKOWEBDRIVER"
|
||||
"Value" = $env:GECKOWEBDRIVER
|
||||
},
|
||||
@{
|
||||
"Name" = "SELENIUM_JAR_PATH"
|
||||
"Value" = $env:SELENIUM_JAR_PATH
|
||||
}
|
||||
) | ForEach-Object {
|
||||
[PSCustomObject] @{
|
||||
"Name" = $_.Name
|
||||
"Value" = $_.Value
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
function Get-ToolcacheGoVersions {
|
||||
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "Go"
|
||||
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
|
||||
}
|
||||
|
||||
function Get-ToolcacheNodeVersions {
|
||||
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "Node"
|
||||
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
|
||||
}
|
||||
|
||||
function Get-ToolcachePythonVersions {
|
||||
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "Python"
|
||||
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
|
||||
}
|
||||
|
||||
function Get-ToolcacheRubyVersions {
|
||||
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "Ruby"
|
||||
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
|
||||
}
|
||||
|
||||
function Get-ToolcachePyPyVersions {
|
||||
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "PyPy"
|
||||
Get-ChildItem -Path $toolcachePath -Name | Sort-Object { [Version] $_ } | ForEach-Object {
|
||||
$pypyRootPath = Join-Path $toolcachePath $_ "x86"
|
||||
[string]$pypyVersionOutput = & "$pypyRootPath\python.exe" -c "import sys;print(sys.version)"
|
||||
$pypyVersionOutput -match "^([\d\.]+) \(.+\) \[PyPy ([\d\.]+\S*) .+]$" | Out-Null
|
||||
return "{0} [PyPy {1}]" -f $Matches[1], $Matches[2]
|
||||
}
|
||||
}
|
||||
|
||||
function Build-CachedToolsSection
|
||||
{
|
||||
return @(
|
||||
[ToolVersionsListNode]::new("Go", $(Get-ToolcacheGoVersions), '^\d+\.\d+', 'List'),
|
||||
[ToolVersionsListNode]::new("Node.js", $(Get-ToolcacheNodeVersions), '^\d+', 'List'),
|
||||
[ToolVersionsListNode]::new("Python", $(Get-ToolcachePythonVersions), '^\d+\.\d+', 'List'),
|
||||
[ToolVersionsListNode]::new("PyPy", $(Get-ToolcachePyPyVersions), '^\d+\.\d+', 'List'),
|
||||
[ToolVersionsListNode]::new("Ruby", $(Get-ToolcacheRubyVersions), '^\d+\.\d+', 'List')
|
||||
)
|
||||
}
|
||||
328
images/windows/scripts/docs-gen/SoftwareReport.Common.psm1
Normal file
328
images/windows/scripts/docs-gen/SoftwareReport.Common.psm1
Normal file
@@ -0,0 +1,328 @@
|
||||
function Initialize-RustEnvironment {
|
||||
$env:RUSTUP_HOME = "C:\Users\Default\.rustup"
|
||||
$env:CARGO_HOME = "C:\Users\Default\.cargo"
|
||||
$env:Path += ";$env:CARGO_HOME\bin"
|
||||
}
|
||||
|
||||
function Get-OSName {
|
||||
return (Get-CimInstance -ClassName Win32_OperatingSystem).Caption | Take-Part -Part 1,2,3
|
||||
}
|
||||
|
||||
function Get-OSVersion {
|
||||
$OSVersion = (Get-CimInstance -ClassName Win32_OperatingSystem).Version
|
||||
$OSBuild = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion' UBR).UBR
|
||||
return "$OSVersion Build $OSBuild"
|
||||
}
|
||||
|
||||
function Build-OSInfoSection {
|
||||
$osInfoNode = [HeaderNode]::new($(Get-OSName))
|
||||
$osInfoNode.AddToolVersion("OS Version:", $(Get-OSVersion))
|
||||
$osInfoNode.AddToolVersion("Image Version:", $env:IMAGE_VERSION)
|
||||
return $osInfoNode
|
||||
}
|
||||
|
||||
function Get-BashVersion {
|
||||
bash --% -c 'echo ${BASH_VERSION}'
|
||||
}
|
||||
|
||||
function Get-RustVersion {
|
||||
rustc --version | Take-Part -Part 1
|
||||
}
|
||||
|
||||
function Get-RustupVersion {
|
||||
cmd /c "rustup --version 2>NUL" | Take-Part -Part 1
|
||||
}
|
||||
|
||||
function Get-RustCargoVersion {
|
||||
cargo --version | Take-Part -Part 1
|
||||
}
|
||||
|
||||
function Get-RustdocVersion {
|
||||
rustdoc --version | Take-Part -Part 1
|
||||
}
|
||||
|
||||
function Get-RustfmtVersion {
|
||||
rustfmt --version | Take-Part -Part 1 | Take-Part -Part 0 -Delimiter ('-')
|
||||
}
|
||||
|
||||
function Get-RustClippyVersion {
|
||||
cargo clippy --version | Take-Part -Part 1
|
||||
}
|
||||
|
||||
function Get-BindgenVersion {
|
||||
bindgen --version | Take-Part -Part 1
|
||||
}
|
||||
|
||||
function Get-CbindgenVersion {
|
||||
cbindgen --version | Take-Part -Part 1
|
||||
}
|
||||
|
||||
function Get-CargoAuditVersion {
|
||||
cargo-audit --version | Take-Part -Part 1
|
||||
}
|
||||
|
||||
function Get-CargoOutdatedVersion {
|
||||
cargo outdated --version | Take-Part -Part 1
|
||||
}
|
||||
|
||||
function Get-PythonVersion {
|
||||
python --version | Take-Part -Part 1
|
||||
}
|
||||
|
||||
function Get-PowershellCoreVersion {
|
||||
pwsh --version | Take-Part -Part 1
|
||||
}
|
||||
|
||||
function Get-RubyVersion {
|
||||
ruby --version | Take-Part -Part 1
|
||||
}
|
||||
|
||||
function Get-GoVersion {
|
||||
go version | Take-Part -Part 2 | Take-Part -Part 1 -Delimiter ('o')
|
||||
}
|
||||
|
||||
function Get-KotlinVersion {
|
||||
cmd /c "kotlinc -version 2>&1" | Take-Part -Part 2
|
||||
}
|
||||
|
||||
function Get-PHPVersion {
|
||||
php --version | Out-String | Take-Part -Part 1
|
||||
}
|
||||
|
||||
function Get-JuliaVersion {
|
||||
julia --version | Take-Part -Part 2
|
||||
}
|
||||
|
||||
function Get-LLVMVersion {
|
||||
(clang --version) -match "clang" | Take-Part -Part 2
|
||||
}
|
||||
|
||||
function Get-PerlVersion {
|
||||
($(perl --version) | Out-String) -match "\(v(?<version>\d+\.\d+\.\d+)\)" | Out-Null
|
||||
$perlVersion = $Matches.Version
|
||||
return $perlVersion
|
||||
}
|
||||
|
||||
function Get-NodeVersion {
|
||||
node --version | Take-Part -Part 0 -Delimiter ('v')
|
||||
}
|
||||
|
||||
function Get-ChocoVersion {
|
||||
choco --version
|
||||
}
|
||||
|
||||
function Get-VcpkgVersion {
|
||||
$commitId = git -C "C:\vcpkg" rev-parse --short HEAD
|
||||
return "(build from commit $commitId)"
|
||||
}
|
||||
|
||||
function Get-NPMVersion {
|
||||
npm -version
|
||||
}
|
||||
|
||||
function Get-YarnVersion {
|
||||
yarn -version
|
||||
}
|
||||
|
||||
function Get-RubyGemsVersion {
|
||||
gem --version
|
||||
}
|
||||
|
||||
function Get-HelmVersion {
|
||||
($(helm version --short) | Out-String) -match "v(?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
$helmVersion = $Matches.Version
|
||||
return $helmVersion
|
||||
}
|
||||
|
||||
function Get-PipVersion {
|
||||
(pip --version) -match "pip" | Take-Part -Part 1,4,5
|
||||
}
|
||||
|
||||
function Get-CondaVersion {
|
||||
$condaVersion = ((& "$env:CONDA\Scripts\conda.exe" --version) -replace "^conda").Trim()
|
||||
return "$condaVersion (pre-installed on the image but not added to PATH)"
|
||||
}
|
||||
|
||||
function Get-ComposerVersion {
|
||||
composer --version | Take-Part -Part 2
|
||||
}
|
||||
|
||||
function Get-NugetVersion {
|
||||
(nuget help) -match "Nuget Version" | Take-Part -Part 2
|
||||
}
|
||||
|
||||
function Get-AntVersion {
|
||||
ant -version | Take-Part -Part 3
|
||||
}
|
||||
|
||||
function Get-MavenVersion {
|
||||
(mvn -version) -match "Apache Maven" | Take-Part -Part 2
|
||||
}
|
||||
|
||||
function Get-GradleVersion {
|
||||
($(gradle -version) | Out-String) -match "Gradle (?<version>\d+\.\d+)" | Out-Null
|
||||
$gradleVersion = $Matches.Version
|
||||
return $gradleVersion
|
||||
}
|
||||
|
||||
function Get-SbtVersion {
|
||||
(sbt -version) -match "sbt script" | Take-Part -Part 3
|
||||
}
|
||||
|
||||
function Get-DotnetSdks {
|
||||
$sdksRawList = dotnet --list-sdks
|
||||
$sdkVersions = $sdksRawList | Foreach-Object {$_.Split()[0]}
|
||||
$sdkPath = $sdksRawList[0].Split(' ', 2)[1] -replace '\[|]'
|
||||
[PSCustomObject]@{
|
||||
Versions = $sdkVersions
|
||||
Path = $sdkPath
|
||||
}
|
||||
}
|
||||
|
||||
function Get-DotnetTools {
|
||||
$env:Path += ";C:\Users\Default\.dotnet\tools"
|
||||
$dotnetTools = (Get-ToolsetContent).dotnet.tools
|
||||
|
||||
$toolsList = @()
|
||||
|
||||
foreach ($dotnetTool in $dotnetTools) {
|
||||
$version = Invoke-Expression $dotnetTool.getversion
|
||||
$toolsList += [ToolVersionNode]::new($dotnetTool.name, $version)
|
||||
}
|
||||
return $toolsList
|
||||
}
|
||||
|
||||
function Get-DotnetRuntimes {
|
||||
$runtimesRawList = dotnet --list-runtimes
|
||||
$runtimesRawList | Group-Object {$_.Split()[0]} | ForEach-Object {
|
||||
$runtimeName = $_.Name
|
||||
$runtimeVersions = $_.Group | Foreach-Object {$_.split()[1]}
|
||||
$runtimePath = $_.Group[0].Split(' ', 3)[2] -replace '\[|]'
|
||||
[PSCustomObject]@{
|
||||
"Runtime" = $runtimeName
|
||||
"Versions" = $runtimeVersions
|
||||
"Path" = $runtimePath
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Get-DotnetFrameworkVersions {
|
||||
$path = "${env:ProgramFiles(x86)}\Microsoft SDKs\Windows\*\*\NETFX * Tools"
|
||||
return Get-ChildItem -Path $path -Directory | ForEach-Object { $_.Name | Take-Part -Part 1 }
|
||||
}
|
||||
|
||||
function Get-PowerShellAzureModules {
|
||||
[Array] $result = @()
|
||||
$defaultAzureModuleVersion = "2.1.0"
|
||||
|
||||
[Array] $azInstalledModules = Get-ChildItem -Path "C:\Modules\az_*" -Directory | ForEach-Object { $_.Name.Split("_")[1] }
|
||||
if ($azInstalledModules.Count -gt 0) {
|
||||
$result += [ToolVersionsListNode]::new("Az", $($azInstalledModules), '^\d+\.\d+', "Inline")
|
||||
}
|
||||
|
||||
[Array] $azureInstalledModules = Get-ChildItem -Path "C:\Modules\azure_*" -Directory | ForEach-Object { $_.Name.Split("_")[1] } | ForEach-Object { if ($_ -eq $defaultAzureModuleVersion) { "$($_) (Default)" } else { $_ } }
|
||||
if ($azureInstalledModules.Count -gt 0) {
|
||||
$result += [ToolVersionsListNode]::new("Azure", $($azureInstalledModules), '^\d+\.\d+', "Inline")
|
||||
}
|
||||
|
||||
[Array] $azurermInstalledModules = Get-ChildItem -Path "C:\Modules\azurerm_*" -Directory | ForEach-Object { $_.Name.Split("_")[1] } | ForEach-Object { if ($_ -eq $defaultAzureModuleVersion) { "$($_) (Default)" } else { $_ } }
|
||||
if ($azurermInstalledModules.Count -gt 0) {
|
||||
$result += [ToolVersionsListNode]::new("AzureRM", $($azurermInstalledModules), '^\d+\.\d+', "Inline")
|
||||
}
|
||||
|
||||
[Array] $azCachedModules = Get-ChildItem -Path "C:\Modules\az_*.zip" -File | ForEach-Object { $_.Name.Split("_")[1] }
|
||||
if ($azCachedModules.Count -gt 0) {
|
||||
$result += [ToolVersionsListNode]::new("Az (Cached)", $($azCachedModules), '^\d+\.\d+', "Inline")
|
||||
}
|
||||
|
||||
[Array] $azureCachedModules = Get-ChildItem -Path "C:\Modules\azure_*.zip" -File | ForEach-Object { $_.Name.Split("_")[1] }
|
||||
if ($azureCachedModules.Count -gt 0) {
|
||||
$result += [ToolVersionsListNode]::new("Azure (Cached)", $($azureCachedModules), '^\d+\.\d+', "Inline")
|
||||
}
|
||||
|
||||
[Array] $azurermCachedModules = Get-ChildItem -Path "C:\Modules\azurerm_*.zip" -File | ForEach-Object { $_.Name.Split("_")[1] }
|
||||
if ($azurermCachedModules.Count -gt 0) {
|
||||
$result += [ToolVersionsListNode]::new("AzureRM (Cached)", $($azurermCachedModules), '^\d+\.\d+', "Inline")
|
||||
}
|
||||
|
||||
return $result
|
||||
}
|
||||
|
||||
function Get-PowerShellModules {
|
||||
[Array] $result = @()
|
||||
|
||||
$result += Get-PowerShellAzureModules
|
||||
|
||||
$result += (Get-ToolsetContent).powershellModules.name | Sort-Object | ForEach-Object {
|
||||
$moduleName = $_
|
||||
$moduleVersions = Get-Module -Name $moduleName -ListAvailable | Select-Object -ExpandProperty Version | Sort-Object -Unique
|
||||
return [ToolVersionsListNode]::new($moduleName, $moduleVersions, '^\d+', "Inline")
|
||||
}
|
||||
|
||||
return $result
|
||||
}
|
||||
|
||||
function Get-CachedDockerImages {
|
||||
return (docker images --digests --format "* {{.Repository}}:{{.Tag}}").Split("*") | Where-Object { $_ }
|
||||
}
|
||||
|
||||
function Get-CachedDockerImagesTableData {
|
||||
$allImages = docker images --digests --format "*{{.Repository}}:{{.Tag}}|{{.Digest}} |{{.CreatedAt}}"
|
||||
if (-not $allImages) {
|
||||
return $null
|
||||
}
|
||||
|
||||
$allImages.Split("*") | Where-Object { $_ } | ForEach-Object {
|
||||
$parts = $_.Split("|")
|
||||
[PSCustomObject] @{
|
||||
"Repository:Tag" = $parts[0]
|
||||
"Digest" = $parts[1]
|
||||
"Created" = $parts[2].split(' ')[0]
|
||||
}
|
||||
} | Sort-Object -Property "Repository:Tag"
|
||||
}
|
||||
|
||||
function Get-ShellTarget {
|
||||
return Get-ChildItem C:\shells -File | Select-Object Name, @{n="Target";e={
|
||||
if ($_.Name -eq "msys2bash.cmd") {
|
||||
"C:\msys64\usr\bin\bash.exe"
|
||||
} else {
|
||||
@($_.Target)[0]
|
||||
}
|
||||
}} | Sort-Object Name
|
||||
}
|
||||
|
||||
function Get-PacmanVersion {
|
||||
$msys2BinDir = "C:\msys64\usr\bin"
|
||||
$pacmanPath = Join-Path $msys2BinDir "pacman.exe"
|
||||
$rawVersion = & $pacmanPath --version
|
||||
$rawVersion.Split([System.Environment]::NewLine)[1] -match "\d+\.\d+(\.\d+)?" | Out-Null
|
||||
$pacmanVersion = $matches[0]
|
||||
return $pacmanVersion
|
||||
}
|
||||
|
||||
function Get-YAMLLintVersion {
|
||||
yamllint --version | Take-Part -Part 1
|
||||
}
|
||||
|
||||
function Get-BizTalkVersion {
|
||||
$bizTalkReg = Get-ItemProperty "HKLM:\SOFTWARE\WOW6432Node\Microsoft\BizTalk Server\3.0"
|
||||
return [ToolVersionNode]::new($bizTalkReg.ProductName, $bizTalkReg.ProductVersion)
|
||||
}
|
||||
|
||||
function Get-PipxVersion {
|
||||
pipx --version
|
||||
}
|
||||
|
||||
function Build-PackageManagementEnvironmentTable {
|
||||
return @(
|
||||
[PSCustomObject] @{
|
||||
"Name" = "VCPKG_INSTALLATION_ROOT"
|
||||
"Value" = $env:VCPKG_INSTALLATION_ROOT
|
||||
},
|
||||
[PSCustomObject] @{
|
||||
"Name" = "CONDA"
|
||||
"Value" = $env:CONDA
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
function Get-PostgreSQLTable
|
||||
{
|
||||
$pgService = Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'"
|
||||
$pgPath = $pgService.PathName
|
||||
$pgRoot = $pgPath.split('"')[1].replace("\bin\pg_ctl.exe", "")
|
||||
$env:Path += ";${env:PGBIN}"
|
||||
$pgVersion = (postgres --version).split()[2].Trim()
|
||||
|
||||
return @(
|
||||
[PSCustomObject]@{ Property = "ServiceName"; Value = $pgService.Name },
|
||||
[PSCustomObject]@{ Property = "Version"; Value = $pgVersion },
|
||||
[PSCustomObject]@{ Property = "ServiceStatus"; Value = $pgService.State },
|
||||
[PSCustomObject]@{ Property = "ServiceStartType"; Value = $pgService.StartMode },
|
||||
[PSCustomObject]@{ Property = "EnvironmentVariables"; Value = "`PGBIN=$env:PGBIN` <br> `PGDATA=$env:PGDATA` <br> `PGROOT=$env:PGROOT` " },
|
||||
[PSCustomObject]@{ Property = "Path"; Value = $pgRoot },
|
||||
[PSCustomObject]@{ Property = "UserName"; Value = $env:PGUSER },
|
||||
[PSCustomObject]@{ Property = "Password"; Value = $env:PGPASSWORD }
|
||||
)
|
||||
}
|
||||
|
||||
function Get-MongoDBTable
|
||||
{
|
||||
$name = "MongoDB"
|
||||
$mongoService = Get-Service -Name $name
|
||||
$mongoVersion = (Get-Command -Name 'mongo').Version.ToString()
|
||||
return [PSCustomObject]@{
|
||||
Version = $mongoVersion
|
||||
ServiceName = $name
|
||||
ServiceStatus = $mongoService.Status
|
||||
ServiceStartType = $mongoService.StartType
|
||||
}
|
||||
}
|
||||
239
images/windows/scripts/docs-gen/SoftwareReport.Generator.ps1
Normal file
239
images/windows/scripts/docs-gen/SoftwareReport.Generator.ps1
Normal file
@@ -0,0 +1,239 @@
|
||||
using module ./software-report-base/SoftwareReport.psm1
|
||||
using module ./software-report-base/SoftwareReport.Nodes.psm1
|
||||
|
||||
$global:ErrorActionPreference = "Stop"
|
||||
$global:ProgressPreference = "SilentlyContinue"
|
||||
$ErrorView = "NormalView"
|
||||
Set-StrictMode -Version Latest
|
||||
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Android.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Browsers.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.CachedTools.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Common.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Databases.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Helpers.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Tools.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Java.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.WebServers.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.VisualStudio.psm1") -DisableNameChecking
|
||||
|
||||
# Software report
|
||||
$softwareReport = [SoftwareReport]::new($(Build-OSInfoSection))
|
||||
$optionalFeatures = $softwareReport.Root.AddHeader("Windows features")
|
||||
$optionalFeatures.AddToolVersion("Windows Subsystem for Linux (WSLv1):", "Enabled")
|
||||
$installedSoftware = $softwareReport.Root.AddHeader("Installed Software")
|
||||
|
||||
# Language and Runtime
|
||||
$languageAndRuntime = $installedSoftware.AddHeader("Language and Runtime")
|
||||
$languageAndRuntime.AddToolVersion("Bash", $(Get-BashVersion))
|
||||
$languageAndRuntime.AddToolVersion("Go", $(Get-GoVersion))
|
||||
$languageAndRuntime.AddToolVersion("Julia", $(Get-JuliaVersion))
|
||||
$languageAndRuntime.AddToolVersion("Kotlin", $(Get-KotlinVersion))
|
||||
$languageAndRuntime.AddToolVersion("LLVM", $(Get-LLVMVersion))
|
||||
$languageAndRuntime.AddToolVersion("Node", $(Get-NodeVersion))
|
||||
$languageAndRuntime.AddToolVersion("Perl", $(Get-PerlVersion))
|
||||
$languageAndRuntime.AddToolVersion("PHP", $(Get-PHPVersion))
|
||||
$languageAndRuntime.AddToolVersion("Python", $(Get-PythonVersion))
|
||||
$languageAndRuntime.AddToolVersion("Ruby", $(Get-RubyVersion))
|
||||
|
||||
# Package Management
|
||||
$packageManagement = $installedSoftware.AddHeader("Package Management")
|
||||
$packageManagement.AddToolVersion("Chocolatey", $(Get-ChocoVersion))
|
||||
$packageManagement.AddToolVersion("Composer", $(Get-ComposerVersion))
|
||||
$packageManagement.AddToolVersion("Helm", $(Get-HelmVersion))
|
||||
$packageManagement.AddToolVersion("Miniconda", $(Get-CondaVersion))
|
||||
$packageManagement.AddToolVersion("NPM", $(Get-NPMVersion))
|
||||
$packageManagement.AddToolVersion("NuGet", $(Get-NugetVersion))
|
||||
$packageManagement.AddToolVersion("pip", $(Get-PipVersion))
|
||||
$packageManagement.AddToolVersion("Pipx", $(Get-PipxVersion))
|
||||
$packageManagement.AddToolVersion("RubyGems", $(Get-RubyGemsVersion))
|
||||
$packageManagement.AddToolVersion("Vcpkg", $(Get-VcpkgVersion))
|
||||
$packageManagement.AddToolVersion("Yarn", $(Get-YarnVersion))
|
||||
|
||||
$packageManagement.AddHeader("Environment variables").AddTable($(Build-PackageManagementEnvironmentTable))
|
||||
|
||||
# Project Management
|
||||
$projectManagement = $installedSoftware.AddHeader("Project Management")
|
||||
$projectManagement.AddToolVersion("Ant", $(Get-AntVersion))
|
||||
$projectManagement.AddToolVersion("Gradle", $(Get-GradleVersion))
|
||||
$projectManagement.AddToolVersion("Maven", $(Get-MavenVersion))
|
||||
$projectManagement.AddToolVersion("sbt", $(Get-SbtVersion))
|
||||
|
||||
# Tools
|
||||
$tools = $installedSoftware.AddHeader("Tools")
|
||||
$tools.AddToolVersion("7zip", $(Get-7zipVersion))
|
||||
$tools.AddToolVersion("aria2", $(Get-Aria2Version))
|
||||
$tools.AddToolVersion("azcopy", $(Get-AzCopyVersion))
|
||||
$tools.AddToolVersion("Bazel", $(Get-BazelVersion))
|
||||
$tools.AddToolVersion("Bazelisk", $(Get-BazeliskVersion))
|
||||
$tools.AddToolVersion("Bicep", $(Get-BicepVersion))
|
||||
$tools.AddToolVersion("Cabal", $(Get-CabalVersion))
|
||||
$tools.AddToolVersion("CMake", $(Get-CMakeVersion))
|
||||
$tools.AddToolVersion("CodeQL Action Bundle", $(Get-CodeQLBundleVersion))
|
||||
$tools.AddToolVersion("Docker", $(Get-DockerVersion))
|
||||
$tools.AddToolVersion("Docker Compose v1", $(Get-DockerComposeVersion))
|
||||
$tools.AddToolVersion("Docker Compose v2", $(Get-DockerComposeVersionV2))
|
||||
$tools.AddToolVersion("Docker-wincred", $(Get-DockerWincredVersion))
|
||||
$tools.AddToolVersion("ghc", $(Get-GHCVersion))
|
||||
$tools.AddToolVersion("Git", $(Get-GitVersion))
|
||||
$tools.AddToolVersion("Git LFS", $(Get-GitLFSVersion))
|
||||
if (Test-IsWin19) {
|
||||
$tools.AddToolVersion("Google Cloud CLI", $(Get-GoogleCloudCLIVersion))
|
||||
}
|
||||
$tools.AddToolVersion("ImageMagick", $(Get-ImageMagickVersion))
|
||||
$tools.AddToolVersion("InnoSetup", $(Get-InnoSetupVersion))
|
||||
$tools.AddToolVersion("jq", $(Get-JQVersion))
|
||||
$tools.AddToolVersion("Kind", $(Get-KindVersion))
|
||||
$tools.AddToolVersion("Kubectl", $(Get-KubectlVersion))
|
||||
$tools.AddToolVersion("Mercurial", $(Get-MercurialVersion))
|
||||
$tools.AddToolVersion("gcc", $(Get-GCCVersion))
|
||||
$tools.AddToolVersion("gdb", $(Get-GDBVersion))
|
||||
$tools.AddToolVersion("GNU Binutils", $(Get-GNUBinutilsVersion))
|
||||
$tools.AddToolVersion("Newman", $(Get-NewmanVersion))
|
||||
$tools.AddToolVersion("NSIS", $(Get-NSISVersion))
|
||||
$tools.AddToolVersion("OpenSSL", $(Get-OpenSSLVersion))
|
||||
$tools.AddToolVersion("Packer", $(Get-PackerVersion))
|
||||
if (Test-IsWin19) {
|
||||
$tools.AddToolVersion("Parcel", $(Get-ParcelVersion))
|
||||
}
|
||||
$tools.AddToolVersion("Pulumi", $(Get-PulumiVersion))
|
||||
$tools.AddToolVersion("R", $(Get-RVersion))
|
||||
$tools.AddToolVersion("Service Fabric SDK", $(Get-ServiceFabricSDKVersion))
|
||||
$tools.AddToolVersion("Stack", $(Get-StackVersion))
|
||||
$tools.AddToolVersion("Subversion (SVN)", $(Get-SVNVersion))
|
||||
$tools.AddToolVersion("Swig", $(Get-SwigVersion))
|
||||
$tools.AddToolVersion("VSWhere", $(Get-VSWhereVersion))
|
||||
$tools.AddToolVersion("WinAppDriver", $(Get-WinAppDriver))
|
||||
$tools.AddToolVersion("WiX Toolset", $(Get-WixVersion))
|
||||
$tools.AddToolVersion("yamllint", $(Get-YAMLLintVersion))
|
||||
$tools.AddToolVersion("zstd", $(Get-ZstdVersion))
|
||||
|
||||
# CLI Tools
|
||||
$cliTools = $installedSoftware.AddHeader("CLI Tools")
|
||||
$cliTools.AddToolVersion("Alibaba Cloud CLI", $(Get-AlibabaCLIVersion))
|
||||
$cliTools.AddToolVersion("AWS CLI", $(Get-AWSCLIVersion))
|
||||
$cliTools.AddToolVersion("AWS SAM CLI", $(Get-AWSSAMVersion))
|
||||
$cliTools.AddToolVersion("AWS Session Manager CLI", $(Get-AWSSessionManagerVersion))
|
||||
$cliTools.AddToolVersion("Azure CLI", $(Get-AzureCLIVersion))
|
||||
$cliTools.AddToolVersion("Azure DevOps CLI extension", $(Get-AzureDevopsExtVersion))
|
||||
if (Test-IsWin19) {
|
||||
$cliTools.AddToolVersion("Cloud Foundry CLI", $(Get-CloudFoundryVersion))
|
||||
}
|
||||
$cliTools.AddToolVersion("GitHub CLI", $(Get-GHVersion))
|
||||
|
||||
# Rust Tools
|
||||
Initialize-RustEnvironment
|
||||
$rustTools = $installedSoftware.AddHeader("Rust Tools")
|
||||
$rustTools.AddToolVersion("Cargo", $(Get-RustCargoVersion))
|
||||
$rustTools.AddToolVersion("Rust", $(Get-RustVersion))
|
||||
$rustTools.AddToolVersion("Rustdoc", $(Get-RustdocVersion))
|
||||
$rustTools.AddToolVersion("Rustup", $(Get-RustupVersion))
|
||||
|
||||
$rustToolsPackages = $rustTools.AddHeader("Packages")
|
||||
$rustToolsPackages.AddToolVersion("bindgen", $(Get-BindgenVersion))
|
||||
$rustToolsPackages.AddToolVersion("cargo-audit", $(Get-CargoAuditVersion))
|
||||
$rustToolsPackages.AddToolVersion("cargo-outdated", $(Get-CargoOutdatedVersion))
|
||||
$rustToolsPackages.AddToolVersion("cbindgen", $(Get-CbindgenVersion))
|
||||
$rustToolsPackages.AddToolVersion("Clippy", $(Get-RustClippyVersion))
|
||||
$rustToolsPackages.AddToolVersion("Rustfmt", $(Get-RustfmtVersion))
|
||||
|
||||
# Browsers and Drivers
|
||||
$browsersAndWebdrivers = $installedSoftware.AddHeader("Browsers and Drivers")
|
||||
$browsersAndWebdrivers.AddNodes($(Build-BrowserSection))
|
||||
$browsersAndWebdrivers.AddHeader("Environment variables").AddTable($(Build-BrowserWebdriversEnvironmentTable))
|
||||
|
||||
# Java
|
||||
$installedSoftware.AddHeader("Java").AddTable($(Get-JavaVersions))
|
||||
|
||||
# Shells
|
||||
$installedSoftware.AddHeader("Shells").AddTable($(Get-ShellTarget))
|
||||
|
||||
# MSYS2
|
||||
$msys2 = $installedSoftware.AddHeader("MSYS2")
|
||||
$msys2.AddToolVersion("Pacman", $(Get-PacmanVersion))
|
||||
|
||||
$notes = @'
|
||||
Location: C:\msys64
|
||||
|
||||
Note: MSYS2 is pre-installed on image but not added to PATH.
|
||||
'@
|
||||
$msys2.AddHeader("Notes").AddNote($notes)
|
||||
|
||||
# BizTalk Server
|
||||
if (Test-IsWin19)
|
||||
{
|
||||
$installedSoftware.AddHeader("BizTalk Server").AddNode($(Get-BizTalkVersion))
|
||||
}
|
||||
|
||||
# Cached Tools
|
||||
$installedSoftware.AddHeader("Cached Tools").AddNodes($(Build-CachedToolsSection))
|
||||
|
||||
# Databases
|
||||
$databases = $installedSoftware.AddHeader("Databases")
|
||||
$databases.AddHeader("PostgreSQL").AddTable($(Get-PostgreSQLTable))
|
||||
$databases.AddHeader("MongoDB").AddTable($(Get-MongoDBTable))
|
||||
|
||||
# Database tools
|
||||
$databaseTools = $installedSoftware.AddHeader("Database tools")
|
||||
$databaseTools.AddToolVersion("Azure CosmosDb Emulator", $(Get-AzCosmosDBEmulatorVersion))
|
||||
$databaseTools.AddToolVersion("DacFx", $(Get-DacFxVersion))
|
||||
$databaseTools.AddToolVersion("MySQL", $(Get-MySQLVersion))
|
||||
$databaseTools.AddToolVersion("SQL OLEDB Driver", $(Get-SQLOLEDBDriverVersion))
|
||||
$databaseTools.AddToolVersion("SQLPS", $(Get-SQLPSVersion))
|
||||
|
||||
# Web Servers
|
||||
$installedSoftware.AddHeader("Web Servers").AddTable($(Build-WebServersSection))
|
||||
|
||||
# Visual Studio
|
||||
$vsTable = Get-VisualStudioVersion
|
||||
$visualStudio = $installedSoftware.AddHeader($vsTable.Name)
|
||||
$visualStudio.AddTable($vsTable)
|
||||
|
||||
$workloads = $visualStudio.AddHeader("Workloads, components and extensions")
|
||||
$workloads.AddTable((Get-VisualStudioComponents) + (Get-VisualStudioExtensions))
|
||||
|
||||
$msVisualCpp = $visualStudio.AddHeader("Microsoft Visual C++")
|
||||
$msVisualCpp.AddTable($(Get-VisualCPPComponents))
|
||||
|
||||
$visualStudio.AddToolVersionsList("Installed Windows SDKs", $(Get-WindowsSDKs).Versions, '^.+')
|
||||
|
||||
# .NET Core Tools
|
||||
$netCoreTools = $installedSoftware.AddHeader(".NET Core Tools")
|
||||
if (Test-IsWin19) {
|
||||
# Visual Studio 2019 brings own version of .NET Core which is different from latest official version
|
||||
$netCoreTools.AddToolVersionsListInline(".NET Core SDK", $(Get-DotnetSdks).Versions, '^\d+\.\d+\.\d{2}')
|
||||
} else {
|
||||
$netCoreTools.AddToolVersionsListInline(".NET Core SDK", $(Get-DotnetSdks).Versions, '^\d+\.\d+\.\d')
|
||||
}
|
||||
$netCoreTools.AddToolVersionsListInline(".NET Framework", $(Get-DotnetFrameworkVersions), '^.+')
|
||||
Get-DotnetRuntimes | ForEach-Object {
|
||||
$netCoreTools.AddToolVersionsListInline($_.Runtime, $_.Versions, '^.+')
|
||||
}
|
||||
$netCoreTools.AddNodes($(Get-DotnetTools))
|
||||
|
||||
# PowerShell Tools
|
||||
$psTools = $installedSoftware.AddHeader("PowerShell Tools")
|
||||
$psTools.AddToolVersion("PowerShell", $(Get-PowershellCoreVersion))
|
||||
|
||||
$psModules = $psTools.AddHeader("Powershell Modules")
|
||||
$psModules.AddNodes($(Get-PowerShellModules))
|
||||
|
||||
$azPsNotes = @'
|
||||
Azure PowerShell module 2.1.0 and AzureRM PowerShell module 2.1.0 are installed
|
||||
and are available via 'Get-Module -ListAvailable'.
|
||||
All other versions are saved but not installed.
|
||||
'@
|
||||
$psModules.AddNote($azPsNotes)
|
||||
|
||||
# Android
|
||||
$android = $installedSoftware.AddHeader("Android")
|
||||
$android.AddTable($(Build-AndroidTable))
|
||||
|
||||
$android.AddHeader("Environment variables").AddTable($(Build-AndroidEnvironmentTable))
|
||||
|
||||
# Cached Docker images
|
||||
$installedSoftware.AddHeader("Cached Docker images").AddTable($(Get-CachedDockerImagesTableData))
|
||||
|
||||
# Generate reports
|
||||
$softwareReport.ToJson() | Out-File -FilePath "C:\software-report.json" -Encoding UTF8NoBOM
|
||||
$softwareReport.ToMarkdown() | Out-File -FilePath "C:\software-report.md" -Encoding UTF8NoBOM
|
||||
30
images/windows/scripts/docs-gen/SoftwareReport.Helpers.psm1
Normal file
30
images/windows/scripts/docs-gen/SoftwareReport.Helpers.psm1
Normal file
@@ -0,0 +1,30 @@
|
||||
function Get-LinkTarget {
|
||||
param (
|
||||
[string] $inputPath
|
||||
)
|
||||
$link = Get-Item $inputPath | Select-Object -ExpandProperty Target
|
||||
if ($link) {
|
||||
return " -> $link"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
function Get-PathWithLink {
|
||||
param (
|
||||
[string] $inputPath
|
||||
)
|
||||
$link = Get-LinkTarget($inputPath)
|
||||
return "${inputPath}${link}"
|
||||
}
|
||||
|
||||
function Take-Part {
|
||||
param (
|
||||
[Parameter(ValueFromPipeline)]
|
||||
[string] $toolOutput,
|
||||
[string] $Delimiter = " ",
|
||||
[int[]] $Part
|
||||
)
|
||||
$parts = $toolOutput.Split($Delimiter, [System.StringSplitOptions]::RemoveEmptyEntries)
|
||||
$selectedParts = $parts[$Part]
|
||||
return [string]::Join($Delimiter, $selectedParts)
|
||||
}
|
||||
22
images/windows/scripts/docs-gen/SoftwareReport.Java.psm1
Normal file
22
images/windows/scripts/docs-gen/SoftwareReport.Java.psm1
Normal file
@@ -0,0 +1,22 @@
|
||||
function Get-JavaVersions {
|
||||
$defaultJavaPath = $env:JAVA_HOME
|
||||
$javaVersions = Get-Item env:JAVA_HOME_*_X64
|
||||
$sortRules = @{
|
||||
Expression = { [Int32]$_.Name.Split("_")[2] }
|
||||
Descending = $false
|
||||
}
|
||||
|
||||
return $javaVersions | Sort-Object $sortRules | ForEach-Object {
|
||||
$javaPath = $_.Value
|
||||
# Take semver from the java path
|
||||
# The path contains '-' sign in the version number instead of '+' due to the following issue, need to substitute it back https://github.com/actions/runner-images/issues/3014
|
||||
$versionInPath = (Split-Path $javaPath) -replace "\w:\\.*\\"
|
||||
$version = $versionInPath -replace '-', '+'
|
||||
$defaultPostfix = ($javaPath -eq $defaultJavaPath) ? " (default)" : ""
|
||||
|
||||
[PSCustomObject] @{
|
||||
"Version" = $version + $defaultPostfix
|
||||
"Environment Variable" = $_.Name
|
||||
}
|
||||
}
|
||||
}
|
||||
321
images/windows/scripts/docs-gen/SoftwareReport.Tools.psm1
Normal file
321
images/windows/scripts/docs-gen/SoftwareReport.Tools.psm1
Normal file
@@ -0,0 +1,321 @@
|
||||
function Get-Aria2Version {
|
||||
(aria2c -v | Out-String) -match "(?<version>(\d+\.){1,}\d+)" | Out-Null
|
||||
$aria2Version = $Matches.Version
|
||||
return $aria2Version
|
||||
}
|
||||
|
||||
function Get-AzCosmosDBEmulatorVersion {
|
||||
$regKey = gci HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | gp | ? { $_.DisplayName -eq 'Azure Cosmos DB Emulator' }
|
||||
$installDir = $regKey.InstallLocation
|
||||
$exeFilePath = Join-Path $installDir 'CosmosDB.Emulator.exe'
|
||||
$version = (Get-Item $exeFilePath).VersionInfo.FileVersion
|
||||
return $version
|
||||
}
|
||||
|
||||
function Get-BazelVersion {
|
||||
((cmd /c "bazel --version 2>&1") | Out-String) -match "bazel (?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
$bazelVersion = $Matches.Version
|
||||
return $bazelVersion
|
||||
}
|
||||
|
||||
function Get-BazeliskVersion {
|
||||
((cmd /c "bazelisk version 2>&1") | Out-String) -match "Bazelisk version: v(?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
$bazeliskVersion = $Matches.Version
|
||||
return $bazeliskVersion
|
||||
}
|
||||
|
||||
function Get-BicepVersion {
|
||||
(bicep --version | Out-String) -match "bicep cli version (?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
$bicepVersion = $Matches.Version
|
||||
return $bicepVersion
|
||||
}
|
||||
|
||||
function Get-RVersion {
|
||||
($(cmd /c "Rscript --version 2>&1") | Out-String) -match "Rscript .* version (?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
$rVersion = $Matches.Version
|
||||
return $rVersion
|
||||
}
|
||||
|
||||
function Get-CMakeVersion {
|
||||
($(cmake -version) | Out-String) -match "cmake version (?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
$cmakeVersion = $Matches.Version
|
||||
return $cmakeVersion
|
||||
}
|
||||
|
||||
function Get-CodeQLBundleVersion {
|
||||
$CodeQLVersionsWildcard = Join-Path $Env:AGENT_TOOLSDIRECTORY -ChildPath "CodeQL" | Join-Path -ChildPath "*"
|
||||
$CodeQLVersionPath = Get-ChildItem $CodeQLVersionsWildcard | Select-Object -First 1 -Expand FullName
|
||||
$CodeQLPath = Join-Path $CodeQLVersionPath -ChildPath "x64" | Join-Path -ChildPath "codeql" | Join-Path -ChildPath "codeql.exe"
|
||||
$CodeQLVersion = & $CodeQLPath version --quiet
|
||||
return $CodeQLVersion
|
||||
}
|
||||
|
||||
function Get-DockerVersion {
|
||||
$dockerVersion = $(docker version --format "{{.Server.Version}}")
|
||||
return $dockerVersion
|
||||
}
|
||||
|
||||
function Get-DockerComposeVersion {
|
||||
$dockerComposeVersion = docker-compose version --short
|
||||
return $dockerComposeVersion
|
||||
}
|
||||
|
||||
function Get-DockerComposeVersionV2 {
|
||||
$dockerComposeVersion = docker compose version --short
|
||||
return $dockerComposeVersion
|
||||
}
|
||||
|
||||
function Get-DockerWincredVersion {
|
||||
$dockerCredVersion = docker-credential-wincred version | Take-Part -Part 2 | Take-Part -Part 0 -Delimiter "v"
|
||||
return $dockerCredVersion
|
||||
}
|
||||
|
||||
function Get-GitVersion {
|
||||
$gitVersion = git --version | Take-Part -Part -1
|
||||
return $gitVersion
|
||||
}
|
||||
|
||||
function Get-GitLFSVersion {
|
||||
$(git-lfs version) -match "git-lfs\/(?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
$gitLfsVersion = $Matches.Version
|
||||
return $gitLfsVersion
|
||||
}
|
||||
|
||||
function Get-InnoSetupVersion {
|
||||
$innoSetupVersion = $(choco list innosetup) | Select-String -Pattern "InnoSetup"
|
||||
return ($innoSetupVersion -replace "^InnoSetup").Trim()
|
||||
}
|
||||
|
||||
function Get-JQVersion {
|
||||
$jqVersion = ($(jq --version) -Split "jq-")[1]
|
||||
return $jqVersion
|
||||
}
|
||||
|
||||
function Get-KubectlVersion {
|
||||
$kubectlVersion = (kubectl version --client --output=json | ConvertFrom-Json).clientVersion.gitVersion.Replace('v','')
|
||||
return $kubectlVersion
|
||||
}
|
||||
|
||||
function Get-KindVersion {
|
||||
$(kind version) -match "kind v(?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
$kindVersion = $Matches.Version
|
||||
return $kindVersion
|
||||
}
|
||||
|
||||
function Get-GCCVersion {
|
||||
(gcc --version | Select-String -Pattern "gcc.exe") -match "(?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
$mingwVersion = $Matches.Version
|
||||
return $mingwVersion
|
||||
}
|
||||
|
||||
function Get-GDBVersion {
|
||||
(gdb --version | Select-String -Pattern "GNU gdb") -match "(?<version>\d+\.\d+)" | Out-Null
|
||||
$mingwVersion = $Matches.Version
|
||||
return $mingwVersion
|
||||
}
|
||||
|
||||
function Get-GNUBinutilsVersion {
|
||||
(ld --version | Select-String -Pattern "GNU Binutils") -match "(?<version>\d+\.\d+)" | Out-Null
|
||||
$mingwVersion = $Matches.Version
|
||||
return $mingwVersion
|
||||
}
|
||||
|
||||
function Get-MySQLVersion {
|
||||
$mysqlCommand = Get-Command -Name "mysql"
|
||||
$mysqlVersion = $mysqlCommand.Version.ToString()
|
||||
return $mysqlVersion
|
||||
}
|
||||
|
||||
function Get-SQLOLEDBDriverVersion {
|
||||
$SQLOLEDBDriverVersion = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSOLEDBSQL' InstalledVersion).InstalledVersion
|
||||
return $SQLOLEDBDriverVersion
|
||||
}
|
||||
|
||||
function Get-MercurialVersion {
|
||||
($(hg --version) | Out-String) -match "version (?<version>\d+\.\d+\.?\d*)" | Out-Null
|
||||
$mercurialVersion = $Matches.Version
|
||||
return $mercurialVersion
|
||||
}
|
||||
|
||||
function Get-NSISVersion {
|
||||
$nsisVersion = &"c:\Program Files (x86)\NSIS\makensis.exe" "/Version"
|
||||
return $nsisVersion.TrimStart("v")
|
||||
}
|
||||
|
||||
function Get-OpenSSLVersion {
|
||||
$(openssl version) -match "OpenSSL (?<version>\d+\.\d+\.\d+\w?) " | Out-Null
|
||||
$opensslVersion = $Matches.Version
|
||||
return $opensslVersion
|
||||
}
|
||||
|
||||
function Get-PackerVersion {
|
||||
$packerVersion = packer --version
|
||||
return $packerVersion
|
||||
}
|
||||
|
||||
function Get-ParcelVersion {
|
||||
$parcelVersion = parcel --version
|
||||
return "$parcelVersion"
|
||||
}
|
||||
|
||||
function Get-PulumiVersion {
|
||||
return (pulumi version).TrimStart("v")
|
||||
}
|
||||
|
||||
function Get-SQLPSVersion {
|
||||
$module = Get-Module -Name SQLPS -ListAvailable
|
||||
$version = $module.Version
|
||||
return $version
|
||||
}
|
||||
|
||||
function Get-SVNVersion {
|
||||
$svnVersion = $(svn --version --quiet)
|
||||
return $svnVersion
|
||||
}
|
||||
|
||||
function Get-VSWhereVersion {
|
||||
($(Get-Command -Name vswhere).FileVersionInfo.ProductVersion) -match "(?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
$vswhereVersion = $Matches.Version
|
||||
return $vswhereVersion
|
||||
}
|
||||
|
||||
function Get-WinAppDriver {
|
||||
$winAppDriverVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe").FileVersion
|
||||
return $winAppDriverVersion
|
||||
}
|
||||
|
||||
function Get-WixVersion {
|
||||
$regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
|
||||
$installedApplications = Get-ItemProperty -Path $regKey
|
||||
$wixToolsetVersion = ($installedApplications | Where-Object { $_.BundleCachePath -imatch ".*\\WiX\d*\.exe$" } | Select-Object -First 1).DisplayName
|
||||
return ($wixToolsetVersion -replace "^WiX Toolset v").Trim()
|
||||
}
|
||||
|
||||
function Get-ZstdVersion {
|
||||
$(zstd --version) -match "v(?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
$zstdVersion = $Matches.Version
|
||||
return $zstdVersion
|
||||
}
|
||||
|
||||
function Get-AzureCLIVersion {
|
||||
$azureCLIVersion = $(az version) | ConvertFrom-Json | Foreach{ $_."azure-cli" }
|
||||
return $azureCLIVersion
|
||||
}
|
||||
|
||||
function Get-AzCopyVersion {
|
||||
return ($(azcopy --version) -replace "^azcopy version").Trim()
|
||||
}
|
||||
|
||||
function Get-AzureDevopsExtVersion {
|
||||
$azureDevExtVersion = (az version | ConvertFrom-Json | ForEach-Object { $_."extensions" })."azure-devops"
|
||||
return $azureDevExtVersion
|
||||
}
|
||||
|
||||
function Get-AWSCLIVersion {
|
||||
$(aws --version) -match "aws-cli\/(?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
$awscliVersion = $Matches.Version
|
||||
return $awscliVersion
|
||||
}
|
||||
|
||||
function Get-AWSSAMVersion {
|
||||
$(sam --version) -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
$awssamVersion = $Matches.Version
|
||||
return $awssamVersion
|
||||
}
|
||||
|
||||
function Get-AWSSessionManagerVersion {
|
||||
$awsSessionManagerVersion = $(session-manager-plugin --version)
|
||||
return $awsSessionManagerVersion
|
||||
}
|
||||
|
||||
function Get-AlibabaCLIVersion {
|
||||
$alicliVersion = $(aliyun version)
|
||||
return $alicliVersion
|
||||
}
|
||||
|
||||
function Get-CloudFoundryVersion {
|
||||
$(cf version) -match "(?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
$cfVersion = $Matches.Version
|
||||
return $cfVersion
|
||||
}
|
||||
|
||||
function Get-7zipVersion {
|
||||
(7z | Out-String) -match "7-Zip (?<version>\d+\.\d+\.?\d*)" | Out-Null
|
||||
$version = $Matches.Version
|
||||
return $version
|
||||
}
|
||||
|
||||
function Get-GHCVersion {
|
||||
((ghc --version) | Out-String) -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
$ghcVersion = $Matches.Version
|
||||
return $ghcVersion
|
||||
}
|
||||
|
||||
function Get-CabalVersion {
|
||||
((cabal --version) | Out-String) -match "version (?<version>\d+\.\d+\.\d+\.\d+)" | Out-Null
|
||||
$cabalVersion = $Matches.Version
|
||||
return $cabalVersion
|
||||
}
|
||||
|
||||
function Get-StackVersion {
|
||||
((stack --version --quiet) | Out-String) -match "Version (?<version>\d+\.\d+\.\d+)," | Out-Null
|
||||
$stackVersion = $Matches.Version
|
||||
return $stackVersion
|
||||
}
|
||||
|
||||
function Get-GoogleCloudCLIVersion {
|
||||
return (((cmd /c "gcloud --version") -match "Google Cloud SDK") -replace "Google Cloud SDK").Trim()
|
||||
}
|
||||
|
||||
function Get-ServiceFabricSDKVersion {
|
||||
$serviceFabricSDKVersion = Get-ItemPropertyValue 'HKLM:\SOFTWARE\Microsoft\Service Fabric\' -Name FabricVersion
|
||||
return $serviceFabricSDKVersion
|
||||
}
|
||||
|
||||
function Get-NewmanVersion {
|
||||
return $(newman --version)
|
||||
}
|
||||
|
||||
function Get-GHVersion {
|
||||
($(gh --version) | Select-String -Pattern "gh version") -match "gh version (?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
$ghVersion = $Matches.Version
|
||||
return $ghVersion
|
||||
}
|
||||
|
||||
function Get-VisualCPPComponents {
|
||||
$regKeys = @(
|
||||
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*"
|
||||
"HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
|
||||
)
|
||||
$vcpp = Get-ItemProperty -Path $regKeys | Where-Object DisplayName -like "Microsoft Visual C++*"
|
||||
$vcpp | Sort-Object DisplayName, DisplayVersion | ForEach-Object {
|
||||
$isMatch = $_.DisplayName -match "^(?<Name>Microsoft Visual C\+\+ \d{4})\s+(?<Arch>\w{3})\s+(?<Ext>.+)\s+-"
|
||||
if ($isMatch) {
|
||||
$name = '{0} {1}' -f $matches["Name"], $matches["Ext"]
|
||||
$arch = $matches["Arch"].ToLower()
|
||||
$version = $_.DisplayVersion
|
||||
[PSCustomObject]@{
|
||||
Name = $name
|
||||
Architecture = $arch
|
||||
Version = $version
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Get-DacFxVersion {
|
||||
$dacfxversion = & "$env:ProgramFiles\Microsoft SQL Server\160\DAC\bin\sqlpackage.exe" /version
|
||||
return $dacfxversion
|
||||
}
|
||||
|
||||
function Get-SwigVersion {
|
||||
(swig -version | Out-String) -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
$swigVersion = $Matches.Version
|
||||
return $swigVersion
|
||||
}
|
||||
|
||||
function Get-ImageMagickVersion {
|
||||
(magick -version | Select-String -Pattern "Version") -match "(?<version>\d+\.\d+\.\d+-\d+)" | Out-Null
|
||||
$magickVersion = $Matches.Version
|
||||
return $magickVersion
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
function Get-VisualStudioVersion {
|
||||
$vsInstance = Get-VisualStudioInstance
|
||||
[PSCustomObject]@{
|
||||
Name = $vsInstance.DisplayName
|
||||
Version = $vsInstance.InstallationVersion
|
||||
Path = $vsInstance.InstallationPath
|
||||
}
|
||||
}
|
||||
|
||||
function Get-SDKVersion {
|
||||
$regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
|
||||
$installedApplications = Get-ItemProperty -Path $regKey
|
||||
($installedApplications | Where-Object { $_.DisplayName -eq 'Windows SDK' } | Select-Object -First 1).DisplayVersion
|
||||
}
|
||||
|
||||
function Get-WDKVersion {
|
||||
$regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
|
||||
$installedApplications = Get-ItemProperty -Path $regKey
|
||||
($installedApplications | Where-Object { $_.DisplayName -eq 'Windows Driver Kit' } | Select-Object -First 1).DisplayVersion
|
||||
}
|
||||
|
||||
function Get-VisualStudioExtensions {
|
||||
$vsPackages = (Get-VisualStudioInstance).Packages
|
||||
|
||||
# Additional vsixs
|
||||
$toolset = Get-ToolsetContent
|
||||
$vsixUrls = $toolset.visualStudio.vsix
|
||||
if ($vsixUrls)
|
||||
{
|
||||
$vsixs = $vsixUrls | ForEach-Object {
|
||||
$vsix = Get-VsixExtenstionFromMarketplace -ExtensionMarketPlaceName $_
|
||||
|
||||
$vsixVersion = ($vsPackages | Where-Object {$_.Id -match $vsix.VsixId -and $_.type -eq 'vsix'}).Version
|
||||
@{
|
||||
Package = $vsix.ExtensionName
|
||||
Version = $vsixVersion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# SDK
|
||||
$sdkVersion = Get-SDKVersion
|
||||
$sdkPackages = @(
|
||||
@{Package = 'Windows Software Development Kit'; Version = $sdkVersion}
|
||||
)
|
||||
|
||||
# WDK
|
||||
$wdkVersion = Get-WDKVersion
|
||||
$wdkExtensionVersion = Get-VSExtensionVersion -packageName 'Microsoft.Windows.DriverKit'
|
||||
$wdkPackages = @(
|
||||
@{Package = 'Windows Driver Kit'; Version = $wdkVersion}
|
||||
@{Package = 'Windows Driver Kit Visual Studio Extension'; Version = $wdkExtensionVersion}
|
||||
)
|
||||
|
||||
$extensions = @(
|
||||
$vsixs
|
||||
$ssdtPackages
|
||||
$sdkPackages
|
||||
$wdkPackages
|
||||
)
|
||||
|
||||
$extensions | Foreach-Object {
|
||||
[PSCustomObject]$_
|
||||
} | Select-Object Package, Version | Sort-Object Package
|
||||
}
|
||||
|
||||
function Get-WindowsSDKs {
|
||||
$path = "${env:ProgramFiles(x86)}\Windows Kits\10\Extension SDKs\WindowsDesktop"
|
||||
return [PSCustomObject]@{
|
||||
Path = $path
|
||||
Versions = $(Get-ChildItem $path).Name
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
function Get-ApachePath {
|
||||
return Join-Path "C:\tools\" (Get-Item C:\tools\apache*).Name
|
||||
}
|
||||
|
||||
function Get-NginxPath {
|
||||
return Join-Path "C:\tools\" (Get-Item C:\tools\nginx*).Name
|
||||
}
|
||||
|
||||
function Get-ApacheVersion {
|
||||
$apacheBinPath = Join-Path (Get-ApachePath) "\bin\httpd"
|
||||
(. $apacheBinPath -V | Select-String -Pattern "Apache/") -match "Apache/(?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
return $Matches.Version
|
||||
}
|
||||
|
||||
function Get-NginxVersion {
|
||||
$nginxBinPath = Join-Path (Get-NginxPath) "nginx"
|
||||
(cmd /c "$nginxBinPath -v 2>&1") -match "nginx/(?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
return $Matches.Version
|
||||
}
|
||||
|
||||
function Get-ApacheSection
|
||||
{
|
||||
$name = "Apache"
|
||||
$apachePort = "80"
|
||||
$apacheService = Get-Service -Name $name
|
||||
$apacheVersion = Get-ApacheVersion
|
||||
$apacheConfigFile = Join-Path (Get-ApachePath) "\conf\httpd.conf"
|
||||
return [PSCustomObject]@{
|
||||
Name = $name
|
||||
Version = $apacheVersion
|
||||
ConfigFile = $apacheConfigFile
|
||||
ServiceName = $apacheService.Name
|
||||
ServiceStatus = $apacheService.Status
|
||||
ListenPort = $apachePort
|
||||
}
|
||||
}
|
||||
|
||||
function Get-NginxSection
|
||||
{
|
||||
$name = "Nginx"
|
||||
$nginxPort = "80"
|
||||
$nginxService = Get-Service -Name $name
|
||||
$nginxVersion = Get-NginxVersion
|
||||
$nginxConfigFile = Join-Path (Get-NginxPath) "\conf\nginx.conf"
|
||||
return [PSCustomObject]@{
|
||||
Name = $name
|
||||
Version = $nginxVersion
|
||||
ConfigFile = $nginxConfigFile
|
||||
ServiceName = $nginxService.Name
|
||||
ServiceStatus = $nginxService.Status
|
||||
ListenPort = $nginxPort
|
||||
}
|
||||
}
|
||||
|
||||
function Build-WebServersSection {
|
||||
return @(
|
||||
(Get-ApacheSection),
|
||||
(Get-NginxSection)
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user