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
Tuesday, 22 August 2017
Remove WebApplication through PowerShell
--------------------------------------------------------------
Remove-SPWebApplication http://mydev511:21000/ -Confirm -DeleteIISSite -RemoveContentDatabases
Remove WebStite through PowerShell
---------------------------------------------------------
Remove-SPSite -Identity "http://mysite.com/" -GradualDelete
--------------------------------------------------------------
Remove-SPWebApplication http://mydev511:21000/ -Confirm -DeleteIISSite -RemoveContentDatabases
Remove WebStite through PowerShell
---------------------------------------------------------
Remove-SPSite -Identity "http://mysite.com/" -GradualDelete
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
-----------------------------------------------------------------------------------------------------
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(
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")
}
-----------------------------------------------------
$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()
}
----------------------------------------
#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()
}
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 "60b9259e-e813-1027-311f-051669fc5939" -Overwrite
.
*******************************
Run the below command in SharePoint Management Shell as an Admin
Merge-SPLogFile -Path "D:\FarmMergedLog.txt" -Correlation "60b9259e-e813-1027-311f-051669fc5939" -Overwrite
.
Subscribe to:
Posts (Atom)