Hi,
Get-Process g*
returns a collection of process objects with names that start with g
Select-Object converts each object of this collection to a new custom object
with the single property ProcessName that is copied from the original process
objects.
To investigate this try
(Get-Process g* | Select-Object ProcessName).GetType()
and
Get-Process g* | Select-Object ProcessName | Get-Member
With the standard formatting the reduced object produces your result.
Try
Get-Process g* | ForEach-Object { $_.ProcessName }
to get a string for every process that starts with g.
To get the first process only that starts with g you can use
Get-Process p* | Select-Object -First 1 | ForEach-Object { $_.ProcessName }
--
Bernd
"No Spam" wrote:
> Newbie alert.
>
> Hi,
>
> I am still a beginner at this, so excuse this basic question if it was
> answered.
> I read the docs, search through google and cannot find an answer to
> this.
>
> How to I capture the string only from the select-object output.
>
> For example.
>>
> Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
> ------- ------ ----- ----- ----- ------ -- -----------
> 141 23 30480 27500 546 0.45 4928 GOContactSync
>
> I would like to capture the process name only.
>
>
> > get-process -name g* | select-object ProcessName >
> ProcessName
> -----------
> GOContactSync
>
> How do I capture the value only "GOContactSync" and not the
> "ProcessName" headline?
>
> Any pointers would be greatly appreciated.
>
> Thanks.
>
>