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