> get-process feeddemon | select modules
looks like it would do the job, but it shows only
Modules
-------
{FeedDemon.exe, ntdll.dll, wow64.dll, wow64win.dll...}
and I can't figure out how to see the complete list.
> get-process feeddemon | select modules | get-member
shows that this is a PSCustomObject...
TypeName: System.Management.Automation.PSCustomObject
Name MemberType Definition
---- ---------- ----------
Equals Method System.Boolean Equals(Object obj)
GetHashCode Method System.Int32 GetHashCode()
GetType Method System.Type GetType()
ToString Method System.String ToString()
Modules NoteProperty System.Diagnostics.ProcessModuleCollection
Modules=System.Diagnostics.ProcessModuleCollection
I though the ToString() method might help, but it returns a zero-length
(empty) string.
What other techniques are available for extracting the full content of a
NoteProperty? I want to see the full list of modules this process has
loaded, not the truncated {FeedDemon.exe, ntdll.dll, wow64.dll,
wow64win.dll...}
>I wanted to see the list of DLLs etc. loaded by a process.
>
>> get-process feeddemon | select modules
>
> looks like it would do the job, but it shows only
Try "select -expand modules" instead. It should do the trick.
--
Tomas Restrepo
http://www.devdeo.com/
http://www.winterdom.com/weblog/
get-process powershell|select modules|foreach-object{$_.modules}
Marco
--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp
PowerGadgets MVP
http://www.powergadgets.com/mvp
... hmmm; indeed
> get-process feeddemon | select modules | get-member seems to confirm this:
TypeName: System.Management.Automation.PSCustomObject
Name MemberType Definition
---- ---------- ----------
Equals Method System.Boolean Equals(Object obj)
GetHashCode Method System.Int32 GetHashCode()
GetType Method System.Type GetType()
ToString Method System.String ToString()
Modules NoteProperty System.Diagnostics.ProcessModuleCollection
Modules=System.Diagnostics.ProcessModuleCollection
Thanks; this indeed works but I am wondering how this is different from my
initial attempt (get-process feeddemon | select modules)?
I guess the 'select' is constructing a new object to hold what is coming
down the pipleline, whereas your technique just goes straight to the
'modules' property of the process object.
get-process feeddemon | select -expand modules
Mike
I see what you mean. The NoteProperty is the result of ETS
(http://msdn2.microsoft.com/en-us/library/cc136149(VS.85).aspx) since a
custom object is being returned.
Marco
I believe this is a symptom of PowerShell's auto-flattening of objects as they
pass through the pipeline. I agree it is weird. I often end up indexing into
the array during ad-hoc stuff until I find what I am looking for, and then go
with the foreach-object method for a script or function. e.g.:
(get-process powershell)[0].modules
I didn't notice the Select-Object -expand parameter until this past Saturday and
was blown away. :)
--
Hal Rottenberg
Blog: http://halr9000.com
Webmaster, Psi (http://psi-im.org)
Co-host, PowerScripting Podcast (http://powerscripting.net)
The second statment, using the modules member, gets direct access to the
ProcessModuleCollection.
PS 38> (gps powershell | select modules) | foreach {$_.gettype()}
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False PSCustomObject System.Object
PS 39> (gps powershell).modules | foreach {$_.gettype()}
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False ProcessModule System.ComponentModel.Component
True False ProcessModule System.ComponentModel.Component
True False ProcessModule System.ComponentModel.Component
(...)