Archive for June, 2012

Here is a Cool Script to Create and Provision a new Search Service Application in SharePoint 2010 using PowerShell.  If you split the roles between servers, you can put (example : $querysever = ” WFE1″

Here is the script.  If you have any questions, do not hesitate. Say thanks if it helped 🙂
$ErrorActionPreference = “Stop”

Add-PSSnapin Microsoft.SharePoint.PowerShell -EA 0

function ConfigureSharePointSearch(
    [Microsoft.SharePoint.Administration.SPIisWebServiceApplicationPool] $appPool,
    [System.Management.Automation.PSCredential] $crawlCredentials,    
    [string] $serviceAppName = “Search Service Application”,
    [string] $searchDatabaseName = “SearchService”,
    [string] $searchServer = $env:COMPUTERNAME,
    [string] $adminServer = $env:COMPUTERNAME,
    [string] $crawlServer = $env:COMPUTERNAME,
    [string] $queryServer = $env:COMPUTERNAME)
{
    Write-Host “Configuring SharePoint Search…”

    Write-Host “appPool: $appPool”
    Write-Host “crawlCredentials: $($crawlCredentials.Username)”
    Write-Host “serviceAppName: $serviceAppName”
    Write-Host “searchDatabaseName: $searchDatabaseName”
    Write-Host “searchServer: $searchServer”
    Write-Host “adminServer: $adminServer”
    Write-Host “crawlServer: $crawlServer”
    Write-Host “queryServer: $queryServer”

    If ($appPool -eq $null)
    {
        Throw “The application pool must be specified.”
    }
    ElseIf ($crawlCredentials -eq $null)
    {
        Throw “The crawl credentials must be specified.”
    }

    Write-Host “Creating $serviceAppName…”
    
    $searchApp = New-SPEnterpriseSearchServiceApplication -Name $serviceAppName
        -ApplicationPool $appPool -DatabaseName $searchDatabaseName -Debug:$false

    Write-Host ("Starting the SharePoint Search Service instance and Search Admin"
        + ” component…”)
        
    $adminSearchInstance = Get-SPEnterpriseSearchServiceInstance -Debug:$false |
        Where { $_.Server -match $adminServer }
        
    $admin = $searchApp |
        Get-SPEnterpriseSearchAdministrationComponent -Debug:$false

    if($adminSearchInstance.Status -ne “Online”)
    {
        Write-Host “Provisioning SharePoint Search Service instance…”
        $adminSearchInstance.Provision()
        Start-Sleep 10
    }

    $admin | Set-SPEnterpriseSearchAdministrationComponent
        -SearchServiceInstance $adminSearchInstance -Debug:$false

    $admin = ($searchApp | Get-SPEnterpriseSearchAdministrationComponent
        -Debug:$false)

    Write-Host -NoNewLine “Waiting for Search Admin component to initialize…”
    
    While (-not $admin.Initialized) 
    {
        Write-Host -NoNewLine “.”
        Start-Sleep -Seconds 5
        $admin = $searchApp |
            Get-SPEnterpriseSearchAdministrationComponent -Debug:$false
    }
        
    Write-Host
    
    Write-Host “Setting the default content access account…”
    $searchApp | Set-SPEnterpriseSearchServiceApplication
        -DefaultContentAccessAccountName $crawlCredentials.Username
        -DefaultContentAccessAccountPassword $crawlCredentials.Password
        -Debug:$false

    Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance $adminServer
        -Debug:$falseservice

    
    Write-Host “Getting initial topologies…”
    $initialCrawlTopology = $searchApp |
        Get-SPEnterpriseSearchCrawlTopology -Debug:$false
        
    $initialQueryTopology = $searchApp |
        Get-SPEnterpriseSearchQueryTopology -Debug:$false


    Write-Host “Creating new crawl topology…”
    $crawlTopology = $searchApp |
        New-SPEnterpriseSearchCrawlTopology -Debug:$false
        
    $crawlDatabase = Get-SPEnterpriseSearchCrawlDatabase
        -SearchApplication $searchApp -Debug:$false

  
    Write-Host "Populating new crawl topology..."
    $crawlInstance = Get-SPEnterpriseSearchServiceInstance -Debug:$false |
        Where { $_.Server -match $crawlServer }
        
    $crawlComponent = New-SPEnterpriseSearchCrawlComponent
        -CrawlTopology $crawlTopology -CrawlDatabase $crawlDatabase
        -SearchServiceInstance $crawlInstance -Debug:$false


    Write-Host "Activating new crawl topology..."
    $crawlTopology | Set-SPEnterpriseSearchCrawlTopology -Active -Debug:$false

    $initialCrawlTopology.CancelActivate()
    
    Write-Host -NoNewLine "Waiting for initial crawl topology to be inactive..."
    
    Do
    {
        Start-Sleep 5
        Write-Host -NoNewLine "."
    } While ($initialCrawlTopology.State -ne "Inactive")
            
    Write-Host


    Write-Host "Creating new query topology..."
    $queryTopology = $searchApp |
        New-SPEnterpriseSearchQueryTopology -Partitions 1 -Debug:$false

    Write-Host "Creating Property Store database..."
    $propertyDatabase = Get-SPEnterpriseSearchPropertyDatabase
        -SearchApplication $searchApp -Debug:$false


    Write-Host “Setting index partition to use Property Store database…”
    $indexPartition = Get-SPEnterpriseSearchIndexPartition
        -QueryTopology $queryTopology -Debug:$false
        
    $indexPartition | Set-SPEnterpriseSearchIndexPartition
        -PropertyDatabase $propertyDatabase -Debug:$false


    Write-Host “Populating new query topology….”
    $queryInstance = Get-SPEnterpriseSearchServiceInstance -Debug:$false |
        Where { $_.Server -match $queryServer }
    
    $queryComponent = New-SPEnterpriseSearchQueryComponent
        -QueryTopology $queryTopology -IndexPartition $indexPartition
        -SearchServiceInstance $queryInstance -Debug:$false


    Write-Host “Activating new query topology…”
    $QueryTopology | Set-SPEnterpriseSearchQueryTopology -Active -Debug:$false

    Write-Host -NoNewLine “Waiting for initial query topology to be inactive…”
    
    Do
    {
        Start-Sleep 5
        Write-Host -NoNewLine “.”
    } While ($initialQueryTopology.State -ne “Inactive”)

    Write-Host


    Write-Host “Removing initial topologies…”
    $initialCrawlTopology |
        Remove-SPEnterpriseSearchCrawlTopology -Confirm:$false -Debug:$false
        
    $initialQueryTopology |
        Remove-SPEnterpriseSearchQueryTopology -Confirm:$false -Debug:$false


    Write-Host “Creating service application proxy…”
    $searchProxy = New-SPEnterpriseSearchServiceApplicationProxy
        -Name "$serviceAppName" -SearchApplication $searchApp -Debug:$false

    Write-Host -Fore Green "Successfully configured SharePoint Search."
}

function GetServiceAppsAppPool(
    [string] $appPoolName,
    [string] $appPoolUserName)
{
    Write-Debug "Trying to get existing service application pool ($appPoolName)..."
    $appPool = Get-SPServiceApplicationPool $appPoolName -Debug:$false -EA 0

    If ($appPool -ne $null)
    {
        Write-Debug "The service application pool ($appPoolName) already exists."
        return $appPool
    }
    
    Write-Host "Creating service application pool ($appPoolName)..."

    Write-Debug "Get service account for application pool ($appPoolUserName)..."
    $appPoolAccount = Get-SPManagedAccount -Identity $appPoolUserName
        -Debug:$false -EA 0

    If($appPoolAccount -eq $null)
    {
        Write-Host “Registering managed account ($appPoolUserName)…”

        Write-Debug “Get credential ($appPoolUserName)…”
        $appPoolCredential = Get-Credential $appPoolUserName

        $appPoolAccount =
            New-SPManagedAccount -Credential $appPoolCredential -Debug:$false
    } 

    If ($appPoolAccount -eq $null)
    {
        Write-Host -Force Red (“Unable to find or create the managed account”
            + " ($appPoolUserName).")

        Exit 1
    }

    $appPool = New-SPServiceApplicationPool -Name $appPoolName
        -Account $appPoolAccount -Debug:$false

    Write-Host -Fore Green (“Successfully created service application pool”
        + " ($appPoolName).")
    
    return $appPool
}


function ValidateCredentials(
    $credentials)
{
    Write-Debug "Validating credentials ($($credentials.UserName))..."

    $password = [Runtime.InteropServices.Marshal]::PtrToStringAuto(
        [Runtime.InteropServices.Marshal]::SecureStringToBSTR(
            $credentials.Password))
    
    $currentDomain = "LDAP://" + ([ADSI]"").distinguishedName

    $domain = New-Object DirectoryServices.DirectoryEntry(
        $currentDomain,
        $credentials.UserName,
        $password)
    
    trap { $script:err = $_ ; continue } &{
        $domain.Bind($true); $script:err = $null }

    if ($err.Exception.ErrorCode -ne -2147352570)
    {
        Write-Host -Fore Red $err.Exception.Message
        Exit 1
    }
    
    Write-Debug "Successfully validated credentials ($($credentials.UserName))."
}

function Main()
{
    $searchServer = $env:COMPUTERNAME
    $adminServer = $searchServer
    $crawlServer = $searchServer
    $queryServer = $searchServer
    $serviceAppsAppPoolName = "SharePoint Service Applications"
    $serviceAppsAppPoolUserName = $env:USERDOMAIN + "sppool"
    $serviceAppName = "Search Service Application"
    $searchDatabaseName = ""
    $crawlServiceAccount = $env:USERDOMAIN + "spcrawl"


    Write-Host ("Please enter the password for the default content access account"
        + ” ($crawlServiceAccount)…”)
        
    $crawlCredentials = Get-Credential $crawlServiceAccount
    ValidateCredentials $crawlCredentials

    $appPool = GetServiceAppsAppPool $serviceAppsAppPoolName
        $serviceAppsAppPoolUserName
        
    ConfigureSharePointSearch $appPool $crawlCredentials $serviceAppName
        $searchDatabaseName $searchServer $adminServer $crawlServer $queryServer

}

Main
No ratings yet.

Please rate this

How to fix the error :  The SharePoint service failed to start due to the following error:  The service did not start due to a logon failure 

This happens when your service accounts don’t have enough permissions on the local computer.

To fix this error you have to go in the Local Security Policy of the Computer.

Local Security Policy > Local Policies > User Rights Assignment>Logon as a Service.

Open it and add your Service accounts inside. Afterwards, restart your server and all SharePoint services should start.

In some other cases, near the “Logon as a service” you might see this kind of icon:

This means that the policy is managed by GPO. You have to edit the GPO and add your SharePoint service accounts inside. Afterwards, restart your server and all SharePoint services should start.

Here are the steps to modify the Group Policy. Source Technet

  1. Click Start, point to Run, type mmc, and then click OK.

  2. On the File menu, click Add/Remove Snap-in.

  3. In Add/Remove Snap-in, click Add, and then, in Add Standalone Snap-in, double-click Group Policy Object Editor.

  4. In Group Policy Object, click Browse, browse to the Group Policy object (GPO) that you want to modify, click OK, and then click Finish.

  5. Click Close, and then click OK.

  6. In the console tree, click User Rights Assignment.

Where?

·         GroupPolicyObject [ComputerName] Policy

·         Computer Configuration

·         Windows Settings

·         Security Settings 

·         Local Policies

·         User Rights Assignment

  1. In the details pane, double-click Log on as a service.

  2. If the security setting has not yet been defined, select the Define these policy settings check box.

  3. Click Add User or Group, and then add the appropriate account to the list of accounts that possess the Log on as a service right.

Say Thanks if it helped 🙂

No ratings yet.

Please rate this

In case you need to enable features in SharePoint 2010 and  you don’t want to spend a lot of time looking for the GUID, here are all the Sharepoint Features, names and GUID’s.

Here is how you enable them:

$mainurl = “http://vlad.test.loc”

 

Write-Host -ForegroundColor White ” – Enabling SharePoint Server Publishing Infrastructure   …” -NoNewline

Enable-SPFeature –identity “PublishingSite” -URL $mainurl

Write-Host -ForegroundColor GREEN “Done.”

 

Write-Host

DisplayName

Title

ID

Scope

AccSrvApplication

$Resources:AccsrvWss

1cc4b32c-299b-41aa-9770-67715ea05f25

Farm

AccSrvMSysAso

Access Services System Objects

29ea7495-fca1-4dc6-8ac1-500c247a036e

Web

AccSrvRestrictedList

Access Services Restricted List Definition

a4d4ee2c-a6cb-4191-ab0a-21bb5bde92fb

Web

AccSrvShell

$Resources:AccsrvWss

bcf89eb7-bca1-4468-bdb4-ca27f61a2292

Web

AccSrvSolutionGallery

$Resources:AccsrvWss

744b5fd3-3b09-4da6-9bd1-de18315b045d

Site

AccSrvSolutionGalleryStapler

$Resources:AccsrvWss

d5ff2d2c-8571-4c3c-87bc-779111979811

Farm

AccSrvUserTemplate

$Resources:AccsrvWss

1a8251a0-47ab-453d-95d4-07d7ca4f8166

Web

AccSrvUSysAppLog

Access Services User Application Log

28101b19-b896-44f4-9264-db028f307a62

Web

AddDashboard

Add Dashboard

d250636f-0a26-4019-8425-a5232d592c09

Web

AdminLinks

Central Administration Links

fead7313-ae6d-45dd-8260-13b563cb4c71

Web

AdminReportCore

Administrative Reporting Infrastructure

b8f36433-367d-49f3-ae11-f7d76b51d251

Site

AdminReportCorePushdown

Administrative Reporting Core Pushdown Feature

55312854-855b-4088-b09d-c5efe0fbf9d2

Farm

AnnouncementsList

Announcements Lists

00bfea71-d1ce-42de-9c63-a44004ce0104

Web

AssetLibrary

Asset Library

4bcccd62-dcaf-46dc-a7d4-e38277ef33f4

Site

BaseSite

SharePoint Server Standard Site Collection features

b21b090c-c796-4b0f-ac0f-7ef1659c20ae

Site

BaseSiteStapling

Base Site Features Stapling

97a2485f-ef4b-401f-9167-fa4fe177c6f6

Farm

BaseWeb

SharePoint Server Standard Site features

99fe402e-89a0-45aa-9163-85342e865dc8

Web

BaseWebApplication

SharePoint Server Standard Web application features

4f56f9fa-51a0-420c-b707-63ecbb494db1

WebApplication

BasicWebParts

Basic Web Parts

00bfea71-1c5e-4a24-b310-ba51c3eb7a57

Site

BDR

Document Center Enhancements

3f59333f-4ce1-406d-8a97-9ecb0ff0337f

Web

BICenterDashboardsLib

Dashboards Library

f979e4dc-1852-4f26-ab92-d1b2a190afc9

Web

BICenterDataconnectionsLib

DataConnections Library for PerformancePoint

26676156-91a0-49f7-87aa-37b1d5f0c4d0

Web

BICenterSampleData

Business Intelligence center sample data

3992d4ab-fa9e-4791-9158-5ee32178e88a

Web

BizAppsCTypes

SharePoint Portal Server Business Appications Content Type Definition

43f41342-1a37-4372-8ca0-b44d881e4434

Site

BizAppsFields

SPS Biz Apps Field Definition

5a979115-6b71-45a5-9881-cdc872051a69

Site

BizAppsListTemplates

SharePoint Portal Server Status Indicator List template

065c78be-5231-477e-a972-14177cc5b3c7

Web

BizAppsSiteTemplates

BizApps Site Templates

4248e21f-a816-4c88-8cab-79d82201da7b

Site

BulkWorkflow

Bulk workflow process button

aeef8777-70c0-429f-8a13-f12db47a6d47

Farm

BulkWorkflowTimerJob

Bulk Workflow Timer Job

d992aeca-3802-483a-ab40-6c9376300b61

WebApplication

CallTrackList

Phone Call Memo List

239650e3-ee0b-44a0-a22a-48292402b8d8

Web

CirculationList

Circulation List

a568770a-50ba-4052-ab48-37d8029b3f47

Web

ContactsList

Contacts Lists

00bfea71-7e6d-4186-9ba8-c047ac750105

Web

ContentLightup

Standard User Interface Items

0f121a23-c6bc-400f-87e4-e6bbddf6916d

Farm

ContentTypeHub

Content Type Syndication Hub

9a447926-5937-44cb-857a-d3829301c73b

Site

ContentTypePublish

Content type publishing

dd903064-c9d8-4718-b4e7-8ab9bd039fff

Web

ContentTypeSettings

Standard Content Type Settings Links

fead7313-4b9e-4632-80a2-ff00a2d83297

Farm

ContentTypeSyndication

Content type syndication

34339dc9-dec4-4256-b44a-b30ff2991a64

WebApplication

CTypes

Standard Content Type Definitions

695b6570-a48b-4a8e-8ea5-26ea7fc1d162

Site

CustomList

Custom Lists

00bfea71-de22-43b2-a848-c05709900100

Web

DataConnectionLibrary

Data Connections Feature

00bfea71-dbd7-4f72-b8cb-da7ac0440130

Web

DataConnectionLibraryStapling

Data Connection Library

cdfa39c6-6413-4508-bccf-bf30368472b3

Farm

DataSourceLibrary

Data Source Libraries

00bfea71-f381-423d-b9d1-da7a54c50110

Web

DeploymentLinks

Content Deployment

ca2543e6-29a1-40c1-bba9-bd8510a4c17b

Web

DiscussionsList

Discussion Lists

00bfea71-6a49-43fa-b535-d15c05500108

Web

DMContentTypeSettings

DM Content Type Setting Links

1ec2c859-e9cb-4d79-9b2b-ea8df09ede22

Farm

DocId

Document ID Service

b50e3104-6812-424f-a011-cc90e6327318

Site

DocumentLibrary

Document Libraries

00bfea71-e717-4e80-aa17-d0c71b360101

Web

DocumentManagement

Document Sets metadata synchronization

3a4ce811-6fe0-4e97-a6ae-675470282cf2

WebApplication

DocumentRouting

Content Organizer

7ad5272a-2694-4349-953e-ea5ef290e97c

Web

DocumentRoutingResources

Document Routing Resources

0c8a9a47-22a9-4798-82f1-00e62a96006e

Site

DocumentSet

Document Sets

3bae86a2-776d-499d-9db8-fa4cdc7884f8

Site

DownloadFromOfficeDotCom

Office.com Entry Points from SharePoint

a140a1ac-e757-465d-94d4-2ca25ab2c662

Farm

EMailRouting

E-mail Integration with Content Organizer

d44a1358-e800-47e8-8180-adf2d0f77543

Web

EnhancedHtmlEditing

Enhanced Html Editing

81ebc0d6-8fb2-4e3f-b2f8-062640037398

Farm

EnhancedTheming

Enhanced Theming

068bc832-4951-11dc-8314-0800200c9a66

Site

EnterpriseWiki

Enterprise Wiki

76d688ad-c16e-4cec-9b71-7b7f0d79b9cd

Web

EnterpriseWikiLayouts

Enterprise Wiki Layouts

a942a218-fa43-4d11-9d85-c01e3e3a37cb

Site

EventsList

Events Lists

00bfea71-ec85-4903-972d-ebe475780106

Web

ExcelServer

Excel Services Farm Feature

e4e6a041-bc5b-45cb-beab-885a27079f74

Farm

ExcelServerSite

Excel Services Site Feature

3cb475e7-4e87-45eb-a1f3-db96ad7cf313

Site

ExcelServerWebApplication

e15ed6d2-4af1-4361-89d3-2acf8cd485de

WebApplication

ExcelServerWebPart

Excel Services Site Feature

4c42ab64-55af-4c7c-986a-ac216a6e0c0e

Site

ExcelServerWebPartStapler

Excel Services Farm Feature

c6ac73de-1936-47a4-bdff-19a6fc3ba490

Farm

ExpirationWorkflow

Disposition Approval Workflow

c85e5759-f323-4efb-b548-443d2216efb5

Site

ExternalList

External Lists

00bfea71-9549-43f8-b978-e47e54a10600

Web

FacilityList

Resources List

58160a6b-4396-4d6e-867c-65381fb5fbc9

Web

FastFarmFeatureActivation

FAST Search for SharePoint Master Job Provisioning

d2d98dc8-c7e9-46ec-80a5-b38f039c16be

Farm

FCGroupsList

Manage Resources

08386d3d-7cc0-486b-a730-3b4cfe1b5509

Web

FeaturePushdown

Feature Pushdown Links

0125140f-7123-4657-b70a-db9aa1f209e5

Farm

Fields

Standard Column Definitions

ca7bd552-10b1-4563-85b9-5ed1d39c962a

Site

GanttTasksList

Gantt Chart Tasks Lists

00bfea71-513d-4ca0-96c2-6a47775c0119

Web

GBWProvision

Group Work Provisioning

6e8a2add-ed09-4592-978e-8fa71e6f117c

Web

GBWWebParts

GroupBoardWebParts

3d25bd73-7cd4-4425-b8fb-8899977f73de

Web

GlobalWebParts

Global Web Parts

319d8f70-eb3a-4b44-9c79-2087a87799d6

Farm

GridList

Grid Lists

00bfea71-3a1d-41d3-a0ee-651d11570120

Web

GroupWork

Group Work Lists

9c03e124-eef7-4dc6-b5eb-86ccd207cb87

Web

HelpLibrary

Help

071de60d-4b02-4076-b001-b456e93146fe

Site

Hold

Hold and eDiscovery

9e56487c-795a-4077-9425-54a1ecb84282

Web

HolidaysList

Holidays List

9ad4c2d4-443b-4a94-8534-49a23f20ba3c

Web

IMEDicList

Microsoft IME Dictionary List

1c6a572c-1b58-49ab-b5db-75caf50692e6

Web

InPlaceRecords

In Place Records Management

da2e115b-07e4-49d9-bb2c-35e93bb9fca9

Site

ipfsAdminLinks

Admin Links for InfoPath Forms Services.

a10b6aa4-135d-4598-88d1-8d4ff5691d13

Farm

IPFSAdminWeb

Admin Links for InfoPath Forms Services.

750b8e49-5213-4816-9fa2-082900c0201a

Web

IPFSSiteFeatures

InfoPath Forms Services support

c88c4ff1-dbf5-4649-ad9f-c6c426ebcbf5

Site

IPFSTenantFormsConfig

InfoPath Forms Services Tenant Administration

15845762-4ec4-4606-8993-1c0512a98680

Web

IPFSTenantWebProxyConfig

InfoPath Forms Services Web Service Proxy Administration

3c577815-7658-4d4f-a347-cfbb370700a7

Web

IPFSWebFeatures

InfoPath Forms Services support

a0e5a010-1329-49d4-9e09-f280cdbed37d

Web

IssuesList

Issues Lists

00bfea71-5932-4f9c-ad71-1557e5751100

Web

IssueTrackingWorkflow

Three-state workflow

fde5d850-671e-4143-950a-87b473922dc7

Site

LegacyDocumentLibrary

Document Libraries

6e53dd27-98f2-4ae5-85a0-e9a8ef4aa6df

Web

LegacyWorkflows

SharePoint 2007 Workflows

c845ed8d-9ce5-448c-bd3e-ea71350ce45b

Site

LinksList

Links Lists

00bfea71-2062-426c-90bf-714c59600103

Web

ListTargeting

List Content Targeting

fc33ba3b-7919-4d7e-b791-c6aeccf8f851

Farm

LocalSiteDirectoryControl

SharePoint Portal Server Local Site Directory Capture Control

14aafd3a-fcb9-4bb7-9ad7-d8e36b663bbd

Site

LocalSiteDirectoryMetaData

Local Site Directory MetaData Capture Feature

8f15b342-80b1-4508-8641-0751e2b55ca6

Web

LocalSiteDirectorySettingsLink

Site Settings Link to Local Site Directory Settings page.

e978b1a6-8de7-49d0-8600-09a250354e14

Site

LocationBasedPolicy

Library and Folder Based Retention

063c26fa-3ccc-4180-8a84-b6f98e991df3

Site

ManageUserProfileServiceApplication

Manage Profile Service Application

c59dbaa9-fa01-495d-aaa3-3c02cc2ee8ff

Farm

MasterSiteDirectoryControl

SharePoint Portal Server Master Site Directory Capture Control

8a663fe0-9d9c-45c7-8297-66365ad50427

Farm

MetaDataNav

Metadata Navigation and Filtering

7201d6a4-a5d3-49a1-8c19-19c4bac6e668

Web

MobileEwaFarm

$Resources:xlsrv

5a020a4f-c449-4a65-b07d-f2cc2d8778dd

Farm

MobileExcelWebAccess

Excel Mobile Viewer Feature

e995e28b-9ba8-4668-9933-cf5c146d7a9f

Site

MobilityRedirect

Mobility Shortcut URL

f41cc668-37e5-4743-b4a8-74d1db3fd8a4

Web

MossChart

Chart Web Part

875d1044-c0cf-4244-8865-d2a0039c2a49

Site

MpsWebParts

Meetings Workspaces Web Parts

39dd29fb-b6f5-4697-b526-4d38de4893e5

Web

MySite

My Site

69cc9662-d373-47fc-9449-f18d11ff732c

Farm

MySiteBlog

My Site Blogs

863da2ac-3873-4930-8498-752886210911

Site

MySiteCleanup

My Site Cleanup Feature

0faf7d1b-95b1-4053-b4e2-19fd5c9bbc88

Farm

MySiteHost

My Site Host

49571cd1-b6a1-43a3-bf75-955acc79c8d8

Site

MySiteHostPictureLibrary

Shared Picture Library for Organizations logos

5ede0a86-c772-4f1d-a120-72e734b3400c

Web

MySiteLayouts

My Site Layouts Feature

6928b0e5-5707-46a1-ae16-d6e52522d52b

Site

MySiteNavigation

My Site Navigation

6adff05c-d581-4c05-a6b9-920f15ec6fd9

Web

MySitePersonalSite

My Site Personal Site Configuration

f661430e-c155-438e-a7c6-c68648f1b119

Site

MySiteQuickLaunch

My Site Layouts Feature

034947cc-c424-47cd-a8d1-6014f0e36925

Web

Navigation

Portal Navigation

89e0306d-453b-4ec5-8d68-42067cdbf98e

Site

NavigationProperties

Portal Navigation Properties

541f5f57-c847-4e16-b59a-b31e90e6f9ea

Web

NoCodeWorkflowLibrary

No-code Workflow Libraries

00bfea71-f600-43f6-a895-40c0de7b0117

Web

ObaProfilePages

BDC Profile Pages Feature

683df0c0-20b7-4852-87a3-378945158fab

Web

ObaProfilePagesTenantStapling

BDC Profile Pages Tenant Stapling Feature

90c6c1e5-3719-4c52-9f36-34a97df596f7

Farm

ObaSimpleSolution

Offline Synchronization for External Lists

d250636f-0a26-4019-8425-a5232d592c01

Web

ObaStaple

Offline Synchronization for External Lists

f9cb1a2a-d285-465a-a160-7e3e95af1fdd

Farm

OffWFCommon

Microsoft Office Server workflows

c9c9515d-e4e2-4001-9050-74f980f93160

Site

OpenInClient

Open documents in client applications

8a4b8de2-6fd8-41e9-923c-c7c3c00f8295

Site

OrganizationsClaimHierarchyProvider

Organizations Claim Hierarchy Provider

9b0293a7-8942-46b0-8b78-49d29a9edd53

Farm

OSearchBasicFeature

Office Server Site Search

bc29e863-ae07-4674-bd83-2c6d0aa5623f

WebApplication

OSearchCentralAdminLinks

Search Central Admin Links

c922c106-7d0a-4377-a668-7f13d52cb80f

Farm

OSearchEnhancedFeature

Office Server Enterprise Search

4750c984-7721-4feb-be61-c660c6190d43

WebApplication

OSearchHealthReports

$Resources:HealthReportsFeatureTitle;

e792e296-5d7f-47c7-9dfa-52eae2104c3b

Site

OSearchHealthReportsPushdown

Health Reports Pushdown Feature

09fe98f3-3324-4747-97e5-916a28a0c6c0

Farm

OSearchPortalAdminLinks

Search Admin Portal Links and Navbar

edf48246-e4ee-4638-9eed-ef3d0aee7597

Farm

OsrvLinks

Shared Services Administration Links

068f8656-bea6-4d60-a5fa-7f077f8f5c20

Web

OssNavigation

Shared Services Navigation

10bdac29-a21a-47d9-9dff-90c7cae1301e

Web

OSSSearchSearchCenterUrlFeature

Search Center URL

7acfcb9d-8e8f-4979-af7e-8aed7e95245e

Web

OSSSearchSearchCenterUrlSiteFeature

Site collection level Search Center Url Feature

7ac8cc56-d28e-41f5-ad04-d95109eb987a

Site

PageConverters

Document to Page Converters

14173c38-5e2d-4887-8134-60f9df889bad

WebApplication

PersonalizationSite

Personalization Site

ed5e77f7-c7b1-4961-a659-0de93080fa36

Web

PictureLibrary

Picture Libraries

00bfea71-52d4-45b3-b544-b1c71b620109

Web

PortalLayouts

Portal Layouts Feature

5f3b0127-2f1d-4cfd-8dd2-85ad1fb00bfc

Site

PPSDatasourceLib

PerformancePoint Data Source Library Template

5d220570-df17-405e-b42d-994237d60ebf

Web

PPSMonDatasourceCtype

PerformancePoint Datasource Content Type definition

05891451-f0c4-4d4e-81b1-0dabd840bad4

Site

PPSSiteCollectionMaster

PerformancePoint Services Site Collection Features

a1cb5b7f-e5e9-421b-915f-bf519b0760ef

Site

PPSSiteMaster

PerformancePoint Services Site Features

0b07a7f4-8bb8-4ec0-a31b-115732b9584d

Web

PPSSiteStapling

PPS Site Stapling

8472208f-5a01-4683-8119-3cea50bea072

Farm

PPSWebParts

PerformancePoint Monitoring

ee9dbf20-1758-401e-a169-7db0a6bbccb2

Site

PPSWorkspaceCtype

PerformancePoint Content Type Definition

f45834c7-54f6-48db-b7e4-a35fa470fc9b

Site

PPSWorkspaceList

PerformancePoint Content List

481333e1-a246-4d89-afab-d18c6fe344ce

Web

PremiumSite

SharePoint Server Enterprise Site Collection features

8581a8a7-cf16-4770-ac54-260265ddb0b2

Site

PremiumSiteStapling

Premium Site Features Stapling

a573867a-37ca-49dc-86b0-7d033a7ed2c8

Farm

PremiumWeb

SharePoint Server Enterprise Site features

0806d127-06e6-447a-980e-2e90b03101b8

Web

PremiumWebApplication

SharePoint Server Enterprise Web application features

0ea1c3b6-6ac0-44aa-9f3f-05e8dbe6d70b

WebApplication

ProfileSynch

Profile Synchronization Feature

af847aa9-beb6-41d4-8306-78e41af9ce25

Farm

Publishing

Publishing

22a9ef51-737b-4ff2-9346-694633fe4416

Web

PublishingLayouts

Page Layouts and Master Pages Pack

d3f51be2-38a8-4e44-ba84-940d35be1566

Site

PublishingPrerequisites

Publishing Prerequisites

a392da98-270b-4e85-9769-04c0fde267aa

Site

PublishingResources

Publishing Resources

aebc918d-b20f-4a11-a1db-9ed84d79c87e

Site

PublishingSite

SharePoint Server Publishing Infrastructure

f6924d36-2fa8-4f0b-b16d-06b7250180fa

Site

PublishingStapling

Publishing Features Stapling

001f4bd7-746d-403b-aa09-a6cc43de7942

Farm

PublishingTimerJobs

Publishing Timer Jobs

20477d83-8bdb-414e-964b-080637f7d99b

WebApplication

PublishingWeb

SharePoint Server Publishing

94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb

Web

Ratings

Ratings

915c240e-a6cc-49b8-8b2c-0bff8b553ed3

Site

RecordResources

Record Resources

5bccb9a4-b903-4fd1-8620-b795fa33c9ba

Site

RecordsCenter

Records Center Configuration

e0a45587-1069-46bd-bf05-8c8db8620b08

Web

RecordsManagement

Records Management

6d127338-5e7d-4391-8f62-a11e43b1d404

Farm

RedirectPageContentTypeBinding

SharePoint Portal Server Redirect Page Content Type Binding Feature

306936fd-9806-4478-80d1-7e397bfa6474

Web

RelatedLinksScopeSettingsLink

Related Links scope settings page

e8734bb6-be8e-48a1-b036-5a40ff0b8a81

Web

ReportCenterSampleData

Report Center Sample Data

c5d947d6-b0a2-4e07-9929-8e54f5a9fff9

Web

Reporting

Reporting

7094bd89-2cfe-490a-8c7e-fbace37b4a34

Site

ReportListTemplate

SharePoint Portal Server Report Library

2510d73f-7109-4ccc-8a1c-314894deeb3a

Web

ReviewPublishingSPD

Publishing Approval Workflow

a44d2aa3-affc-4d58-8db4-f4a3af053188

Site

ReviewPublishingSPD1033

Publishing Workflow – SharePoint 2010 (en-US)

19f5f68e-1b92-4a02-b04d-61810ead0409

Site

ReviewWorkflows

Routing Workflows

02464c6a-9d07-4f30-ba04-e9035cf54392

Site

ReviewWorkflowsSPD

Routing Workflows – SharePoint 2010

b5934f65-a844-4e67-82e5-92f66aafe912

Site

ReviewWorkflowsSPD1033

Routing Workflows – SharePoint 2010 (en-US)

3bc0c1e1-b7d5-4e82-afd7-9f7e59b60409

Site

ScheduleList

Schedule and Reservations List

636287a7-7f62-4a6e-9fcc-081f4672cbf8

Web

SearchAdminWebParts

Microsoft Search Administration Web Parts

c65861fa-b025-4634-ab26-22a23e49808f

Web

SearchAndProcess

Search And Process

1dbf6063-d809-45ea-9203-d3ba4a64f86d

WebApplication

SearchExtensions

Search extensions

5eac763d-fbf5-4d6f-a76b-eded7dd7b0a5

Site

SearchServerWizardFeature

$Resources:SearchServerWizard_Feature_Title;

e09cefae-2ada-4a1d-aee6-8a8398215905

Site

SearchWebParts

Search Server Web Parts

eaf6a128-0482-4f71-9a2f-b1c650680e77

Site

SharedServices

Shared Services Infrastructure

f324259d-393d-4305-aa48-36e8d9a7a0d6

Farm

SignaturesWorkflow

Collect Signatures Workflow

6c09612b-46af-4b2f-8dfc-59185c962a29

Site

SignaturesWorkflowSPD

Collect Signatures Workflow – SharePoint 2010

c4773de6-ba70-4583-b751-2a7b1dc67e3a

Site

SignaturesWorkflowSPD1033

Collect Signatures Workflow – SharePoint 2010 (en-US)

a42f749f-8633-48b7-9b22-403b40190409

Site

SiteHelp

Custom Site Collection Help

57ff23fc-ec05-4dd8-b7ed-d93faa7c795d

Site

SiteSettings

Standard Site Settings Links

fead7313-4b9e-4632-80a2-98a2a2d83297

Farm

SitesList

Sites List creation feature

a311bf68-c990-4da3-89b3-88989a3d7721

Web

SkuUpgradeLinks

Sku Upgrade Links

937f97e9-d7b4-473d-af17-b03951b2c66b

Farm

SlideLibrary

Slide Library

0be49fe9-9bc9-409d-abf9-702753bd878d

Web

SlideLibraryActivation

Slide Library Activation

65d96c6b-649a-4169-bf1d-b96505c60375

Farm

SocialRibbonControl

Social Tags and Note Board Ribbon Controls

756d8a58-4e24-4288-b981-65dc93f9c4e5

Farm

SpellChecking

Spell Checking

612d671e-f53d-4701-96da-c3a4ee00fdc5

Farm

SPSDisco

Portal DiscoPage Feature

713a65a1-2bc7-4e62-9446-1d0b56a8bf7f

Farm

SPSearchFeature

Microsoft SharePoint Foundation Search feature

2ac1da39-c101-475c-8601-122bc36e3d67

WebApplication

SRPProfileAdmin

User Profile Administration Links

c43a587e-195b-4d29-aba8-ebb22b48eb1a

Farm

SSSvcAdmin

Secure Store Service Admin

35f680d4-b0de-4818-8373-ee0fca092526

Web

StapledWorkflows

Office Workflows

ee21b29b-b0d0-42c6-baff-c97fd91786e6

Farm

SurveysList

Surveys Lists

00bfea71-eb8a-40b1-80c7-506be7590102

Web

TasksList

Tasks Lists

00bfea71-a83e-497e-9ba0-7a5c597d0107

Web

TaxonomyFeatureStapler

Taxonomy feature stapler

415780bf-f710-4e2c-b7b0-b463c7992ef0

Farm

TaxonomyFieldAdded

Register taxonomy site wide field added event receiver

73ef14b1-13a9-416b-a9b5-ececa2b0604c

Site

TaxonomyTenantAdmin

Taxonomy Tenant Administration

7d12c4c3-2321-42e8-8fb6-5295a849ed08

Web

TaxonomyTenantAdminStapler

Taxonomy Tenant Administration Stapler

8fb893d6-93ee-4763-a046-54f9e640368d

Farm

TaxonomyTimerJobs

Create the taxonomy timer jobs

48ac883d-e32e-4fd6-8499-3408add91b53

WebApplication

TeamCollab

Team Collaboration Lists

00bfea71-4ea5-48d4-a4ad-7ea5c011abe5

Web

TemplateDiscovery

Connect to Office Ribbon Controls

ff48f7e6-2fa1-428d-9a15-ab154762043d

Farm

TenantAdminBDC

Tenant Business Data Connectivity Administration

0a0b2e8f-e48e-4367-923b-33bb86c1b398

Web

TenantAdminBDCStapling

Tenant Business Data Connectivity Administration Stapling

b5d169c9-12db-4084-b68d-eef9273bd898

Farm

TenantAdminDeploymentLinks

Tenant Administration Content Deployment Configuration

99f380b4-e1aa-4db0-92a4-32b15e35b317

Web

TenantAdminLinks

Tenant Administration Links

98311581-29c5-40e8-9347-bd5732f0cb3e

Web

TenantAdminSecureStore

$Resources:obacore

b738400a-f08a-443d-96fa-a852d0356bba

Web

TenantAdminSecureStoreStapling

Secure Store Service Stapling Feature

6361e2a8-3bc4-4ca4-abbb-3dfbb727acd7

Farm

TenantProfileAdmin

Tenant User Profile Application

32ff5455-8967-469a-b486-f8eaf0d902f9

Web

TenantProfileAdminStapling

Tenant User Profile Application Stapling

3d4ea296-0b35-4a08-b2bf-f0a8cabd1d7f

Farm

TimeCardList

Time Card List

d5191a77-fa2d-4801-9baf-9f4205c9e9d2

Web

TranslationWorkflow

Translation Management Workflow

c6561405-ea03-40a9-a57f-f25472942a22

Site

TransMgmtFunc

Translation Management Library

82e2ea42-39e2-4b27-8631-ed54c1cfc491

Farm

TransMgmtLib

Translation Management Library

29d85c25-170c-4df9-a641-12db0b9d4130

Web

UpgradeOnlyFile

$Resources:UpgradeOnlyFile_Feature_Title;

2fa4db13-4109-4a1d-b47c-c7991d4cc934

Web

UserMigrator

Shared Service Provider User Migrator

f0deabbb-b0f6-46ba-8e16-ff3b44461aeb

Farm

V2VPublishedLinks

V2V Published Links Upgrade

f63b7696-9afc-4e51-9dfd-3111015e9a60

Site

V2VPublishingLayouts

V2V Publishing Layouts Upgrade

2fbbe552-72ac-11dc-8314-0800200c9a66

Site

ViewFormPagesLockDown

Restrict Limited Access Permissions

7c637b23-06c4-472d-9a9a-7c175762c5c4

Site

VisioProcessRepository

Visio Process Repository

7e0aabee-b92b-4368-8742-21ab16453d01

Web

VisioProcessRepositoryFeatureStapling

Visio Process Repository

7e0aabee-b92b-4368-8742-21ab16453d00

Farm

VisioProcessRepositoryUs

Visio Process Repository

7e0aabee-b92b-4368-8742-21ab16453d02

Web

VisioServer

Visio Web Access

5fe8e789-d1b7-44b3-b634-419c531cfdca

Farm

VisioWebAccess

Visio Web Access

9fec40ea-a949-407d-be09-6cba26470a0c

Site

WACentralAdminCustomReports

Web Analytics Central Admin Customize Reports

3ce24023-95a1-4778-85b0-8e9b2bcacc80

Site

WACentralAdminReports

Web Analytics Central Admin Reports

786eaa5b-85d7-4ea0-8998-0b62c8befd94

Site

WACustomReports

Web Analytics Customize Reports functionality

af6d9aec-7c38-4dda-997f-cc1ddbb87c92

Site

WAEnterpriseFeatureStapler

Web Analytics Enterprise Feature Stapler

c0c2628d-0f59-4873-9cba-100dad2313cb

Farm

WAFeatureStapler

Web Analytics Feature Stapler

9d46d0d4-af7b-4f2e-8f84-9466ab25766c

Farm

WAMaster

Advanced Web Analytics

c04234f4-13b8-4462-9108-b4f5159beae6

Site

WAReports

Advanced Web Analytics Reports

2acf27a5-f703-4277-9f5d-24d70110b18b

Site

WAWhatsPopularWebPart

Web Analytics Web Part

8e947bf0-fe40-4dff-be3d-a8b88112ade6

Site

WebPageLibrary

Wiki Page Library

00bfea71-c796-4402-9f2f-0eb9a6e71b18

Web

WebPartAdderGroups

Web Part Adder default groups

2ed1c45e-a73b-4779-ae81-1524e4de467a

Site

WhatsNewList

What’s New List

d7670c9c-1c29-4f44-8691-584001968a74

Web

WhereaboutsList

$Resources:core

9c2ef9dc-f733-432e-be1c-2e79957ea27b

Web

WikiPageHomePage

Wiki Page Home Page

00bfea71-d8fe-4fec-8dad-01c19a6e4053

Web

WikiWelcome

WikiWelcome

8c6a6980-c3d9-440e-944c-77f93bc65a7e

Web

WorkflowHistoryList

Workflow History Lists

00bfea71-4ea5-48d4-a4ad-305cf7030140

Web

workflowProcessList

WorkflowProcessList Feature

00bfea71-2d77-4a75-9fca-76516689e21a

Web

Workflows

Workflows

0af5989a-3aea-4519-8ab0-85d91abe39ff

Site

XmlFormLibrary

XML Form Libraries

00bfea71-1e1d-4562-b56a-f05371bb0115

Web

No ratings yet.

Please rate this

If you are getting this error either in PowerShell or with the User Interface  :
New-SpManagedAccount : The given key was not present in the dictionary


In order to fix this problem, you have to go in the Active Directory and give the “Authenticated Users”   Read Permissions on the account (See image, it will be a lot more clear)

If you don’t see the “Security” Tab, make sure you have “Advanced Features” Available on your Active Directory. ([View]> Advanced Features)
Say thanks if this post helped :). 
No ratings yet.

