This repository has been archived by the owner on Oct 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 802
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New checks SSM Agent Version New checks Session Manager plugin version New output format (Table) Update the screenshots and flowchart Update README.md to reflect new checks Add new tests for the new checks Update the tests README.md and output Update the ZIP file to include latest changes Some other enhancements and minor changes
- Loading branch information
Showing
42 changed files
with
952 additions
and
790 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+1.87 KB
(100%)
Systems Manager/SSMAgent-Toolkit-Windows/SSMAgent-Toolkit.zip
Binary file not shown.
52 changes: 52 additions & 0 deletions
52
Systems Manager/SSMAgent-Toolkit-Windows/SSMAgent-Toolkit/Private/Get-AppVersionNumber.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<# | ||
.Synopsis | ||
Get the application version number | ||
.Description | ||
This is a helper function to get the application version number. | ||
.Example | ||
Get-AppVersionNumber -Path 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall' -Value 'Environment' | ||
.INPUTS | ||
Path = The registry path | ||
AppName = The name of the application under the DisplayName under the registry | ||
.OUTPUTS | ||
Return the version number under the registry | ||
#> | ||
function Get-AppVersionNumber { | ||
[CmdletBinding()] | ||
param ( | ||
[String]$RegHive = "LocalMachine", | ||
[String]$Path = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall", #Define the variable to hold the location of Currently Installed Programs | ||
[parameter(Mandatory = $true)] | ||
[ValidateNotNullOrEmpty()]$AppName | ||
) | ||
|
||
if ((Get-WmiObject -Class Win32_ComputerSystem).SystemType -match 'x64') { | ||
$RegView = [Microsoft.Win32.RegistryView]::Registry64 | ||
} | ||
else { | ||
$RegView = [Microsoft.Win32.RegistryView]::Registry32 | ||
} | ||
|
||
#Create an instance of the Registry Object and open the HKLM base key | ||
$reg = [microsoft.win32.registrykey]::OpenBaseKey([Microsoft.Win32.RegistryHive]::$RegHive, $RegView) | ||
|
||
#Drill down into the Uninstall key using the OpenSubKey Method | ||
$regkey = $reg.OpenSubKey($Path) | ||
|
||
#Retrieve an array of string that contain all the subkey names | ||
$subkeys = $regkey.GetSubKeyNames() | ||
|
||
#Open each Subkey and use GetValue Method to check the match values for AppName | ||
foreach ($key in $subkeys) { | ||
$thisKey = $Path + "\\" + $key | ||
$thisSubKey = $reg.OpenSubKey($thisKey) | ||
if ($($thisSubKey.GetValue("DisplayName")) -eq $AppName) { | ||
write-host $($thisSubKey.GetValue("DisplayVersion")) | ||
return [System.Version]$($thisSubKey.GetValue("DisplayVersion")) | ||
break | ||
} | ||
else { | ||
continue | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,5 +35,4 @@ function Test-RegistryValue { | |
Write-Log -Message $($PSitem) -LogLevel "ERROR" | ||
return $false | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.