Skip to content

Commit

Permalink
Update Get-Software.psm1
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyPhipps authored May 7, 2024
1 parent 263b221 commit 3025913
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions Modules/Get-Software.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@
$pathAllUser = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*"
$pathAllUser32 = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"

$SystemResultsArray = Get-ItemProperty -Path $pathAllUser, $pathAllUser32 |
Where-Object DisplayName -ne $null | Select-Object Publisher, DisplayName, DisplayVersion, InstallDate,
InstallSource, InstallLocation, PSChildName, HelpLink
$SystemResultsArray = Get-ItemProperty -Path $pathAllUser, $pathAllUser32 | Where-Object DisplayName -ne $null

$UsersResultsArray = @()
$32BitPath = "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
Expand All @@ -89,7 +87,7 @@

if (Test-Path $Hive) {

REG LOAD HKU\temp $Hive
REG LOAD HKU\temp $Hive > $null

$UsersResultsArray += Get-ItemProperty -Path "Registry::\HKEY_USERS\temp\$32BitPath"
$UsersResultsArray += Get-ItemProperty -Path "Registry::\HKEY_USERS\temp\$64BitPath"
Expand All @@ -105,19 +103,18 @@
}
}

$UsersResultsArray | Select-Object Publisher, DisplayName, DisplayVersion, InstallDate,
InstallSource, InstallLocation, PSChildName, HelpLink

$ResultsArray = $SystemResultsArray + $UsersResultsArray

foreach ($Result in $ResultsArray) {

$Result | Add-Member -MemberType NoteProperty -Name "Host" -Value $env:COMPUTERNAME
$Result | Add-Member -MemberType NoteProperty -Name "DateScanned" -Value $DateScanned
$Result | Add-Member -MemberType NoteProperty -Name "ModuleVersion" -Value $ModuleVersion
$Result.PSParentPath = ($Result.PSParentPath -Split "::\\")[1]
}

return $ResultsArray | Select-Object Host, DateScanned, Publisher, DisplayName, DisplayVersion, InstallDate,
InstallSource, InstallLocation, PSChildName, HelpLink
InstallSource, InstallLocation, PSChildName, PSParentPath, HelpLink
}

end{
Expand Down

0 comments on commit 3025913

Please sign in to comment.