SharePoint By Yagya Shree

SharePoint 2016: Microsoft SharePoint Foundation Administration missing

leave a comment »


SharePoint 2016: Microsoft SharePoint Foundation Administration missing

Services on Server

Web app service error

PS C:\Users\2016spadmin> Start-SPService -Identity “Microsoft SharePoint Foundation Administration”
Start-SPService : Cannot start or stop the service ‘Microsoft SharePoint Foundation Administration’. It is a system
service.
At line:1 char:1
+ Start-SPService -Identity “Microsoft SharePoint Foundation Administra …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-SPService], InvalidOperationException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletStartService

Written by Yagyashree

October 22, 2019 at 10:43 pm

SharePoint 2016: Reduce the size of logging database

leave a comment »


How to reduce the size of logging database and how to purge the old data from Logging Database

When i ran the command in my Sharepoint 2016 farm, it gave me following error:

Get-SPUsageDefinition | ForEach-Object {Set-SPUsageDefinition -Identity $_.name -DaysRetained 1}

 

The above command gave me below error:

Set-SPUsageDefinition : The number of days to keep usage data must be greater than the number of days to keep detailed
data.
At line:1 char:41
+ … Each-Object {Set-SPUsageDefinition -Identity $_.name -DaysRetained 1}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Share…UsageDefinition:SPCmdletSetUsageDefinition) [Set-SPUsage
Definition], InvalidOperationException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletSetUsageDefinition

Tried to find if this error is reported in all search engines but unable to find any information.

I did stumble upon this good link which talks about change in how settings are changed in SharePoint 2016.

So i modified my command and ran following:

Get-SPUsageDefinition | ForEach-Object {Set-SPUsageDefinition -Identity $_.name -DaysRetained 1 -DaysToKeepUsageFiles 0}

That’s it!

The command ran successfully and i validated the changes.

I then ran following command to start by timer jobs:

Get-SPTimerJob | Where-Object { $_.title -like “*usage data*” } | Start-SPTimerJob

Written by Yagyashree

July 18, 2018 at 5:44 am

How to find site collection creation date

leave a comment »


Please run below script in SharePoint 2013 Management Shell

 

$w = Get-SPWeb https://this_is_Site_Collection_url

$w.Created

Create_date

Written by Yagyashree

July 17, 2017 at 11:28 pm

Posted in sharepoint

Tagged with , , , ,

HOW TO RETRIEVE ALL APPS INSTALLED ON A SHAREPOINT 2013 WEB APPLICATION THROUGH POWERSHELL

leave a comment »


For my reference:

 

Add-PsSnapin Microsoft.SharePoint.PowerShell
$webApp = Get-SPWebApplication "http://sp2013"
foreach($site in $webApp.Sites)
{
    Write-Host $web.Url -BackgroundColor DarkGreen
    foreach($web in $site.AllWebs)
    {
        $appInstance = Get-SPAppInstance -Web $web.Url | select Title,Appwebfullurl,Id
        if($appInstance -ne $null)
        {     
	   $appInfo = $appInstance.Title + " - " + $appInstance.Appwebfullurl     
           Write-Host $appInfo
        }
    }
}

Written by Yagyashree

October 31, 2016 at 6:22 pm

Posted in powershell, sharepoint

Tagged with ,

SP2013: Find All search crawl Property

leave a comment »


Requirement:

How to find all search crawl property in a TEXT or EXCEL file for a specific site collection using PowerShell

 

Resolution:

1st Phase:

Find the GUID for site collection by running below script from Windows PowerShell ISE on any of the sharepoint servers in farm.

Add-PSSnapin “Microsoft.SharePoint.PowerShell”
$site = Get-SPSite https://sharepoint.contoso.com/sites/SP2013
$siteguid = $site.id
echo $siteguid

2nd Phase

Once you got the GUID for site collection from phase 1, run below script

Add-PSSnapin “Microsoft.SharePoint.PowerShell”
$searchapp = Get-SPEnterpriseSearchServiceApplication
Get-SPEnterpriseSearchMetadataCrawledProperty -SearchApplication $searchapp -SiteCollection <Site_GUID> -limit All >C:\Temp\crawlproperty.csv

Written by Yagyashree

September 19, 2016 at 8:23 pm