Please rate this

This is a really tricky error I had when trying to deploy a Sand-boxed Solution using PowerShell on a new farm.  The error “Install-SPUserSolution : Sandboxed code execution request failed.”  happened with PowerShell, and with the GUI.

I looked in the ULS log and found this:
Sandboxed code execution request failed. – Inner Exception: System.InvalidOperationException    Server stack trace:      at Microsoft.SharePoint.Utilities.Verify.DoFailTag(UInt32 tag, ULSCat category, Type type, String format, Object[] args)     at Microsoft.SharePoint.Utilities.Verify.IsTrueTag(UInt32 tag, ULSCat category, Boolean expression, Type type, String format, Object[] args)     at Microsoft.SharePoint.UserCode.SPUserCodeExecutionHost.Execute(Type userCodeWrapperType, Guid siteCollectionId, SPUserToken userToken, String affinity, SPUserCodeExecutionContext executionContext)     at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)     at System.Runti… 28b119be-321a-42d6-892a-b7ddcf358e74

With no results on Google on how to fix this issues I tried a lot of things without ever being able to replicate it on another machine.
What I found is that there was another related error  :  (You can also check fix for this specific error here)
Unable to load assembly group. The user assembly group provider threw an exception while trying to provide user assemblies for the specified assembly group.

The Fix:

