Hi,
This is more for my own learning then anything. I’m finding that Get-WMIObject with a -query is faster then passing the whole Get-WMIObject through the pipe and using | Select-Object on it.
But I’m having a bit of trouble then working with the results.
My issue is, - this is just some example code. I’m actually querying for specific fields but it still brings back all the “__Name” fields. So trying to do the Select after to pass less across the pipe.
This works
Get-WmiObject win32_processor | select * -exclude "_*"
This doesn’t?
$test = Get-WMIObject -query "SELECT DeviceID, Name, Description, NumberofCores, NumberOfLogicalProcessors, MaxClockSpeed, SocketDesignation, Status FROM Win32_Processor" $Test | Select -exclude "_*"
I thought I had sussed the pipe and variables. But this now calls into question that.
My end goal is to query WMI, and output the result to a text-file or some other variable to work with, without all the extra gumf.