Stop and Go with SharePoint 2010 on your workstation


Hi,


As many of you learned, you can now setup SharePoint 2010 on a development workstation. It’s not supported for production, but for development, learning and demo that definitely rocks! As you may imagine, I tried this up and really have fun with it since (especially with Office Web Applications).


SharePoint 2010 on your workstation!


There’s few things to have in mind before setting this up:



  1. You need a x64 OS (with everything that comes with it) – mine is Windows 7 Ultimate (heard that Vista SP2 x64 should be OK also)

  2. You need 4 GB of RAM (under this you’re dead – your machine will be … to be precise)

  3. You’ll get the limitations of a “more or less” standalone setup. Especially if your machine is an AD DS Domain member. So bye, bye many users, services accounts, etc. But that definitely worth it, so no big deal here

  4. many others things that Matthew Burnett described in his SharePoint Conference SPC 3998 session named “SharePoint isn’t just for Servers anymore”. You’ll also find those information in the SDK once published (which is a question of hours or days now)

For those attending this session, you heard Matt talking about few other guys helping him on Windows PowerShell scripts. I’m part of them (it also includes Paul Andrew).


To live happy with SharePoint on my day-to-day workstation, I created 3 Windows PowerShell scripts to:



  1. Set the SharePoint 2010 related default services “Startup type” as I wanted (i.e. “Manual”) – used once.

  2. Start those Services when SharePoint 2010 is needed

  3. Stop those same Services when SharePoint 2010 is not needed anymore

So, here they are:


Modify the Startup type for SharePoint related services


In my case, I setup independently the SQL server (which must be x64), so my instance name is “MSSQLSERVER”, and here is the script:



# SharePoint 2010 Workstation START up type modification script
#
# Scripts written by Emmanuel Bergerat (emberger@microsoft.com) on Oct. 20th 2009
# Provided as is, and can be freely modified and distributed
# Enjoy!
#
 
“Setting all SharePoint 2010 related services to Manual Startup:”
# SQL Services set to Manual Startup
“MSSQLSERVER”,“SQLWriter”,“SQLSERVERAGENT” | ForEach-Object {
    Set-Service $_ -startuptype manual}
    ”  – SQL Services set to Manual StartUp”
 
# IIS Service to Manual Startup
    Set-Service “W3SVC” -startuptype manual
    ”  – IIS Service set to Manual StartUp”
 
# SharePoint services set to Manual Startup
“SPTimerV4”,“DCLoadBalancer14”,“DCLauncher14”,“SPWriterV4”,“SPUserCodeV4”,“SPTraceV4”,“SPAdminV4”,“WebAnalyticsService” | ForEach-Object {
    Set-Service $_ -startuptype manual}
    ”  – SharePoint Services set to Manual StartUp”
 
# SharePoint Search set to Manual Startup
“OSearch14”, “SPSearch4”| ForEach-Object {
    Set-Service $_ -startuptype manual}
    ”  – SharePoint Search set to Manual StartUp”
” “
“All SharePoint 2010 related services are now set to Manual Startup”



Start SharePoint 2010



# SharePoint 2010 Local Dev Workstation Services START script
#
# Scripts written by Emmanuel Bergerat (emberger@microsoft.com) on  Nov. 24th 2009
# Provided as is, and can be freely modified and distributed
# Enjoy!
#
 
# Start local SQL Services
“Starting Local SQL Services”
“MSSQLSERVER”,“SQLWriter”,“SQLSERVERAGENT” | ForEach-Object {
    $servicePrior = get-service $_
    “$_ is “ + $servicePrior.status + ” and will be Started”
    Start-Service $_
    $serviceAfter = get-service $_
    “$_ is now “ + $serviceAfter.status }
“=> Local SQL Services Started”
” “
 
# Start IIS
“Starting IIS”
“W3SVC” | ForEach-Object {
    $servicePrior = get-service $_
    “$_ is “ + $servicePrior.status + ” and will be Started”
    Start-Service $_
    $serviceAfter = get-service $_
    “$_ is now “ + $serviceAfter.status }
“=> IIS is Started”
” “
 
# Start SharePoint 2010 Services
“Starting SharePoint Server 2010”
“SPTimerV4”,“DCLoadBalancer14”,“DCLauncher14”,“SPWriterV4”,“SPUserCodeV4”,“SPTraceV4”,“SPAdminV4”,“WebAnalyticsService” | ForEach-Object {
    $servicePrior = get-service $_
    “$_ is “ + $servicePrior.status + ” and will be Started”
    Start-Service $_
    $serviceAfter = get-service $_
    “$_ is now “ + $serviceAfter.status }
“=> SharePoint Server 2010 is Started”
” “
 
# Start SharePoint Search
“Starting SharePoint Search 2010”
“OSearch14”,“SPSearch4” | ForEach-Object {
    $servicePrior = get-service $_
    “$_ is “ + $servicePrior.status + ” and will be Started”
    Start-Service $_
    $serviceAfter = get-service $_
    “$_ is now “ + $serviceAfter.status }
