Skip to main content

Posts

Showing posts from December 31, 2012

Apply Custom Master Page To Site using Power Shell

function ApplyMasterPageToSearchSite([string] $siteURL, [string] $SiteName) {         $subsiteurl = $siteURL + "/" + $SiteName + "/default.aspx"         Enable-SPFeature -identity "94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb" -url $subsiteurl         Start-SPAssignment -Global         $site = Get-SPSite $siteURL         Write-Host "Get the Site" -foregroundcolor green         $topWeb = Get-SPWeb $site.Url         Write-Host "Update Master Page to search" -foregroundcolor green         $site | Get-SPWeb -limit all | ForEach-Object { $_.MasterUrl = "/_catalogs/masterpage/LMSSearchMaster.master";$_.Update() }         Write-Host "Master Page assigned" -foregroundcolor green         Stop-SPAssignment -G...

Create Search Scope and apply ruele using power shell also define Search Setting to Site Collection

[string]$searchSiteName = "Search" # Creates the search scope on site so it shows on the dropdown function CreateSearchScope([string] $siteURL){     # Variables for Site     [string]$searchServiceApplicationName = "Search Service Application"     [string]$adminServiceName = "SPAdmeinV4"     [string]$lmsContentTypeTemplateID = "STS_ListItem_10001"     [string]$searchDropDownValue= "Search Dropdown"     [string]$scopeName = "LMS Search"     # Gets the Search Service Application Object     Write-Host "Get-SPEnterPriseSearchServiceApplication" -foregroundcolor green     $ssa = Get-SPEnterPriseSearchServiceApplication -Identity $searchServiceApplicationName     # Get the root web     Write-Host "Get the root web." -foregroundcolor green     $site = New-Object Microsoft.SharePoint.SPSite($siteURL)    ...

Apply C# code in Power Shell Script

  Apply C# code in Power Shell # ----------- Csharp code for variations -------------- $Assem = (     "System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"    ,     "Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ,     "Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ,     "Microsoft.Office.Server.Search, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ,     "Microsoft.Office.Server, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"             )     $Source = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.SharePoint; using Microsoft.SharePoint.Publishing; using Microsoft.SharePoint.Administration; using Syste...