powershellpowershell-3.0appv

Possible to use PowerShell's Get-AppvClientPackage to list AppV packages on a machine other than my own?


I can use Get-AppvClientPackage -all [| select name] or Get-WmiObject -Namespace root\appv -Class AppvClientPackage [|select name] to list all installed AppV packages installed on my own machine. It doesn't appear to be possible to use this cmdlet to get the AppV packages installed on another machine, without remote execution.

I am asking this question in hopes of finding something that works (see purpose) or get a definitive answer that it's not possible. There may be better options available (other than PS), but my question is simply if it is possible or not, so that if the latter is the case, we can push to develop a script (which could be run by someone with elevated privileges) to gather information needed.

Purpose: Our team doesn't have visibility into SCCM (that's another option is to have that team report on what is installed where, though sometimes we need answers quickly) and remote PS execution is restricted to one security team (which is understandable), but at times (for support or decommission purposes) we need to check to see if a specific client machine has a package installed, check what AppV packages a specific client has installed, as well as check to see which machines have a particular package installed.

If there is another module or cmdlet (or even something other than powershell or WMI) that might be able to yield the same information, suggestions are welcome.


Solution

  • Get-WmiObject utilizes RPC to connect to remote PCs and does not require PSRemoting. In this effort, all you need to do is add the -ComputerName parameter.

    #Requires -Version 3
    $Target = 'localhost'
    $Params=@{
        Namespace = 'root\appv'
        Class = 'AppvClientPackage'
        Property = 'Name'
        ComputerName = $Target
    }
    Get-WmiObject @Params
    

    PS C:\> Get-Help -Name 'Get-WmiObject' -Parameter 'ComputerName'
    
    -ComputerName <String[]>
        Specifies the target computer for the management operation. Enter a fully
        qualified domain name (FQDN), a NetBIOS name, or an IP address. When the remote
        computer is in a different domain than the local computer, the fully qualified
        domain name is required.
    
        The default is the local computer. To specify the local computer, such as in a
        list of computer names, use "localhost", the local computer name, or a dot (.).
    
        This parameter does not rely on Windows PowerShell remoting, which uses
        WS-Management. You can use the ComputerName parameter of Get-WmiObject even if
        your computer is not configured to run WS-Management remote commands.
    
        Required?                    false
        Position?                    named
        Default value                None
        Accept pipeline input?       False
        Accept wildcard characters?  false