Which of the below CmdLet will provide all the applications installed in a Local/Remote system?
-
\$Keys = Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Installed \$Items = \$keys |foreach-object {Get-ItemProperty \$_.PsPath}
-
\$Keys = Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall \$Items = \$keys |foreach-object {Get-ItemProperty \$_.PsPath}
-
\$Keys = Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall \$Items = \$keys |foreach-object {Get-ChildItem \$_.PsPath}
-
None of the above
B
Correct answer
Explanation
Windows stores installed application information in the registry under HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall. Option B correctly navigates to this registry path and uses Get-ItemProperty to retrieve the application details from each subkey. Option A uses an incorrect key name, while Option C uses Get-ChildItem which lists subkeys rather than retrieving their properties.