Getting the DLL path to the running process

I have an application that uses a .dll file, there are two different places for the file, and I need to find out which one it uses on more than 200 machines.

I am very new to the power shell and tried the Get-Process method, but it does not provide the information I need, is there any other way to get this in the power shell?

+4
source share
3 answers

This article provides one approach using a WMI provider call. You can use the provided function at the end. If you're just looking for something quick and dirty, it will work.

Digging a little more, This may be what you want:

$modules = Get-Process | Where { $_.ProcessName -eq "process.name" } | Select Modules $modules.Modules 

Replace the process name with the process name

+2
source

The DLLs for the process are contained in the Modules property of the Process object returned by Get-Process .

 Get-Process notepad| select -ExpandProperty modules| Format-Table -AutoSize 

To find a specific DLL, you can do something like this:

 Get-Process chrome| select -ExpandProperty modules| foreach { if($_.ModuleName -eq 'pdf.dll'){$_.Filename} } 

Since there can be many processes with the same name, you can use this to show only individual locales of the DLL:

 Get-Process chrome| select -ExpandProperty modules| where {$_.ModuleName -eq 'pdf.dll'}| group -Property FileName| select name 
+3
source

I recently wrote an article on how to find DLLs loaded by a specific process. You can probably adapt this code to find your specific DLL.

http://trevorsullivan.net/2010/08/25/powershell-finding-currently-loaded-dlls/

0
source

Source: https://habr.com/ru/post/1393456/


All Articles