Tuesday, 22 August 2017

Installation and Removal of WSP
----------------------------------------------
Add-SPSolution -LiteralPath D:\Rajesh\WSP\Mysite.wsp

Install-SPSolution –Identity "Mysite.wsp" –WebApplication "http://mysite.com/" –GACDeployment -Force

Uninstall-SPSolution -Identity Mysite.wsp
Remove-SPSolution -Identity Mysite.wsp
Remove WebApplication through PowerShell
--------------------------------------------------------------
Remove-SPWebApplication http://mydev511:21000/ -Confirm -DeleteIISSite -RemoveContentDatabases

Remove WebStite through PowerShell
---------------------------------------------------------
Remove-SPSite -Identity "http://mysite.com/" -GradualDelete





Get all the feature name  
---------------------------------

Get-SPFeature | select ID, DisplayName, Scope, CompatibilityLevel | Export-Csv D:\Features.csv
Could not obtain exclusive lock on database 'model'. Retry the operation later.
-----------------------------------------------------------------------------------------------------
1. Run the below SQL script

Use master
GO
IF EXISTS(SELECT request_session_id  FROM sys.dm_tran_locks
WHERE resource_database_id = DB_ID('Model'))
        PRINT 'Model Database being used by some other session'
ELSE
        PRINT 'Model Database not used by other session'

2. Get the session ID

SELECT request_session_id  FROM sys.dm_tran_locks
WHERE resource_database_id = DB_ID('Model')

3. Check the session ID
DBCC InputBuffer(465)

4. Kill the session

Kill 465

Now you will be able to create the DB
How to get all WSP from Central Admin
-----------------------------------------------------

$FolderPath = "c:\Solutions"
foreach ($solution in Get-SPSolution)
{
   $id = $Solution.SolutionID
   $title = $Solution.Name
   $filename = $Solution.SolutionFile.Name
   $solution.SolutionFile.SaveAs("$FolderPath\$filename")
}
Sites and Subsites last updated 
----------------------------------------

#Set-ExecutionPolicy RemoteSigned
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$url="http://xxxxxx/"
$site = New-Object Microsoft.SharePoint.SPSite($url)
$spWebApp = $site.WebApplication

$OutputFN = "D:\ActiveSitesReport.csv"
"Site Name `t URL `t Last Modified" > $OutputFN

# Iterate through all sites:
 foreach ( $spSite in $spWebApp.Sites )
  {
         foreach ($spWeb in $spSite.AllWebs)
        {
                  if ($spWeb.IsRootWeb)
                  {
                    $siteName = $spWeb.Title +" - Root";
                  }
                  else
                  {
                  $siteName = $spSite.RootWeb.Title + " - " + $spWeb.Title;
                  }                        

              $siteName + "`t" + $spWeb.Url + "`t" + $spWeb.LastItemModifiedDate >> $OutputFN
             $spWeb.Dispose()
        }
    $spSite.Dispose()
  }

Sites and Subsites last created
---------------------------------------
Get-SPSite -WebApplication http://xxxxx/ -Limit All |
Select -ExpandProperty AllWebs |
ft url, Title, Created -auto |
out-string -width 1024 > D:\mysite.txt

How to get the error log in SharePoint

How to get the error log in SharePoint
*******************************
Run the below command in SharePoint Management Shell as an Admin

Merge-SPLogFile -Path "D:\FarmMergedLog.txt" -Correlation "" -Overwrite


.
This summary is not available. Please click here to view the post.