Actually I might of broken it. I opened a new instance of it and ran it, but got an error message this time.
code:
$New_Variable = $Holes.CounterSamples | Where-Object {$_.CookedValue -gt 0} | Select InstanceName, CookedValue
$Array = @()
ForEach ($Line in $New_Variable) {
$New_InstanceName = $Line.InstanceName.Substring( 0, $Line.InstanceName.indexof("|") + 1)
$Object = New-Object -TypeName psobject
$Object | Add-Member -MemberType NoteProperty -Name "InstanceName" -Value $New_InstanceName
$object | Add-Member -MemberType NoteProperty -Name "CookedValue" -Value $Line.CookedValue
$Array += $Object
}
$Array
error:
You cannot call a method on a null-valued expression.
At C:\Users\Jonathan.Hauxwell\Documents\Dserv GetCounter Holes.ps1:6 char:85
+ $New_InstanceName = $Line.InstanceName.Substring( 0, $Line.InstanceName.indexof <<<< ("|") + 1)
+ CategoryInfo : InvalidOperation: (indexof:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull