Find a memory leak application on SharePoint

If you’re going to look for memory leaks, you need Performance Monitor (perfmon).

Here is a method you can use to detect memory leaks:

First open Perfmon and select the .NET CLR Memory Performance object and the counter # Bytes in all Heaps for all your w3wp instances (w3wp#1, w3wp#2, etc).

With these counters you will be able to see if any w3wp process is accumulating memory. Leave this running for some hours and you will notice rapidly.

Now once you have determined a w3wp process that is leaking, you need to clearly identify it. Of course the w3wp#1 notation, isn’t helping here. So you need to find out what does it correspond to. In my previous post, I already mentionned that you can find out the Web Application if you have the Process ID. Clearly, in this case, we still need to find the process ID.

I have come across 2 methods for this:

1. You can set a registry key on your server(s) that will translate the w3wp#1 into w3wp_pid. See KB281884 for this (I hate setting registry keys if it can also be done without [:D] )

2. You can also find out this information using perfmon! Add the Performance object Process with the counter ID Process and for the instance of w3wp#… for which you want to know the pid. And voila, you get the Pid. 

Now, using cscript iisapp.vbs you can find out the Web application that is leaking. With this information you can then check which solutions are deployed to this web application and you can already start with the fingerpointing [6] !

I want to thank my good friend and colleague Cedric Carrette for sharing this information with me.


How to find out which w3wp.exe is mapped to which Application pool

Looking at the processes of one of my servers, I notices a huge memory consumption on one of the w3wp.exe’s running on the Moss server. Immediately I wanted to find out which SharePoint Webapp is causing this. And there I was….. Well you need to know the Process ID first (View -> Select Columns… in Task Manager) and then you can use the iisapp.vbs tool that comes with IIS. 
I found this information on the this post from the Thoughts about IIS (and now SharePoint blog) which describes the following: 
During the course of working through issues, I get asked at least twice a week how to determine which application pool maps to a particular worker process PID (Process ID) on a server.  I suppose there are lots of ways to determine this, but here two that come to mind to determine the answer. 
The first way, and by far the easiest, is to use one of the new scripts that come in the box called IISAPP.VBS.  It is located in the %SystemRoot%\system32 directory.  For example: 

C:\WINDOWS\system32>cscript iisapp.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

W3WP.exe PID: 1172 AppPoolId: StsAdminAppPool
W3WP.exe PID: 2656 AppPoolId: MSSharePointAppPool
W3WP.exe PID: 2148 AppPoolId: WMS App Pool
W3WP.exe PID: 3604 AppPoolId: defaultwebsite

As you can see, this script makes it very easy to determine what the PID is of each specific Application Pool.  This is nice to use when trying to determine which PID you may want to snap a dump of for debugging purposes.

Error applying site theme: A theme with the name "Citrus 1011" and version already exists on the server.

Today, I had to create a site template of a specific site and create a new site based on that template on the same server and the same web application. Everything went ok creating the site template and creating the new site. However when I wanted to apply a the same theme to the site as the source site, I got the following error message:

A theme with the name “Citrus 1011” and version already exists on the server.

Crap, what the f*** !

Luckily for me, one of my colleagues, Jonathan Martiat, had encountered this before and also rememered the solution.If you encounter this error then do the following:

1. Open the website in SharePoint Designer and delete the _themes folder completely.
2. execute an iisreset on your frontend server(s)
3. reapply the necessary site theme

….and that’s it !

I must admit, that I had tried to do it without executing an iisreset and although I did still get the error message, the site theme was indeed applied, but doing it after iisreset, completely wipes out the error message

So, thanks Jonathan for the good tip and hopefully you guys also benefit from this post.

What version of WSS/MOSS are you running?

I am preparing to install the new Infrastructure update that has been made available recently and wanted to find out what versions I am currently running. A post on the blog of Aaron Saikovski showed a nice table to determine the versions:

Remember that you can find these version numbers in Central Administration -> Operations -> Servers in Farm (/_admin/FarmServers.aspx)