I added the Service Account running the Sandbox Service with Full Control rights on the Web Application (User Policy) and it worked. 

I deleted the Web Application and re-ran the script (without re-adding the Full Control rights) and it worked no problem.  

Say thanks if this helped 🙂
No ratings yet.

Please rate this

On my first install of SharePoint 2010 with SQL 2012 I encountered this error when running the configuration wizard :   Could not find stored procedure ‘sp_dboption’.

The reason is that SQL 2012 only works with SharePoint 2010 Service Pack 1 or higher.  So, in order to avoid this problem, slipstream Sp1 in your SharePoint 2010 install.

Or if you already installed SharePoint 2010 without Sp1 and you are having this error right now, just download Service Pack 1 and install it before running the configuration wizard.

No ratings yet.

Please rate this

Here is a list of the SharePoint Templates that come included with SharePoint Server 2010.

If you want to Create a new Site Collection or Site with them you just have to use one of the following commands.

If you want to deploy a site with a custom template, check out my post here 

$newsiteurl  = “http://vlad.test.loc”
$web = New-SPWeb  $newsiteurl  -Template “OFFILE#1”


Site Definition

Site Template ID

Team Site

STS#0

Blank Site

STS#1

Document Workspace

STS#2

Blog

BLOG#0

Group Work Site

