How do find out what chews up host memory?

Hello,

I have super simple script which causes Powershell to kill itself in remote session becouse of memory limit. After about 15 iterations host memory will be at 1 GB,

Import-Module Webadministration
for ($index = 0; $index -lt 50; $index++) {Get-ChildItem IIS:\AppPools | select -First 1 | set-itemproperty  -name enable32bitapponwin64 -value $false }

Hi,

For me it looks like you are trying to set same setting on same AppPool for 50 times. Is that the intention?

This is because you run your scriptblock 50 times, but in scriptbloc value is always the same (no reference to $index).

Lauras

No, this is for illustration purposes only. I have to modify 5 different settings within each application pool and if I have more then 3 application pools on my machine then Powershell will stop working because of memory leak.

Just a guess:
Can it be that changes are executed too fast? Try adding sleep in between commands.