Powershell

SharePoint powershell script to find unique permissions in sharepoint

#This script loops through all the sites in a site collection and then writes out any that have unique permissions. [System.Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”) | out-null $siteurl = “Enter URL Here” $site=new-object Microsoft.SharePoint.SPSite($siteurl) foreach($web in $site.AllWebs) { if ($web.HasUniqueRoleAssignments) {…

Sharepoint powershell loop all site collection, sites, sub sites

[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”) > $null   $farm = [Microsoft.SharePoint.Administration.SPFarm]::Local $websvcs = $farm.Services | where -FilterScript {$_.GetType() -eq [Microsoft.SharePoint.Administration.SPWebService]} $webapps = @()   foreach ($websvc in $websvcs) { write-host “###############Web Applications################” foreach ($webapp in $websvc.WebApplications) { write-host “Webapp Name :”$webapp.Name “Webapp URL :”$webapp.URL…

Sharepoint Powershell get analyzer reports as email

#Get Central Admin Web Application and Web objects $caWebApp = (Get-SPWebApplication -IncludeCentralAdministration) | ? { $_.IsAdministrationWebApplication -eq $true } $caWeb = Get-SPWeb -Identity $caWebApp.Url #Set up from, to and server addresses $toAddress = “jayaraja.jayaraman@awacservices.com” $fromAddress = $caWebApp.OutboundMailReplyToAddress $serverAddress = $caWebApp.OutboundMailServiceInstance.Server.Address…

Clear the SharePoint Timer Cache using Powershell

Write-Host -foregroundcolor White “” Write-Host -foregroundcolor White “Clear SharePoint Timer Cache“ #************************************************************************************** # References #************************************************************************************** [void][reflection.assembly]::LoadWithPartialName(“Microsoft.SharePoint“) [void][reflection.assembly]::LoadWithPartialName(“Microsoft.SharePoint.Administration“) [void][reflection.assembly]::LoadWithPartialName(“System“) [void][reflection.assembly]::LoadWithPartialName(“System.Collections“) #************************************************************************************** #************************************************************************************** # Constants #************************************************************************************** Set-Variable timerServiceName -option Constant -value “SharePoint 2010 Timer“ Set-Variable timerServiceInstanceName -option Constant -value “Microsoft SharePoint Foundation…

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…

Override Search Service Application Row Limit Using Powershell / Object Model

Using sharepoint object model: public static void SetMaxRowLimit() { SPFarm farm = SPFarm.Local; SearchServiceApplication searchApp = (SearchServiceApplication)farm.Services. GetValue(). Applications.GetValue(“Search Service Application”); searchApp.MaxRowLimit = 10000; searchApp.Update(true); } Using sharepoint Powershell $SearchServiceApp = SPEnterpriseSearchServiceApplication $SearchServiceApp .MaxRowLimit = 10000 $SearchServiceApp .Update()

Sharepoint Export List and Import List Using Powershell

function Export-List([string]$ListURL) { [System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”) > $null [System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint.Deployment”) > $null $versions = [Microsoft.SharePoint.Deployment.SPIncludeVersions]::All $exportObject = New-Object Microsoft.SharePoint.Deployment.SPExportObject $exportObject.Type = [Microsoft.SharePoint.Deployment.SPDeploymentObjectType]::List $exportObject.IncludeDescendants = [Microsoft.SharePoint.Deployment.SPIncludeDescendants]::All $settings = New-Object Microsoft.SharePoint.Deployment.SPExportSettings $settings.ExportMethod = [Microsoft.SharePoint.Deployment.SPExportMethodType]::ExportAll $settings.IncludeVersions = $versions $settings.IncludeSecurity = [Microsoft.SharePoint.Deployment.SPIncludeSecurity]::All $settings.OverwriteExistingDataFile = 1 $settings.ExcludeDependencies =…