I have looked through many examples online on how to get this information and have struggled to get the results I need. I am on a deadline to get an inventory of every computer for our company ASAP. Wanted to run this as a script with PowerShell to at least help me locate the ~300 computers across the company in multiple states to expedite this process. I am a noob when it comes to PowerShell I can do basic things, so bear with me.

I have a list of computer names I was able to get from our AD server into a .txt file and then a list of every available IP on our /22 network in a separate .txt file, only ~300 devices actually on the network. The closest thing I have found on here to my problem is the link below. I need the computer name and serial number from it for the device itself for warranty tracking purposes. Next year we are going to look into a solution that has software pushed out through Group Policy to fix this issue going forward.

However, when I run this, every entry comes back with cannot connect to the device. If the computer is on the domain, and I have forced the PSRemoting feature as well as a trusted host for any host on the network, I think it should work and not have to worry about firewalls, but I could be wrong.

Thank you for your help in advance!

Bryan

6 Spice ups

Can you please provide the exact error you are getting?

And possibly what code you are running?

I assume it is an RPC error:

common causes:

  • network connectivity
  • name resolution
  • Firewall / AV blocking things ← this is the most common cause
1 Spice up

Do you have WinRM enabled on your workstations? You can use Test-WSMan to verify if WinRM is enabled and working.

Which OS do the workstations have? If most of them are Windows 10, then you can use Get-CimInstance, which replaced Get-WmiObject.

1 Spice up

Sorry, thought I included that information. There is a mix with Windows 10 and 7, we are working on upgrading all the 7 machines to 10 by the end of the year. I have a SonicWall 4650 that I can look into and see if it is blocking the requests.

Collecting information from NEWPC3
Error communicating with NEWPC3, skipping to next

Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:12 char:19

  • $Serial = Get-WmiObject -Class Win32_Bios -ComputerName $ComputerName |
  • CategoryInfo : InvalidOperation: (:slight_smile: [Get-WmiObject], COMException
  • FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

If those PCs are on the LAN, the sonicwall is most likely not blocking anything.

When we are talking about firewalls, we are talking about the Windows Firewall on each PC.
You can write a GPO that enables WMI-In / WinRM

Do you get that error for ALL machines?

Most of the computers are on the LAN here in the office in Louisville. I do have computers in other states that are on a different network but have SSLVPN tunnels built between the sites so that all machines can talk to the file server here in Louisville. I will look into writing a GPO to enable WinRM.

Thanks a bunch!

PM me as I might be able to help. I had a script that i would run against a remote computer but if it had certain services turned off you had to force it to turn on and then could run it. You combine in some tools like PSEXEC etc from Sysinternals.