SGS#0

Visio Process Repository

VISPRUS#0

Basic Meeting Workspace

MPS#0

Blank Meeting Workspace

MPS#1

Decision Meeting Workspace

MPS#2

Social Meeting Workspace

MPS#3

Multipage Meeting Workspace

MPS#4

Assets Web Database

ACCSRV#1

Charitable Contributions Web Database

ACCSRV#3

Contacts Web Database

ACCSRV#41

Issues Web Database

ACCSRV#6

Projects Web Database

ACCSRV#5

Document Center

BDR#0

Records Center

OFFILE#1

Business Intelligence Center

BICenterSite#0

My Site Host

SPSMSITEHOST#0

Personalization Site

SPSMSITE#0

Enterprise Search Center

SRCHCEN#0

Basic Search Center

SRCHCENTERLITE#0

FAST Search Center

SRCHCENTERFAST#0

Enterprise Wiki

ENTERWIKI#0

Publishing Portal

BLANKINTERNETCONTAINER#0

Publishing Site

CMSPUBLISHING#0

1/5 (1)

Please rate this

When you create a SharePoint site, it comes with the orange logo icon.   You can easily change it by using Powershell and an image that’s already on the site.  Here is how:

Original Logo:

The PowerShell Code:
     
$mainurl = “http://vlad.test.loc”

