Find the number of install of an application on a network

I need to know how many installs of MS Project are on the network (small network 70 computers)
Can I get the number and computer names?

I need to assume for few things here as you are not revealing too much about your environment.

So either populate your computers against AD or if that’s not available then manually create a list. Then do wmi query and find Visio.

This assumes that you have all computers online at the time you run your script and that you don’t need anything else than count.

$computers = get-adcomputer -fi {Name -like "prefix*"} | select -expandProperty Name
#or
$computers = @('prefix001','prefix002','prefix003')

$i = 0
foreach ($computer in $computers) {

    if (Get-WmiObject -Class win32_product -ComputerName $computer | where {$_.name -eq "Microsoft Office Visio 2010"}) {$i++}
    
    } #End Foreach

$i

I did not give enough information:
It is on a domain. server 2012
I would point to a list c:\temp\computers.txt which are all the machines I want to query.
I want to know how many have ms project and what the computer name is.
If possible the user name too.

I have the AD module loaded locally and I have admin rights.
I have set the execution policy to unrestricted.
But every time I try and run anything I get:
Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

Hopefully you can hlep

Please check whether firewall rules are blocking the WMI traffic on those servers

Get-NetFirewallRule | where name -like “wmi” | fl description,action,enabled,profile

Enable the rules to allow the WMI traffic on those computers.

  • Do you have any software deployment tools in-place already, e.g., PDQDeploy, SCCM, LanDesk, etc.?
  • Is PSRemoting enabled on all the systems you want to query?
  • What version of PoswerShell are you running, both on the querying computer and the targets?
  • Is remote registry enabled on the target systems?
There are all sorts of ways you can do this.

Based on the error meesage, I would tend to agree with Nagendra that it looks like a firewall issue. If that is the case you can set a domain-wide firewall rule to enable WMI traffic. And if you get pushback on the security, you can limit the source to the machine that you expect to originate the query.

I am still having problems with this. I suspect Nagendra is correct.
I have tried running the suggestion using PS version 3 the target computers use version 2
the get-firewallrule cmdlet will not work. I have many issue trying to work on the network.
The security seems to be stopping me at every turn.
I am running in unrestricted mode with admin privileges.
I tried : Import-Module get-netfirewallrule
The reply is:
Import-Module : The specified module ‘get-netfirewallrule’ was not loaded because no valid module file was found in any module directory.
At line:1 char:1

  • Import-Module get-netfirewallrule
  •   + CategoryInfo          : ResourceUnavailable: (get-netfirewallrule:String) [Import-Module], FileNotFoundException
      + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
    
    

We also have SCCM but it fails to return information, for example it fails to return serial numbers for all computers when a report is run.
I am at a loss as to what is restricting reporting tools?