So I have a few dozen computers on a domain. I'm pretty new to Powershell but I thought my idea would be simple enough. Get a list of these computers, use Get-WmiObject to query things like Win32_ComputerSystem and Win32_OperatingSystem and dump the properties I want into a hash table. But it's so slow when you go one by one. So I thought, let's do them as background jobs. Here's where I run into my problem.
If I run Get-WmiObject -Class Win32_ComputerSystem -ComputerName COMPUTER I get back the data I'm looking for.
But if I run Get-WmiObject -Class Win32_ComputerSystem -Computername COMPUTER -AsJob then wait for the job to finish. It says Job failed with
Receive-Job : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:1 char:22
+ Get-Job | Receive-Job <<<<
+ CategoryInfo : InvalidResult: (:) [Receive-Job], COMException
+ FullyQualifiedErrorId : JobStateFailed,Microsoft.PowerShell.Commands.ReceiveJobCommand
So I originally thought this was a WMI Error. I checked the remote computer and the RpcSs, RpcLocator, WinRM, Rasman, RasAuto and RemoteRegistry services were running. WMI and RemoteAdmin were enabled in the firewall and all my Get-WmiObject queries worked as long as they don't have -AsJob on them. I tried it on multiple computers and i'd say most of them return these errors. i think I only got a Job completed on one computer but I can't find any differences between that computer and the ones that are failing. We have a pretty flat network so there is no routing being done and everything is within the firewall. So it's not a firewall issue. I've even tried disabling Windows Firewall as a test on one of the machines that fails and I still get the same error. Can anybody help me figure out what I'm doing wrong?