$Web = Get-SpWeb $mainurl

Write-Host -ForegroundColor White ” – Changing the logo of sites …” -NoNewline

$sitename= $mainurl

$sitelogo= $mainurl + “/PublishingImages/powershell.jpg”

$site=new-object Microsoft.SharePoint.SPSite($sitename)

foreach($web in $site.Allwebs) {

$web.SiteLogoUrl=$sitelogo

$web.Update()

}

$site.Dispose()

 Write-Host -ForegroundColor GREEN “Done.”

  Write-Host

Result :

It also changed the logo of the my  Record Center Subsite. 
No ratings yet.

Please rate this

Here is how to Create a Record Center Sub Site , and add a Content Organizer rule to it.

First, We need to Create the Subsite.  The Template “OFFILE#1” is the Template for Record Center.  You can find all Sharepoint Templates here.

$mainURL = “http://vlad.test.loc”

$RecordCenterURL = “http://vlad.test.loc/RecordCenter“

$web = New-SPWeb $RecordCenterURL -Template “OFFILE#1”   -AddToTopNav

Now, here is the chunk of code to Create the Content Organizer Rule.

Write-Host -ForegroundColor White ” – Creating the Supporting Documents  Content Organizer Rule …” -NoNewline

 [Microsoft.SharePoint.SPSite]$site = Get-SPSite $mainurl

