Archive | Sharepoint 2010 RSS for this section

Sharepoint Power Shell Create a Site Collection in a Specific Data Base

By default, Site collections are created on the web application database. If you want to create a Site Collection in a diferent database, you can use the following Script:

#Create the Database

New-SPContentDatabase -Name New_Content_DB  -WebApplication http://myWebApplication

#Create the Site Collection

New-SPSite http://myWebApplication/newSite -OwnerAlias <owner account name including domain name e.g.domain\username> -ContentDatabase New_Content_DB -Name <Name of your site collection> -Description <Description of site collection> -Template “STS#0”


You should also configure your WebApplication Paths to be able to create your site collection in a specific url.


Sharepoint Power Shell Add Nodes to Quick Launch Navigation

This script will add all Site subSites to QuickLaunch Navigation, in the "Sites" node.

$siteUrl = "http://localhost"
$spWeb = Get-SPWeb $siteUrl -ErrorAction Stop
$quickLaunch = $spWeb.navigation.quicklaunch
$sitesGroup = $quickLaunch | where { $_.Title -eq "<strong>Sites</strong>" }

foreach($subSite in $spWeb.Webs)
 $node = New-Object -TypeName Microsoft.SharePoint.Navigation.SPNavigationNode -ArgumentList $subSite.Title , $subSite.Url


Sharepoint Power Shell include lists in Quick Launch Navigation

The next PowerShell Script will be usefull to include all web lists in Quick Launch Navigation:

$site = Get-SPSite  http://localhost
#Walk through each web/site in the site collection
$site | Get-SPWeb | ForEach-Object {
foreach($list in $_.Lists)
         $list.OnQuickLaunch = "true"
         #Update the list

#Dispose of the site object

Sharepoint 2010 Configuration Wizzard Error: Cannot start service SPAdminV4 on computer …

When running SharePoint 2010 Configuration Wizzard It failed, with the error:

“An exception of type system.invalidoperationexception was thrown. Additional exception information: Cannot start service SPAdminV4 on computer”

I tried to manual start “SharePoint Administration Service” in Services console, but I had the error:

“The service did not respond to the start or control request in a timely fashion.”

I changed my registry, to increase services startup time, as in this article:

  • In Registry Editor, locate, and then right-click the following registry subkey:
  • Point to New, and then click DWORD Value. In the right pane of Registry Editor, notice that New Value #1 (the name of a new registry entry) is selected for editing.
  • Type ServicesPipeTimeout to replace New Value #1, and then press ENTER.
  • Right-click the ServicesPipeTimeout registry entry that you created in step c, and then click Modify. The Edit DWORD Value dialog box appears.
  • In the Value data text box, type TimeoutPeriod, and then click OK

Restart the server and run the Configuration Wizzard with no problems.

How to change Sharepoint 2010 MasterPage with Power Shell

To change a site master page with power Shell, you can run the above script (with admin priviledges), changing the bold settings (MasterUrl is the system master page):

$web = Get-SPWeb <strong>http://intranet</strong>

$web.CustomMasterUrl = "/_catalogs/masterpage/<strong>v4.master</strong>"

$web.MasterUrl = "/_catalogs/masterpage/<strong>v4.master</strong>"