MOSS 2007 Warmup Script for SharePoint Demos & Presentations

Joel Oleson shared MOSS 2007 warm-up scripts to compile SharePoint pages & warm-up admin interfaces for demos/presentations.

Last week Joel Oleson blogged about the warm-up scripts you’ll find on the MOSS 2007 Beta 2 Tech Resource DVD. These scripts essentially force a JIT compilation of all pages in a SharePoint site and run STSADM.EXE to warm up the admin interfaces. These are invaluable, especially to people doing presentations or demons on SharePoint. I immediately modified them for my standard SharePoint virtual machine and made sure they run on startup, as well as added a shortcut to the Quick Launch toolbar so I can quickly fire them off when I switch from slides to demo. For more info on the scripts, check out Joel’s post:

In addition to these scripts, I thought I’d post three other “tricks” I like to add to all my SharePoint virtual machines. All of the following tricks are things that will help SharePoint developers. Hopefully you’ll get as much use out of these as I do!

All tips are written for WSS v3 (and MOSS 2007)… they will work for WSS v2 (and SPS 2003), but you’ll need to modify them a bit.

Tip #1: Add Command Line Shortcut to “12 Hive”

I’m not talking about creating a shortcut to the 12 Hive (the directory where just about everything WSS v3 is installed) on your desktop/Quick Launch. Like most people, I create a “12” toolbar on my Start Menu (as shown in the image to the right)… not talking about that either.

When you’re in a command prompt, sometimes you need to navigate to the 12 Hive directory. But no one wants to type the directory path to c:\Program Files\Common Files\Microsoft Shared\web server extensions\12. Wouldn’t it be easier if you could just type the following to get there?

c:\> cd\
c:\> cd %12hive%
c:\Program Files\Common Files\Microsoft Shared\web server extensions\12

I’d sure say it is! The other thing is I almost always want to be within a Visual Studio Command Prompt to have easy access to things like SN.EXE and GACUTIL.EXE. A VS Command Prompt is nothing more than a simple batch file. I’ve created my own batch file that executes the VS Command Prompt batch file and sets the %12HIVE% variable to the 12 Hive directory. Here’s how:

  1. Create a new file called SharePointCommandPrompt.cmd and insert the following text in it (if you’re on a 64 bit system, you’ll want to make the appropriate changes):

    @echo offecho Setting 12HIVE environment variable.
    set 12HIVE="C:\Program Files\Common Files\Microsoft Shared\web server extensions\12"
        "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat" x86
  2. After saving the file, create a new shortcut with the following target:

    %comspec% /k "c:\[Path To The File You Just Created\]\SharePointCommandPrompt.cmd"
  3. To put a cherry on top, drag the shortcut onto your Quick Launch toolbar… should work like a champ!

To try it out, click the shortcut and type CD %12HIVE% at the command prompt. You should change directories to the root of the 12 Hive.

Use the new shortcut

Use the new shortcut

Tip #2: Access STSADM.EXE From any Directory in a Command Prompt

STSADM.EXE, the main administration utility for SharePoint, is still just a command line utility. You’ll find it in %12HIVE%\BIN. To run it, you have to actually be in that directory… an inconvenience to me! Instead, add the directory to the PATH environment variable so you can type STSADM.EXE from any directory on your system. To do this:

  1. Start > All Programs > Control Panel > System

  2. On the Advanced tab, click the Environment Variables button.

  3. Select the variable Path and click the Edit button.

  4. Add the following to the end of the Variable value field (don’t forget the semicolon… the Path environment variable is a semicolon delimited string of directories):

    ;C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
  5. OK out of all the dialogs.

Next time your system restarts, you’ll be able to type STSADM.EXE at a command prompt from any directory on your system.

Tip #3: Recycle Application Pools, not IIS

(_I got this tip from my colleague Todd Bleeker)_So many things in SharePoint require you to recycle the the W3WP.EXE process running SharePoint in order for certain changes to be picked up. So many people think this means recycling IIS by typing IISRESET. But it takes so long for IIS to recycle!

Did you know you don’t have to recycle IIS most of the time, just the application pool your site is running within? Yup! For development purposes, I run all my SharePoint sites off the same app pool. I know, not the most secure, but each app pool consumes roughly 100MB of memory so why have a ton of them floating around in a virtual machine when memory is precious!

Instead of recycling IIS, I create a shortcut that I add to my Quick Launch that recycles the app pool all my sites run under. To do this, create a new shortcut on your desktop and enter the following target:

%windir%\system32\cscript.exe c:\windows\system32\iisapp.vbs /a "\[Name of your App Pool\]" /r

Then drag the shortcut onto your Quick Launch toolbar. Click it and watch how fast an app pool is recycled compared to IIS!

Andrew Connell
Developer & Chief Course Artisan, Voitanos LLC. | Microsoft MVP
Written by Andrew Connell

Andrew Connell is a web & cloud developer with a focus on Microsoft Azure & Microsoft 365. He’s received Microsoft’s MVP award every year since 2005 and has helped thousands of developers through the various courses he’s authored & taught. Andrew’s the founder of Voitanos and is dedicated to helping you be the best Microsoft 365 web & cloud developer. He lives with his wife & two kids in Florida.

Share & Comment