检索正在运行的进程的dll路径
我有一个使用 .dll 文件的应用程序,该文件有 2 个不同的位置,我需要找出它在 200 多台计算机上使用的位置。
我对 power shell 非常陌生,并且尝试过 Get-Process 方法,但它没有提供我需要的信息,是否有其他方法可以在 power shell 中检索此信息?
I have an application that uses a .dll file, there are 2 different locations for the file and I need to find out which one it is using on over 200 machines.
I am very new to power shell and have tried Get-Process method but it does not supply the information I need, is there another way to retrieve this in power shell?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这篇文章提供了一种使用 WMI 提供程序调用的方法。您可以使用最后提供的函数。如果您只是在寻找一些快速而肮脏的东西,那么这会起作用。
再深入一点,这可能就是您想要的:
将 process.name 替换为您的进程名称
This article gives one approach using a WMI provider call. You could use the provided Function at the end. If your just looking for something quick and dirty this would work.
Digging in a little more, This might be what you want:
Replace process.name with your process name
进程的 DLL 包含在
Get-Process
返回的 Process 对象的 Modules 属性中。要查找特定的 DLL,您可以执行以下操作:
由于可能有许多具有相同名称的进程,因此您可以使用它来仅显示不同的 DLL 位置:
The DLLs for a process are contained in the Modules property of the Process object returned by
Get-Process
.To look for a specific DLL, you could do something like this:
Since there could be many processes with the same name, you could use this to show only the distinct DLL locations:
我不久前写了一篇关于如何查找特定进程加载的 DLL 的文章。您或许可以修改此代码来查找您的特定 DLL。
http://trevorsullivan.net/2010/08/25/ powershell-finding-currently-loaded-dlls/
I wrote an article a while back on how to find DLLs that were loaded by a particular process. You can probably adapt this code to find your specific DLL.
http://trevorsullivan.net/2010/08/25/powershell-finding-currently-loaded-dlls/