Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We've a 64bit Windows Server 2008 running Remote Desktop.

The application lsm.exe (the local session manager) appears to be leaking memory. Although the memory usage is quite low when the server is rebooted, this continues to climb until people can no longer log in.

The server has no audio card and does not have any AV software installed. The server is fully service packed. (Service pack 2)

It has 8GB memory. 60 users regularly use it. There seem to be no relevant event log messages. The login does not start explorer. It starts a "login.vbs" script. This login script creates several wsShell and wScript.Network objects, but even if I comment these out, I still get the same behaviour. (note - I swapped the .vbs script for an executable. No difference)

There are multiple applications installed, but the only one of note is : perfectbackup - A java based backup solution.

The memory leak seems to happen when people log in / log out of Remote Desktop. e.g. Logging in will change the lsm memory size from 21,180K to 21,512K. Logging out will change the usage from 21,512K to 12,668K. This may go down later on, but the general movement is upwards. Also - This will go up faster, and stay up if I log in / out several times.

What could be causing this, and how would I fix it?

share|improve this question
How many users are actively on this terminal server and how much memory does it have? Are there any time related messages from the Event logs? What applications and services do you have installed? – citadelgrad Jun 8 '10 at 14:08
citidelgrad: I added extra detail in response to your questions. – seanyboy Jun 9 '10 at 12:26
try it without any vbs scripts maybe its the wsh process thats causing the problem. – tony roth Jun 9 '10 at 13:46
It's really hard for me to not use the script. This is a live environment. I had hoped that this would be something someone else had happened upon. Browsing the internet shows it as a common issue, but I've been unable to find definitive steps to take wrt a solution. – seanyboy Jun 9 '10 at 15:07
OK - Swapped the script for an executable, and there's no difference. – seanyboy Jun 18 '10 at 8:49

How many sessions are generally active on your machine? If users are disconnecting their sessions, instead of logging off, that can cause the kind of problems you are seeing. One thing I've seen done to resolve this is to force disconnected sessions to log out after a short period of inactivity (1 to 2 hours) - that has resolved this type of issue for me in the past.

share|improve this answer
About 60 users. We force disconnections quite quickly, and there are rarely disconnected sessions on the server. – seanyboy Jun 23 '10 at 11:49

Perhaps because you are using a non windows shell you aren't actually properly logging out of terminal server. Forcing disconnections might not be enough?

Try adding to the end of the script:

 Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\.\root\cimv2")
 Set colOperatingSystems = objWMIService.ExecQuery ("SELECT * FROM Win32_OperatingSystem")
 For Each objOperatingSystem in colOperatingSystems

Just a wild guess (and yes 4 is forced logoff ( )

share|improve this answer

This looks like it could be related to the problem you're experiencing:

Although the server has no audio card, maybe this could involve RDP's remote audio playback capability.

You should try disabling remote audio when connecting to the terminal server and see if the memory leak disappears.

Also, an additional troubleshooting step you should take: does this happen when logging on locally to the server's console, or only when using Terminal Server?

share|improve this answer
Disabling remote audio makes no difference at all. – seanyboy Jun 21 '10 at 9:15
up vote 0 down vote accepted

Found the following on the microsoft forums.

"The XP/2003 terminal session manager needs to be closed once every few hours. This resets the lsm.exe memory footprint. We monitor lsm.exe memory usage with SCOM and we see an immediate drop in memory usage when we close ts managers on XP or 2003. The 2008 ts manager doesn't seem to cause this problem."

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.