Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

WMI query spilling over to host output instead of variable after 200 results - PSv3

$
0
0

$tmp = get-adcomputer -filter "BLAH that gives me 480 machines" $tmp = $tmp | select Name $cs = Get-WmiObject win32_computersystem -ComputerName $tmp.Name

After machine 200 Powershell starts spewing objects to the ISE host instead of putting them in $cs. Any list under 200 machines and it works perfectly.

Anyone know what is going on in this case?

info: PSv3, running Windows 7, AD Domain environment

_______________________________

I get a blinking cursor for a long while (as it should be), interupted by the occational "gwmi: The RPC server is unavailable." Error. And then line after line of this...

::Sample output::

SystemDirectory : C:\windows\system32
Organization    : BLANKED
BuildNumber     : 7601
RegisteredUser  : BLANKED
SerialNumber    : BLANKED
Version         : 6.1.7601

SystemDirectory : C:\WINDOWS\system32
Organization    : BLANKED
BuildNumber     : 2600
RegisteredUser  : BLANKED
SerialNumber    : BLANKED
Version         : 5.1.2600

SystemDirectory : C:\WINDOWS\system32
Organization    : BLANKED
BuildNumber     : 2600
RegisteredUser  : BLANKED
SerialNumber    : BLANKED
Version         : 5.1.2600

________________________________

FYI, this is not the only thing going on in the script. the next line pulls the win32_OperatingSystem class and it does exactly the same thing. It grabs the first 200 fine then starts pumping objects to the host.



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>