Nadav Kohen
Nadav Kohen

Reputation: 23

Script that outputs all DLLs used by exe

In cmd the line

tasklist /m /fi "imagename eq xxxxx.exe" > output.txt

will output the DLLs used by all processes to one file.

How can I separate the output to multiple txt files, each file contains the name of the process the the DLL used?

Upvotes: 0

Views: 68

Answers (1)

boxdog
boxdog

Reputation: 8442

This should get you what you want:

Get-Process |
    ForEach-Object {
        $procName = $_.Name
        Get-Process -InputObject $_ -Module -ErrorAction SilentlyContinue |
            Export-Csv ".\$procName.csv" -NoTypeInformation
    }

Upvotes: 2

Related Questions