Posts

Showing posts with the label PowerShell

Object Cache Accounts

Many administrators when they first configure SharePoint 2010 and hit a Web Application for the first time are likely to see a recurring event in the event log stating that the object cache has not been configured correctly. The specific error is as follows: Object Cache: The super user account utilized by the cache is not configured. This can increase the number of cache misses, which causes the page requests to consume unneccesary system resources . This is essentially telling you that you have missed a manual configuration step in which you need to run some PowerShell to set two accounts for SharePoint to use to access the object cache: function Set-WebAppUserPolicy($webApp, $userName, $userDisplayName, $perm) {     [Microsoft.SharePoint.Administration.SPPolicyCollection]$policies = $webApp.Policies     [Microsoft.SharePoint.Administration.SPPolicy]$policy = $policies.Add($userName, $userDisplayName)     [Microsoft.SharePoint.Administration.SPPolicyRole]$policyRole = $webA

SharePoint 2013 – Create a Search Service Application and Search Topology with Powershell

Image
What needs to be done? 14 steps for a simple Search Topology – 1 powershell can do them all. 1.Create a Service Application Pool for the Search Service Application (15-22) 2.Create a Search Service Application (22-28) 3.Create a Search Service Application Proxy (30-36) 4.Get the current Search Instance (38) 5.Save the current Search Topology for later use (39) 6.Create a new Search Topology (40) 7.Create all the Search Components (Analytics- , Content Processing, Query Processing, Crawler-, Admin Component) (42-46) 8.Remove the Index-Folder and recreate it (50-51) 9.Create a new Index Component (53) 10.Activate the new Topology (56) 11.Call the method synchronize on the old topology – this errors but forces an update on the old topology object (59) 12.The “forced updated” Topology object becomes inactive and can be deleted. (62) 13.Everything  done – start a full crawl order set it to the new shiny continuous crawling. Enjoy! Here is my powershell script for creati

Starting a SharePoint Service Application Proxy using Powershell

If your Usage and Health Data Collection Proxy is in a stopped state here is a quick bit of PowerShell to to get it started: $sap = Get-SPServiceApplicationProxy | where-object {$_.TypeName -eq “Usage and Health Data Collection Proxy”} $sap.Provision() The above can easily be adapted to allow you to start any Service Application Proxy. Video: service application proxy sharepoint

Partial Index Reset of a single content source

Partial Index Reset of a single content source This script will remove and re-add your content source's start addresses. SharePoint will more or less rebuild the index for these sources, when the next full crawl is started. $sourceName = "Local SharePoint sites" $SSA = Get-SPEnterpriseSearchServiceApplication $source = Get-SPEnterpriseSearchCrawlContentSource -Identity $sourceName -SearchApplication $SSA $startaddresses = $source.StartAddresses | ForEach-Object { $_.OriginalString } $source.StartAddresses.Clear() ForEach ($address in $startaddresses ){ $source.StartAddresses.Add($address) }

IIS Reset on all SP Servers using PowerShell

This script will list all SP Servers and restarts IIS on all of them. add-PSSnapin microsoft.sharepoint.powershell $spserver = get-spserver | ?{$_.role -eq "Application"} foreach ($server in $spserver) {     write-host "Performing IIS Reset on Server:"$server.name     iisreset $server.Name }

Get Database Size for all SharePoint Data Bases using PowerShell

Add-PSSnapin microsoft.sharepoint.powershell $size = 0 foreach ($db in Get-SPContentDatabase) {     $size = $size + $db.DiskSizeRequired } $cdbs = "{0:N2}" -f($size/1gb) $ssa = Get-SPEnterpriseSearchServiceApplication $topo = $ssa | Get-SPEnterpriseSearchTopology  -Active $indexcomponent = (Get-SPEnterpriseSearchComponent -SearchTopology $topo | ?{$_.name -like "*index*"})[0] $folder = $indexcomponent.RootDirectory $indexsize = "{0:N2}" -f ((Get-ChildItem $folder -Recurse | Measure-Object -sum  Length).sum/1GB) $dbs = Get-SPDatabase cls write-host "--------------------------------------------------------------------------------------" -fore green Get-Date write-host "" write-host "--------------------------------------------------------------------------------------" -fore green write-host "SUM: Content DB Size in GB: " -NoNewline -fore White write-host $cdbs -fore Yellow write-host "-------