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).
There’s few things to have in mind before setting this up:
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:
So, here they are:
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"
# 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 {
" - SharePoint Services set to Manual StartUp"
# SharePoint Search set to Manual Startup
"OSearch14", "SPSearch4"| ForEach-Object {
" - SharePoint Search set to Manual StartUp"
" "
"All SharePoint 2010 related services are now set to Manual Startup"
# 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? :-) <="
# SharePoint 2010 Local Dev Workstation Services START script
# Scripts written by Emmanuel Bergerat (emberger@microsoft.com) on Nov. 24th 2009
# Start local SQL Services
"Starting Local SQL Services"
$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 {
"=> IIS is Started"
# Start SharePoint 2010 Services
"Starting SharePoint Server 2010"
"=> SharePoint Server 2010 is Started"
# Start SharePoint Search
"Starting SharePoint Search 2010"
"OSearch14","SPSearch4" | ForEach-Object {
"=> 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? :-) <="
# 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 ;-) <="
# SharePoint 2010 Local Dev Workstation Services STOP script
# Stop SharePoint Search
"Stopping SharePoint Search 2010"
"$_ is " + $servicePrior.status + " and will be stopped"
Stop-Service $_ -Force
"=> SharePoint Search 2010 is STOPPED"
# Stop SharePoint 2010 Services
"Stopping SharePoint Server 2010"
"=> SharePoint Server 2010 is STOPPED"
# Stop IIS
"Stopping IIS"
iisreset
"=> IIS is STOPPED"
# Stop local SQL Services
"Stopping Local SQL Services"
"=> 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).
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?
I've created a utility to easily start and stop the services. Download it from http://sharepointserviceman.codeplex.com/
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
thanks for this! I was just about to create them myself.
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
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
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?
Nevermind. Found it by trial and error. Thanks again!
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
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.