[Microsoft.SharePoint.SPWeb]$web = Get-SPWeb $RecordCenterURL

[Microsoft.SharePoint.SPContentType]$ct = $site.RootWeb.ContentTypes[“Document”]

[Microsoft.Office.RecordsManagement.RecordsRepository.EcmDocumentRouterRule]$rule = New-Object Microsoft.Office.RecordsManagement.RecordsRepository.EcmDocumentRouterRule($web)

$rule.ConditionsString = “

$rule.CustomRouter = “”

$rule.Name = “Supporting Documents Rule”

$rule.Description = “Routes ‘” + $ct.Name + “‘ documents to the records library”

$rule.ContentTypeString = $ct.Name

$rule.RouteToExternalLocation = $false

$rule.Priority = “5”

$rule.TargetPath = “/Records/Records”

$rule.Enabled = $true

$rule.Update()

Write-Host -ForegroundColor GREEN “Done.”

Write-Host

As you can see, this rule routes the Content Type “Document” to the /Records/Records Library. 

No ratings yet.

Please rate this

I recently had to work on a project where I had to deploy a Site Collection, with the root web using a Custom Template.  It sounds easy to do with the GUI, “Select Template Later”, than you choose your template and that’s it.  If you want to script it, it’s trickier (until you do it the first time ).

