locked
Remove items from a list RRS feed

  • Question

  • Hi

    The following commands give me an array which includes several items if I f.ex have multiple calc.exe running.
    I would like to reduce the list to one item, since they are duplicates, and I only need one item to process in the rest of my script

    $UserAccountList = (Get-Process -IncludeUserName | Where-Object {$_.ProcessName -like "*$ProcessName*"}).UserName
    $UserAccount = $UserAccountList[0]

    Is there another way to do this instead of choosing item nr 0 from the array?


    Freddy

    Tuesday, August 16, 2016 12:12 PM

Answers