What happens when you do this
PS> Get-wmiobject win32_processor | %{$_.name}
The array could be due to hyperthreading.
From
http://msdn2.microsoft.com/en-us/library/aa394373.aspx
To determine if hyperthreading is enabled for the processor, compare
NumberOfLogicalProcessors and NumberOfCores. If hyperthreading is enabled in
the BIOS for the processor, then NumberOfCores is less than
NumberOfLogicalProcessors. For example, a dual-processor system that
contains two processors enabled for hyperthreading can run four threads or
programs or simultaneously. In this case, NumberOfCores is 2 and
NumberOfLogicalProcessors is 4.
"greatbarrier86" <greatbarrier86@discussions.microsoft.com> wrote in message
news:7CCF9127-3861-48C6-93FE-EBC92CC341FF@microsoft.com...
> Sorry for the trouble. Let me try to sort it out
> The first part is
>> PS> $Get_Processor_Speed = Get-WmiObject Win32_Processor
>> PS> $Processor_Speed = $Get_Processor_Speed.Name
>> PS> write-host $Processor_speed
>> Intel(R) Pentium(R) M processor 1.73GHz
>
> That just produces a null result. I was just saying that what worked for
> you
> did not work for me.
>
> The Get-wmiobject win32_processor | Select Name works but outputs as an
> array as you mentioned.
>
>
>
> "dreeschkind" wrote:
>
>> "greatbarrier86" wrote:
>>
>> > The first part you said returns nothing as the result.
>>
>> Sorry, I don't think I understand you. I did never say something like
>> "the
>> first
>> part returns nothing as the result". In fact I wanted to tell you that
>> your
>> example works on my WinXP system! What it the "first part" you're
>> refering to?
>>
>> > the second part using the select name and Get-itemproperty work but the
>> > result is heavily indented.
>>
>> Are you saying that this works on your system?
>>
>> PS> Get-WmiObject Win32_Processor | select name
>>
>> If so, then your first example should also work. However, as Matthias
>> pointed out, it won't work that way in case you got more than one
>> processor
>> because in this case Get-WmiObject Win32_Processor will return an array
>> of
>> objects and arrays don't have a name property to access. Using the
>> select-object cmdlet works because it will automatically iterate over all
>> objects in the pipeline and select the name property of each processor
>> object.
>>
>> The indentation seems to be normal, I noticed the same thing on my
>> machine
>> (see my example in my first post). You can cut off the spaces using the
>> trim() method of the string object like so:
>>
>> PS> Get-WmiObject Win32_Processor | foreach { $_.name.trim() }
>>
>> > Does the get-wmiobject only parse in a certain
>> > number of lines?
>>
>> I'm not sure what to answer here. Get-WmiObject does not parse any lines
>> at
>> all. In this case it returns processor objects which are then written to
>> the
>> pipeline. You can access the properties of the objects using the
>> select-object and foreach-object cmdlets. At the end of the pipeline
>> these
>> objects/selected properties are rendered as lines of text.
>>
>> Hope that helps.
>>
>> You may also want to read these:
>> PS> help get-wmiobject -detailed
>> PS> help foreach-object -detailed
>> PS> help select-object -detailed
>>
>> --
>> greetings
>> dreeschkind
>>
>> > "dreeschkind" wrote:
>> >
>> > > Works here using WinXP SP2:
>> > >
>> > > PS> $Get_Processor_Speed = Get-WmiObject Win32_Processor
>> > > PS> $Processor_Speed = $Get_Processor_Speed.Name
>> > > PS> write-host $Processor_speed
>> > > Intel(R) Pentium(R) M processor 1.73GHz
>> > >
>> > > Can you see the result when doing the following?
>> > >
>> > > PS> Get-WmiObject Win32_Processor | select name
>> > >
>> > > The same information should also be available in the registry:
>> > >
>> > > PS> Get-ItemProperty
>> > > HKLM:\HARDWARE\DESCRIPTION\System\CentralProcessor\0 |
>> > > select ProcessorNameString
>> > >
>> > > --
>> > > greetings
>> > > dreeschkind
>> > >
>> > > PS> Get-WmiObject Win32_Processor | select name
>> > >
>> > > "greatbarrier86" wrote:
>> > >
>> > > > Is there any reason why these lines of code will return a null
>> > > > result in
>> > > > Windows XP but NOT windows Vista?
>> > > >
>> > > > $Get_Processor_Speed = Get-WmiObject Win32_Processor
>> > > > $Processor_Speed = $Get_Processor_Speed.Name
>> > > > write-host $Processor_speed
>> > > >
>> > > > In Vista, it works fine. In XP, it fails every time.