Here is how you create a new site using a custom .wsp template with PowerShell.

We Create the Site Collection.  Note that we do not put the –template parameter as we do not want it to have a template.

         $mainurl = “http://vlad.test.loc/sites/customtemplate”

         Write-Host -ForegroundColor White ” – Creating Site Collection  $mainurl…” -NoNewline

         New-SPSite $mainurl -OwnerAlias locadministrator  -Name “This will have a custom template”

         Write-Host -ForegroundColor GREEN “Done.”

         Write-Host

Afterwards, we have to add our WSP to the Solution Gallery in the Site Collection.  I have a Do While loop to make sure that the solution has been uploaded successfully before activating it.

              Write-Host -ForegroundColor White ” – Adding and Installing Your Custom Template…” –NoNewline]

              Add-SPUserSolution -LiteralPath C:UsersAdministrator.locDesktoptestcustomtemplatevladcustomtemplate.wsp -Site $mainurl

             $ErrorActionPreference = “silentlycontinue”

                do

                {

Write-Host “.” -NoNewline -ForeGroundColor White;

                                Start-Sleep -Seconds 5;                                

                                try

                                {

                                $testsolution = Get-SPUserSolution -Identity vladcustomtemplate.wsp -Site $mainurl

                                }

                                catch

                                {}

                } while(!$testsolution);

          $ErrorActionPreference = “stop”

          Install-SPUserSolution -Identity vladcustomtemplate.wsp -Site $mainurl

          Write-Host -ForegroundColor GREEN “Done.”

           Write-Host  

Now that we got our empty site collection, we need to find the ID of the template we want to apply to it.  Here is the Command.

$site= new-Object Microsoft.SharePoint.SPSite($mainurl )

$loc= [System.Int32]::Parse(1033)

$templates= $site.GetWebTemplates($loc)

foreach ($child in $templates)

{

    write-host $child.Name ”  ” $child.Title

}

$site.Dispose()

At the end of the list, you will find your Custom Template GUID and Name.  Look at the picture below.

Note that the Template GUID and Name will never change. So if you want to send the script and the package to someone else, you can hardcode this part and it will work no problem.  The last part, is applying the template to our new Site.

$web = GET-SPWeb $mainurl

$web.ApplyWebTemplate(“{B8042B86-989C-4D59-A57C-D06918681DE1}#vladcustomtemplate”)

After, you can access your site and your custom template will be applied.  You can see in the screenshot below that there is a customer Document Library (“Custom Document Library”) and that it inherited the template description from my Template.

4.5/5 (2)

Please rate this