In order to get the DLL files running under a certain process I am using the following line of code:
$Modules += Get-Process -Id $ProcessId | Select-Object -ExpandProperty Modules
This line of code works perfectly fine when running in a 64-bit mode. However, when using a 32-bit mode I have noticed that the same process returns less modules than in a 64-bit mode.
Why is this happening ? and since i need to run my script in a 32-bit mode, is there any other method of getting the requested DLL files ?