“=> SharePoint Search 2010 is Started”
” “
“Warming up local SharePoint WebApplications”
$snapin = Get-PSSnapin | Where-Object { $_.Name -like “Microsoft.SharePoint.PowerShell”}
if ([bool]$snapin) {} else {Add-PsSnapin Microsoft.SharePoint.PowerShell}
function Warmup-Site([string]$url)
{
    $wc = New-Object net.WebClient
    $wc.credentials = [System.Net.CredentialCache]::DefaultCredentials;
    return $wc.DownloadString($url)
}
Get-SPWebApplication -IncludeCentralAdministration | Get-SPSite | ForEach-Object { Write-Host “Warming up site:” $_.Url ; $html = Warmup-Site -url $_.Url}
“=> Local SharePoint sites warmed up”
” “
“=> SharePoint 2010 is started on this workstation… Do you still have free RAM? 🙂 <=” 

 

Stop SharePoint 2010




# SharePoint 2010 Local Dev Workstation Services STOP script
#
# Scripts written by Emmanuel Bergerat (emberger@microsoft.com) on Nov. 24th 2009
# Provided as is, and can be freely modified and distributed
# Enjoy!
#
 
# Stop SharePoint Search
“Stopping SharePoint Search 2010”
“OSearch14”,“SPSearch4” | ForEach-Object {
    $servicePrior = get-service $_
    “$_ is “ + $servicePrior.status  + ” and will be stopped”
    Stop-Service $_ -Force
    $serviceAfter = get-service $_
    “$_ is now “ + $serviceAfter.status }
“=> SharePoint Search 2010 is STOPPED”
” “
# Stop SharePoint 2010 Services
“Stopping SharePoint Server 2010”
“SPTimerV4”,“DCLoadBalancer14”,“DCLauncher14”,“SPWriterV4”,“SPUserCodeV4”,“SPTraceV4”,“SPAdminV4”,“WebAnalyticsService” | ForEach-Object {
    $servicePrior = get-service $_
    “$_ is “ + $servicePrior.status  + ” and will be stopped”
    Stop-Service $_ -Force
    $serviceAfter = get-service $_
    “$_ is now “ + $serviceAfter.status }
“=> SharePoint Server 2010 is STOPPED”
” “
# Stop IIS
“Stopping IIS”
“W3SVC” | ForEach-Object {
    $servicePrior = get-service $_
    “$_ is “ + $servicePrior.status  + ” and will be stopped”
    Stop-Service $_ -Force
    $serviceAfter = get-service $_
    “$_ is now “ + $serviceAfter.status }
iisreset
“=> IIS is STOPPED”
” “
# Stop local SQL Services
“Stopping Local SQL Services”
“MSSQLSERVER”,“SQLWriter”,“SQLSERVERAGENT” | ForEach-Object {
    $servicePrior = get-service $_
    “$_ is “ + $servicePrior.status  + ” and will be stopped”
    Stop-Service $_ -Force
    $serviceAfter = get-service $_
    “$_ is now “ + $serviceAfter.status }
“=> Local SQL Services STOPPED”
” “
“=> SharePoint 2010 is STOPPED on this workstation… you can use it now… with more RAM 😉 <=”



2 shortcuts on your desktop, and you’re all set


I packed them up in a ZIP file attached to this post.


Adapt, enjoy, improve … any feedbacks are welcome,


< Emmanuel />


Note: I released a newer version on Nov 24th that includes: Warm-up scripts in the START script, and IISRESET in the STOP script (as I was informed it releases more RAM).

Sp2010 Scripts for Local DevWorkstation.zip


Comments (10)

  1. mortenbpost says:

    Hey Emmanuel,

    Very cool script. Is it safe to add the services:

    Forefront Identity Manager Service

    Forefront Identity Manager Synchronization Service

    Since I guess they’re part of the deployment as well?

  2. I’ve created a utility to easily start and stop the services. Download it from http://sharepointserviceman.codeplex.com/

  3. Tim says:

    seems to me that an old school BAT file works just as well, and is much shorter…

    net start iisadmin

    net start w3svc

    net start smtpsvc

    net start spadminV4

    net start sptimerV4

    net start sptraceV4

    net start SPUserCodeV4

    net start SPSearch4

    net start OSearch14

  4. Christoffer says:

    thanks for this! I was just about to create them myself.

  5. Danny says:

    Is it normal for the start script to generate errors? I get some errors of services unable to restart.

    Do I run PS from windows PS of Sharepoint PS

  6. Andy Ogden says:

    Merill's utility is just fine, except it isn't possible to change the services it wants to control.  It also picked up my MSDE instance that I use for my local instance of Navision, and I can't stop it from managing the service, therefore making it useless.

    http://www.aoweb.co.uk

  7. GiUmaTo says:

    Hi. Thanks for the scripts, quite useful, I'm using them on every SharePoint dev session!!

    I'm not an expert of powershell workings, but I managed to remove from each list the services that did not exist in my environment. In order to do this I modified in the same way both the start and stop scripts.

    My question: is there a way to put the definition of one of those list in a separate script/ function/ library/ text file and then get that centralized definition in order to feed the 'ForEach-Object' statement?

  8. GiUmaTo says:

    Nevermind. Found it by trial and error. Thanks again!

  9. PlateSpinner says:

    Thanks a lot for this. The only thing I added was adding "ReportServer" to the list of database services to modify, start, and stop so that it could include SQL Server Reporting Services.

    -PlateSpinner

  10. Darlan Batista says:

    If you are using SQL Server Express, you need to change the service name to something like 'MSSQL$SHAREPOINT', and make sure you are using the single quotes ('), otherwise PowerShell will understand $SHAREPOINT as a variable.

    In the end, the script works great. Tank you Emmanuel.