Quick field reference – MOSS 2007/WSS V3.0 Version guide by Aaron Saikovsky

Here is a quick table for those who want to find out what version of WSS/MOSS you are currently patched up to:

Service Pack/Hotfix Version WSS V3.0 MOSS 2007

Infrastructure Update (KB951695 & KB951297)

Post-SP1 hotfix (KB948945)

Post-SP1 hotfix (KB941274)

Post-SP1 hotfix (KB941422)

Service Pack 1

Release To Manufacturing (RTM)

Host Header based site collections

This post is all about being able to host multiple domains in one web application and separated on a site collection level. And all this without touching the IIS configuration in IIS Manager.

A colleague of mine told me today about the -hhurl parameter for the stsadm -o createsite command. Again until today, …never heard of it, but man is it great! [;)]

Let me explain with an example:

I create a web application on my testserver with a url of So if I go into Central Admin now, I can only see one web application with this url. If I want to create a site collection in this web application with a url, then I can create this site collection with the following command:

stsadm -o createsite -url -owneremail [email protected] -ownerlogin Mydomain\myuser -hhurl

Assuming that I have created the necessary DNS records for, pointing to my WSS (and even MOSS) server, I can navigate to this URL and find my new site collection asking me to pick a site template because I did not specify it in my createsite command.

If now, I go into Central Administration and list the site collections for the web application, I can see an entry with the name

As curious as I am, I went into IIS manager to find some trace of this new domain in the hostheader settings and I was surprised not to find anyrthing there. So how is IIS able to cope with this? Probably the SharePoint API is picking any requests for this domain up and returning the SharePoint site.

So I went a little further on this and experimented a little with IIS:

What if I create a website in IIS with the hostheader
The anwer: the IIS website is now returned instead of the SharePoint site…so IIS takes precedence over the SharePoint site?

What if I now stop the IIS website and leave the configuration in IIS of this website?
The answer: the SharePoint website is back !

This makes me see a cool new feature. I can setup a IIS site with for example a Maintenance message explaining that the website is down for maintenance and simply start this website when i need to do maintenance on the SharePoint site. After the maintenance stop it, and voila.. SharePoint is back.

If you find all this interesting, then I should point you to the Plan for host-named site collections document on Technet

At least I had a lot of fun playing with this. I hope you do to.

Modify the visible Groups in the quick launch on the People and Groups page

Learned something new today, hoeray [;)]

Do the groups that you never use (Hierarchy Managers, Style Resource Reader, Designers etc)  and that show up on the quick launch on the People and Groups page bother you as well? Is it not much nicer to only see the groups you need and also keep it much simpler for your site owners?

Well, apparently you can edit the groups you want to see in that quick launch section by navigating through the Settings of any SharePoint group and selecting “Edit Group Quick Launch“.

When you select this option, you are presented with a text box, that allows you to remove or add any SharePoint group that should appear in the Quick Launch of the People and Groups page. You will usually only want to show the site’s Visitors, Members and Owners group, right? So only leave those ones in there and delete the rest of them. Remember that you can always find the groups by selecting the More… option in the quick launch afterwards.

For some reason I must have overlooked this default option …. Who has time to run through all the menus anyway? [:P]

Is your IIS Manager empty on your SharePoint servers?

Okay, this is maybe already known out there for quite a while, but I am putting this on my blog anyway.

You may experience that the IIS Manager console is empty when opening it up. This is because IIS has too many threads connected to it. Usually these threads are taken up by the Timer service. An easy workaround for this issue is to simply execute iisreset.exe. After the reset you can open up IIS Manager again.

Additionaly, when this problem is occuring, you may find the following events in the Applications log:

– Event ID 6398
– Event ID 6482
– Event ID 7076

A definite fix to this issue can be found by installing the hotfix as described in KB946517

IIS management commandline tools

Hi all,

One of my MOSS frontend servers, part of a multi-frontend server farm, faced a well-known issue that causes the IIS Manager console to open up empty. In case you have this issue you can temporarily workaround this by performing an iisreset on the system. In my case I could not simply perform a iisreset, because the corporate website is running on it. We do have a NLB device in front of our frontend server that uses a website on all frontends for probing. If we need to disable a frontend, then we need stop the probing website in IIS and the NLB automatically disables the front end in its config. So all I needed to do is stop the probe website. How do you do that without IIS Manager ???

The solution lies in the IIS 6.0 commanline tools. I must admit that until today I had only used iisreset and I was unaware of the other tools.

Here is the list of tools as found at

AdsUtil.vbs is a popular tool because it is the most versatile, and it can be used on so many versions of IIS.AdsUtil.vbs uses ADSI to set, delete, create, and enumerate properties, find paths, and control the IIS server. One helpful parameter is ENUM_ALL, which enumerates the entire IIS configuration.AdsUtil.vbs cannot display properties of types IPSec, Binary, or NTAcl.AdsUtil.vbs does not display secure properties such as passwords.
(applies to IIS 4.0, IIS 5.0, IIS 5.1, IIS 6.0) 

ChAccess.vbs is used to set access permissions at metabase nodes. These access permissions include the AccessRead, AccessWrite, AccessScript, and AccessExecute flags of the AccessFlags property, and the EnableDirBrowsing flag of the DirBrowseFlags property.
(applies to IIS 5.1) 

SyncIwam.vbs is used to update the launching identity of all IIS COM+ application packages that run out of process.There are certain operations that may cause the IWAM account, which is the identity under which out of process IIS applications run, to become out of sync between the COM+ data store and IIS or the SAM. On IIS startup the account information stored in the IIS Metabase is synchronized with the local SAM, but the COM+ applications will not automatically be updated. The result of this is that requests to out of process applications will fail.For more information, open SyncIwam.vbs in Notepad to view the comments.
(applies to IIS 5.1, IIS 6.0) 

IISReset.exe is used to safely start, stop, enable, and disable the IIS services. Always use the /NOFORCE option when stopping or rebooting an IIS server.
(applies to IIS 5.1, IIS 6.0) 

ConvLog.exe is used to convert log files to NCSA format. It can also replace IP addresses with Domain Name System (DNS) names during conversion, or it can be used to replace IP addresses with DNS names inside an NCSA Common log file. You can also use ConvLog.exe to convert time offsets.
(applies to IIS 5.1, IIS 6.0) 

IIsApp.vbs is used to list worker processes. Given an application pool identifier, it an report all of the process identifiers (PIDs) currently running w3wp.exe processes.IIS must be running in worker process isolation mode.This tool uses WMI. It cannot be used to configure a remote IIS server.
(applies to IIS 6.0) 

IIsBack.vbs is used to backup the metabase, restore the metabase, delete backups, or list all existing backup files.This tool uses WMI. It can be run remotely on any machine that supports WMI, but it must be passed the name of a server running IIS 6.0 or later.
(applies to IIS 6.0) 

IIsCnfg.vbs is used to import, export, copy, or save the IIS metabase configuration information, in whole or in part.This tool uses WMI. It can be run remotely on any machine that supports WMI, but it must be passed the name of a server running IIS 6.0 or later.
(applies to IIS 6.0)  

IIsExt.vbs is used to manages Web service extensions. When IIS is installed, only HTML Web content is allowed to be served. ASP, ASP.NET, CGI, and ISAPI applications must be enabled.This tool uses WMI. It can be run remotely on any machine that supports WMI, but it must be passed the name of a server running IIS 6.0 or later.
(applies to IIS 6.0) 

IIsFtp.vbs is used to stop, start, pause, delete, or query the FTP service, or create an FTP site.This tool uses WMI. It can be run remotely on any machine that supports WMI, but it must be passed the name of a server running IIS 6.0 or later.
(applies to IIS 6.0) 

IIsFtpdr.vbs is used to create, delete, or query and FTP virtual directory or directory.This tool uses WMI. It can be run remotely on any machine that supports WMI, but it must be passed the name of a server running IIS 6.0 or later.
(applies to IIS 6.0)  

IIsVdir.vbs is used to create, delete, or query and Web virtual directory or directory.This tool uses WMI. It can be run remotely on any machine that supports WMI, but it must be passed the name of a server running IIS 6.0 or later.
(applies to IIS 6.0) 

IIsWeb.vbs is used to stop, start, pause, delete, or query the Web service, or create a Web site.This tool uses WMI. It can be run remotely on any machine that supports WMI, but it must be passed the name of a server running IIS 6.0 or later.
(applies to IIS 6.0) 

I finally stopped the website with the following command: cscript.exe iisweb.vbs /stop Probe (where Probe is the name of my website to stop).

I thing though is that although the scripts are located in the %SYSTEMROOT%\SYSTEM32 folder, the script did not work outside of this folder. So go into system32 or specify the complete path to the vbs script in the cscript command.

Do your Web Parts need to access internet sites using a proxy?

I discovered today how to configure your web applications to use a proxy server for accessing internet sites. I had not thought about this until I deployed a site with a web part that retrieves information from the internet such as weather information, stock information, etc.

If you are facing the same issue, then your answer lies in the web.config file the Web Application that requires internet access.

You need to edit the web.config file and at the bottom of the file replace:

      <proxy autoDetect=”true” />


    <proxy usesystemdefault=”False” proxyaddress=”http://myproxyserver:8080″ bypassonlocal=”True” />

Now save the file and you’re good to go !

Simple trick this time, but it is still good to know. [8-|]

Determine which Site template was used to create a site collection

Received this question today from one of my colleagues and I knew that you could find out this information by accessing the dbo.Webs table in the Content Database of the site collection, but I was sure that there would be a better way to find this out. So I dug a little around the net and found a comment on a blog having a good solution:

This wa a comment posted by Rafelo (

You can determine the site definition / template used to create the site, via the WebTemplate and WebTemplateID properties of the SPWeb object (via the API). If you dont feel comfortable coding something or simply dont know how there is a fantastic tool from Carsten Keutman called SharePoint Manager which exposes most of the SharePoint API for you (download also here). It’s a desktop application that you run on one of the SharePoint servers on the farm. Alternatively you could save the following code as an aspx page to your layouts folder (\program files\common files\microsoft shared\web server extensions\12\template\layouts):


Code Snippet

<%@ Assembly Name=”Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c”%>
<%@ Page Language=”C#” MasterPageFile=”~/_layouts/application.master” Inherits=”Microsoft.SharePoint.WebControls.LayoutsPageBase” %>
<%@ Import Namespace=”Microsoft.SharePoint” %>

<script runat=”server”>
    protected override void OnLoad(EventArgs e){
                using (SPWeb thisWeb = this.Web)
                    lblWebTemplate.Text = thisWeb.WebTemplate;
                    lblWebTemplateID.Text = thisWeb.WebTemplateId.ToString();
<asp:Content ID=”Main” runat=”server” contentplaceholderid=”PlaceHolderMain” >
    Web Template: <asp:Label ID=”lblWebTemplate” runat=”server” />
    Web Template ID: <asp:Label ID=”lblWebTemplateID” runat=”server” />

<asp:Content ID=”PageTitle” runat=”server” contentplaceholderid=”PlaceHolderPageTitle” >
  Site Template Information

<asp:Content ID=”PageTitleInTitleArea” runat=”server” contentplaceholderid=”PlaceHolderPageTitleInTitleArea” >
  Site Template Information



Once you have saved the page, you can access it via http://yourwebaddress/yoursite/_layouts/pagename.aspx

The page should look something like this:

You can find a reference to these identifiers in one of my previous posts:

My advise to all of you now is to create this aspx page using notepad and save it to all your frontends. This way even your site collection admins can find out the template name. Another advise would be to include a table on this page with the reference to the identifiers as well.