Sharepoint

Restore-SPSite : The site collection could not be restored. If this problem persists, please make sure the content databases are available and have sufficient free space.

Error: “Restore-SPSite : The site collection could not be restored. If this problem persists, please make sure the content databases are available and have sufficient free space.” Error Type : Higher level generic error You might see this error while…

Sharepoint Powershell Set scope of people picker to particular domain

To scope people picker $wa = Get-SPWebApplication “http://webapplicationurl“ $adsearchobj = New-Object Microsoft.SharePoint.Administration.SPPeoplePickerSearchActiveDirectoryDomain $adsearchobj.DomainName = “domain.com” $wa.PeoplePickerSettings.SearchActiveDirectoryDomains.Add($adsearchobj) $wa.Update() To reset peoplepicker setting $wa = Get-SPWebApplication “http://webapplicationurl” $adsearchobj = New-Object Microsoft.SharePoint.Administration.SPPeoplePickerSearchActiveDirectoryDomain $wa.PeoplePickerSettings.SearchActiveDirectoryDomains.clear() $wa.Update()

Merging ULS logs across a farms via Powershell

Merge-SPLogFile –Path “C:\Logs\FarmMergedLog.log” –Overwrite –StartTime “06/09/2008 16:00” –EndTime “06/09/2008 16:15” ————–EXAMPLE 1—————– Merge-SPLogFile –Path “C:\Logs\FarmMergedLog.log” -Overwrite This example merges the last hour of log data from all farm computers with no filtering. ————–EXAMPLE 2—————– Merge-SPLogFile –Path “C:\Logs\FarmMergedLog.log” –Overwrite –Area Search…

Managing Sharepoint Timer Jobs using PowerShell

#function to enable the timer job if its disabled function EnableTimerJobIfDisabled ( [String]$TimerJobName) { [void][System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”) if(CheckTimerJobStatus) { Get-SPTimerJob $TimerJobName Enable-SPTimerjob -Identity $TimerJobName write-host “Enabled $TimerJobName” } }      #### Enable Timer Job #### #Enable the timer job if it…

Powershell script to Restore the SharePoint Site Content Types From XML File

$destWeb = Get-SPWeb http://sharepointlovers.com #$xmlFilePath = “C:\Install\ScriptDocument.xml”     Function CreateCTypes($xmlFilePath) { #Create Site Content Types $ctsXML = [xml](Get-Content($xmlFilePath)) $ctsXML.ContentTypes.ContentType | ForEach-Object {     #Create Content Type object inheriting from parent $spContentType = New-Object Microsoft.SharePoint.SPContentType ($_.ID,$destWeb.ContentTypes,$_.Name)   #Set Content…

Powershell script to Backup the SharePoint Site Content Types To XML File

$sourceWeb = Get-SPWeb http://sharepointlovers.com #$xmlFilePath = “C:\Install\ScriptDocument.xml”     Function BackupCType() { param ($CTypeName, $xmlFilePath) #Create Export File New-Item $xmlFilePath -type file -force #Export Content Types to XML file Add-Content $xmlFilePath “<?xml version=`”1.0`” encoding=`”utf-8`”?>” Add-Content $xmlFilePath “`n<ContentTypes>” $sourceWeb.ContentTypes | ForEach-Object…