Random Musings of Jeremy Jameson

Script to Restart SharePoint Services

Since my previous post introduced one of my SharePoint Toolbox scripts, I thought I should share another one that is more applicable to a broader audience.

As I've noted in the past, memory leaks are certainly not uncommon in the world of SharePoint. Consequently, you may want to periodically simulate a reboot of your development environment in order to free up memory and get back to being productive. Trust me, simulating a reboot is much, much faster than actually rebooting.

To do this, I created the following script and dropped it in my SharePoint Toolbox folder (\NotBackedUp\Public\Toolbox\SharePoint\Scripts\Restart SharePoint Services.cmd):

@echo off

@echo Stopping services...

iisreset /stop /noforce

net stop "Windows SharePoint Services Timer"

net stop "Windows SharePoint Services Administration"

net stop "Office SharePoint Server Search"

net stop "Windows SharePoint Services Search"

net stop "Windows SharePoint Services Tracing"

@pause

@echo Starting services...

net start "Windows SharePoint Services Tracing"

net start "Windows SharePoint Services Search"

net start "Office SharePoint Server Search"

net start "Windows SharePoint Services Administration"

net start "Windows SharePoint Services Timer"

iisreset /start

@pause

Note that I use a pause statement so that I can optionally perform other tasks while SharePoint is stopped (e.g. detach a content database, move it to a different disk, and then reattach it).

Published Thursday, March 26, 2009 7:33 AM by Jeremy Jameson
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Leave a Comment

(required) 
(optional)
(required) 

  
Enter Code Here: Required
Submit

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker