I have an issue running the following script in a pipeline:
Get-Process | Get-MoreInfo.ps1
The issue is that only the last process of the collection is being displayed. How do I work with all members of the collection in the following script:
param( [Parameter(Mandatory = $true,ValueFromPipeline = $true)]
$Process
)
function Get-Stats($Process)
{
New-Object PSObject -Property @{
Name = $Process.Processname
}
}
Get-Stats($Process)
try this:
Edit:
if you need a function:
then you can use:
Edit after Comment:
Read about dot sourcing a script