Start-up and Tear-down SharePoint scripts

As part of my daily SharePoint activities I typically will be starting and stopping my locally installed instance of  SharePoint a number of times on my development laptop throughout the day. I’m lucky enough to have a Dell M6500 with 8 cores and 16GB RAM (running Windows 7) but even so, when I’m running VMware and have my full 6 server development farm running I need all the RAM I can get.

Start-up

To help me quickly start-up my local SharePoint I use the following script:

color 2f
Echo Starting SharePoint + other services…

sc stop WSearch

sc start IISADMIN
sc start W3SVC

sc start SQLWriter
sc start SQLBrowser
sc start MSSQLSERVER
sc start MSSQLServerOLAPService
sc start MSOLAP$POWERPIVOT
sc start ReportServer

sc start SPAdminV4
sc start SPTimerV4
sc start SPTraceV4
sc start SPSearch4
sc start OSearch14

sc start WebAnalyticsService
sc start hMailServer

Echo Set Service Start Options to manual

sc config IISADMIN start= demand
sc config W3SVC start= demand
sc config WebAnalyticsService start= demand
sc config SQLBrowser start= demand
sc config MSSQLSERVER start= demand
sc config MSSQLServerOLAPService start= demand
sc config MSOLAP$POWERPIVOT start= demand
sc config ReportServer start= demand
sc config SQLWriter start= demand
sc config SPAdminV4 start= demand
sc config SPTraceV4 start= demand
sc config SPTimerV4 start= demand
sc config OSearch14 start= demand
sc config SPSearch4 start= demand
sc config hMailServer start= demand

Echo Set Service Start Options to disabled

sc config SPUserCodeV4 start= disabled
sc config SPWriterV4 start= disabled
sc config DCLauncher14 start= disabled
sc config DCLoadBalancer14 start= disabled

Echo Starting IIS

iisreset /start

Echo Starting other apps

start /d "C:\Program Files (x86)\Sans" /min sans.exe

Echo Launching browser

start "C:\Users\Brian\AppData\Local\Google\Chrome\Application\chrome.exe" http://bc01

Echo Starting powershell scripts

powershell -File "C:\Documents\SharePoint\Demo\Create Local Users\Update Status.ps1"

Echo SharePoint is ready for duty!

honk.exe "C:\documents\sharepoint\sharepointpodshowtheme.wav"

You’ll notice this does a few things, but I think the important one to highlight are (apart from starting SharePoint) it sets all the required and dependant services start-up option to be ‘manual’. This ensure that once I’ve rebooted my machine, SQL and SharePoint remain stopped until I need them. Additionally, as I’m demonstrating with SharePoint a fair amount it will call my random user profile update PowerShell script to simulate some activity into the user activity feeds, more details of this script can be found here: https://sharepintblog.com/2011/07/01/randomly-update-user-profiles-from-powershell-what-the-heck/

Finally, once my SharePoint is started and warmed up, the script plays the awesome theme to the SharePoint Pod Show courtesy of Rob Foster (http://www.robfoster.net/) to let me know I’m ready to roll. If you haven’t discovered the SharePoint Pod Show check out http://www.sharepointpodshow.com/ for some great content. Someone really needs to start a Facebook campaign to save the theme tune for this show as there are rumours it might be changed – sacrilege!

Tear-down

Following a similar pattern is my tear-down script which should be fairly self explanatory:

color 4f

powershell -File "C:\Documents\SharePoint\Demo\Create Local Users\Update Status.ps1"

Echo Stopping the services…

sc stop SPAdminV4
sc stop SPTimerV4
sc stop SPTraceV4
sc stop SPSearch4
sc stop OSearch14
sc stop WebAnalyticsService

sc stop ReportServer
sc stop MSOLAP$POWERPIVOT
sc stop MSSQLServerOLAPService
sc stop SQLBrowser
REM sc stop MsDtsServer100
sc stop MsDtsServer110
sc stop SQLSERVERAGENT
sc stop MSSQLSERVER
sc stop SQLBrowser
sc stop SQLWriter
sc stop W3SVC
sc stop IISADMIN
sc stop hMailServer
sc stop SQLBrowser

Echo Set Service Start Options to manual

sc config IISADMIN start= demand
sc config W3SVC start= demand
sc config WebAnalyticsService start= demand
sc config SQLBrowser start= demand
REM sc config MsDtsServer100 start= demand
sc config MsDtsServer110 start= demand
sc config SQLWriter start= demand
sc config SQLBrowser start= demand
sc config SQLSERVERAGENT start= demand
sc config MSSQLSERVER start= demand
sc config MSSQLServerOLAPService start= demand
sc config MSOLAP$POWERPIVOT start= demand
sc config ReportServer start= demand
sc config SQLWriter start= demand
sc config SPAdminV4 start= demand
sc config SPTraceV4 start= demand
sc config SPTimerV4 start= demand
sc config SPSearch4 start= demand
sc config OSearch14 start= demand
sc config hMailServer start= demand

Echo Set Service Start Options to manual

sc config SPUserCodeV4 start= disabled
sc config SPWriterV4 start= disabled
sc config DCLauncher14 start= disabled
sc config DCLoadBalancer14 start= disabled

tskill sans /A

tskill dw20 /A
tskill iTunesHelper /A
tskill groove /A
tskill onenotem /A
tskill smax4pnp /A
tskill wfcrun32 /A
tskill msosync /A
tskill concentr /A
tskill SPPSVC /A
tskill c2wts /A
tskill c2WTShost /A

iisreset /stop

Enjoy!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: