Hacker News new | ask | show | jobs
by tracker1 2661 days ago

    PS> $lockedFile="C:\Windows\System32\wshtcpip.dll"
    PS> Get-Process | foreach{$processVar = $_;$_.Modules | foreach{if($_.FileName -eq $lockedFile){$processVar.Name + " PID:" + $processVar.id}}}
2 comments

    PS C:\> gps |? {$_.Modules.FileName -match "wshtcpip\.dll"} | select name, id
That foreach looks like it should really be a where
It was copied from stackoverflow... apologies, I just knew it was possible.