In this video, the Kilt Guy shows you how to collect and information for installed programs from the Registry using a PowerShell script
Commands used in the shell:
Get-WmiObject
Where-Object
Select-Object
Sort-Object
Add-Member
No chapters this time around, but I do have the full script for you, with some additional comments not shown in the video.
========================
#Create an instance of the Registry Object and open the HKLM base key
$reg=[microsoft.win32.registrykey]::OpenRemoteBaseKey('LocalMachine',$env:computername)
#Define the variable to hold the location of Currently Installed Programs
$UninstallKey="SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
#Drill down into the Uninstall key using the OpenSubKey Method
$regkey=$reg.OpenSubKey($UninstallKey)
#Retrieve an array of strings which contain all the subkey names
$subkeys=$regkey.GetSubKeyNames()
#Open each Subkey and use GetValue Method to return the required values for each
$InstalledPrograms = @()
foreach($key in $subkeys){
$thisKey=$UninstallKey+"\\"+$key
$thisSubKey=$reg.OpenSubKey($thisKey)
$obj = New-Object PSObject
$obj | Add-Member -MemberType NoteProperty -Name "Caption" -Value $($thisSubKey.GetValue("DisplayName"))
$obj | Add-Member -MemberType NoteProperty -Name "Version" -Value $($thisSubKey.GetValue("DisplayVersion"))
$obj | Add-Member -MemberType NoteProperty -Name "InstallDate" -Value $($thisSubKey.GetValue("InstallDate"))
$obj | Add-Member -MemberType NoteProperty -Name "InstallLocation" -Value $($thisSubKey.GetValue("InstallLocation"))
$obj | Add-Member -MemberType NoteProperty -Name "InstallSource" -Value $($thisSubKey.GetValue("InstallSource"))
$obj | Add-Member -MemberType NoteProperty -Name "Publisher" -Value $($thisSubKey.GetValue("Publisher"))
$InstalledPrograms += $obj
}
$InstalledPrograms | Where-Object { $_.Caption } | Select-Object Caption, Version, InstallDate, InstallLocation, InstallSource |
Sort-Object -Descending InstallDate | Format-Table -auto
========================
In questa pagina del sito puoi guardare il video online PowerShell 27 Finding Installed Programs through the Registry della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Kilts and Computers 15 dicembre 2022, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 520 volte e gli è piaciuto 14 spettatori. Buona visione!