启动Sharepoint相关的服务 start.ps1
# Scripts written by Emmanuel Bergerat (emberger@microsoft.com) on Oct. 20th 2009
# Start local SQL Services
"Starting Local SQL Services"
"MSSQL`$SHAREPOINT","SQLWriter","SQLAgent`$SHAREPOINT" | 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"
" "
停止Sharepoint相关的服务 stop.ps1
# Scripts written by Emmanuel Bergerat (emberger@microsoft.com) on Oct. 20th 2009
# 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 }
"=> IIS is STOPPED"
" "
# 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 local SQL Services
"Stopping Local SQL Services"
"MSSQL`$SHAREPOINT","SQLWriter","SQLAgent`$SHAREPOINT" | 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相关的服务 config.ps1
# Scripts written by Emmanuel Bergerat (emberger@microsoft.com) on Oct. 20th 2009
"Setting all SharePoint 2010 related services to Manual Startup:"
# SQL Services set to Manual Startup
"MSSQL`$SHAREPOINT","SQLWriter","SQLAgent`$SHAREPOINT" | 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"