PowerShell Command for SharePoint 2010

1.  Install / Uninstall and Activate/Deactivate Feature

$Hive14=’C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\’

$Url=’http://devsp:9901′
$Feature=’MKS.Services.ProdDev.Images’
$Path=’E:\WorkArea\MasterPage\’ + $Feature
$DestPath=$Hive14 + $Feature

Remove-Item $DestPath -recurse

Copy-Item $Path  $DestPath  -recurse
Disable-SPFeature $Feature -Url $Url
Uninstall-SPFeature $Feature
Install-SPFeature $Feature
Enable-SPFeature $Feature -Url $Url

2. Configuring MasterPage and CSS
$newLogoUrl=’http://devsp:9901/PublishingImages/_t/MukeshMainLogo_jpg.jpg’
$web = Get-SPWeb http://devsp:9901
$web.MasterUrl = “/_catalogs/masterpage/MKSProductDefaultMasterPage.master”
$web.CustomMasterUrl= “/_catalogs/masterpage/MKSProductDefaultMasterPage.master”
$web.AlternateCssUrl=”/_LAYOUTS/1033/STYLES/CUI.css”
$web.SiteLogoUrl = $newLogoUrl
$web.Update()
$web.Dispose()

Advertisements

One thought on “PowerShell Command for SharePoint 2010

  1. Hi Mukesh,

    I am new to Powershell and have a requirements to prepare a powershell script for stoping and starting the sharepoint services on all servers and is there a way to auotmate that

    Thxs,DP

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s