Is there a way I can check the scope of my installed programs? I would like to know if certain programs are for just the CurrentUser or if they can be used by AllUsers. Preferably via PowerShell, but I guess it doesn't have to be.
-
take a look at this script: https://powershell.one/code/5.html – Abraham Zinala May 28 '21 at 04:17
2 Answers
To find all executables in the PATH (located in directories listed in $env:PATH
) located in directories outside the current user's home directory tree, using the Get-Command
and Where-Object
cmdlets:
# Finds all executables in $env:PATH that are *not* located in the
# current user's home-directory tree.
Get-Command -Type Application |
Where-Object { -not $_.Path.StartsWith($HOME, 'OrdinalIgnoreCase') }
To ask the question for given executable names, using a calculated property:
# For the given executable names, outputs [pscustomobject] instances
# containing each executable's full path and a flag that indicates
# whether the executable's directory is located in the
# current user's home-directory tree.
Get-Command -Type Application foo, bar |
Select-Object Path,
@{ Name='CurrentUserOnly'; Expression={ $_.Path.StartsWith($HOME, 'OrdinalIgnoreCase') } }
If you want to include executables that you can't invoke directly from a shell (whose directories aren't in $env:PATH
), but can be invoked via start
(cmd.exe
) / Start-Process
(PowerShell) / via the GUI's Run
dialog (WinKey-R), such as excel.exe
:
# Finds all executables in $env:PATH *and* those that can be launched
# via cmd /c start / Start-Process, which are *not* located in the
# current user's home-directory tree.
# Lists full paths only.
@(Get-Command -Type Application).Path +
(Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths').
ForEach({ if ($val = $_.GetValue('') -replace '"') { $val } }) |
Where-Object { -not $_.StartsWith($HOME, 'OrdinalIgnoreCase') }
Note: Unfortunately, Get-Package
-IncludeWindowsInstaller
is not an option, because, while it does list installed applications, it seemingly:
cannot be combined with
-Scope CurrentUser
or-Scope AllUsers
in Windows PowerShell; also-IncludeWindowsInstaller
/-ProviderName Programs
isn't supported at all in PowerShell (Core) 7+, at least by default.also doesn't return information about the installed programs' executable paths.

- 382,024
- 64
- 607
- 775
-
Thanks, @mklement0. Really appreciate the help. This mostly worked, however, I did notice that it didn't get everything. For example, I couldn't get Firefox or Google Chrome to pull up. Might there be a way of getting those to appear? – L. King May 28 '21 at 01:29
-
@L.King, certain additional applications can be detected, yes - but it depends on whether they've created entries under `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths`. Please see my update. – mklement0 May 28 '21 at 02:47
I was trying the get-package's -scope parameter, but that doesn't apply to applications. Here's another way to get it (Powershell 5.1). These per user apps tend to be the bane of administrators.
get-package | ? fastpackagereference -match hklm # 130 items
get-package | ? fastpackagereference -match hkcu | ft -a
Name Version Source ProviderName
---- ------- ------ ------------
Cisco Webex Meetings 41.5.4 Programs
Amazon Kindle 1.31.0.60170 Programs
f.lux Programs
Microsoft OneDrive 21.073.0411.0002 Programs
Slack 4.16.1 Programs
Microsoft Teams 1.4.00.4167 Programs
Microsoft Visual Studio Code (User) 1.55.2 Programs

- 23,033
- 6
- 64
- 66
-
1Thanks, @js2010. Unfortunately, that only displays packages that have been installed by `PowerShellGet`. – L. King May 28 '21 at 02:32