Thursday, 2 August 2018

Get the number of user connected to the server.

Get-Counter -Counter "web service(my)\current connections" -ComputerName "Server90.com"

"my" is Name of the application in appool and Server90.com is server name

Site created time in SharePoint

$w = Get-SPWeb http://uat2013.corp.com

$w.Created

how to get the site template id in SharePoint


$web = Get-SPWeb http://uat2013.corp.com/sites/projects/SOP/
$web.WebTemplate + " " + $web.WebTemplateId

size of content DB


Get-SPDatabase | Sort-Object disksizerequired -desc | Format-Table Name, @{Label ="Size in MB"; Expression = {$_.disksizerequired/1024/1024}} > D:\Rajesh\Content_DataBaseSize.txt

How to get all Site URL and content Database name

get-spsite -limit all | select url,contentdatabase

How to get AppPool Account Password


Get-WmiObject -Namespace "root\MicrosoftIISV2" -Class "IIsApplicationPoolSetting" | Select WAMUserName, WAMUserPass

OR

Import-Module WebAdministration
(ls IIS:\AppPools | Get-ItemProperty).ProcessModel | select UserName,Password

How to restore site from Database if deleted from Recycle bin of SharePoint


$deletedSite = Get-SPDeletedSite /Site/rajeshsite
Restore-SPDeletedSite -Identity $deletedSite

Run PSCONFIG

 get-spproduct -local

psconfig.exe -cmd helpcollections -installall -cmd secureresources -cmd services -install -cmd installfeatures -cmd applicationcontent -install -cmd upgrade -inplace b2b -force -wait


PSConfig.exe -cmd upgrade -inplace b2b -force -cmd applicationcontent -install -cmd installfeatures

Psconfig.exe -cmd upgrade -inplace b2b -wait -force

"The expected version of the product was not found on the system " when install Cumulative Updates in Project Server

When we try to install a Cummulative Update in SharePoint or Project Server, sometimes a message appears:
“The expected version of the product was not found on the system” And the update can not be installed.
To fix this problem, you can execute the cumulative update in a command Window and add 
 “PACKAGE.BYPASS.DETECTION.CHECK=1” 

BackUp and Restore Site

Backup-SPSite https://web.com/sites/us/ -Path d:\us.bak
or
Backup-SPSite -Identity https://web.com/sites/gb/ -Path D:\SiteBackup\GB.bak [-Force] [-NoSiteLock]


Restore-SPSite https://uat2013.com/sites/us -Path D:\ProductionSiteBackup\us.bak -force

Import and Export in SharePoint

Import and Export List
----------------------------
Export from Server
-----
Export-SPWeb "http://my.local/sites/CQT User Forum/IssueReporting" -itemurl "Lists/CQT%20Requests%20%20Issues" -path "c:\temp\backup\test2.cmp" -IncludeUserSecurity -IncludeVersions All -Force

Import List to Server
-------
Import-SPWeb "http://myuat.corp.com/sites/CQT User Forum/IssueReporting" -Path "D:\Rajesh\backup\test2.cmp" -IncludeUserSecurity -UpdateVersions Overwrite -Force

Import List
----------------------
Import-SPWeb "https://de.web.com/sites/in/news/" -Path "D:\INNews\innews.cmp" -IncludeUserSecurity -UpdateVersions Overwrite -Force -verbose

If above command throws error Like Survey list or library exist,
1. Remove the subsite.
2.Create the subsite with no Template ID (command to create New-SPWeb http://somesite/subweb1) (Don't create site with any template or UI)
3. Run the Import command again.

Add, Install,Remove and Uninstall of WSP in SharePoint

Backup WSP

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$farm = Get-SPFarm
$wsp = $farm.Solutions.Item("My.wsp").SolutionFile
$wsp.SaveAs("D:\Rajesh\Backup\My.wsp")

Add and Install

Add-SPSolution -LiteralPath D:\Rajesh\WSP\My.wsp
Install-SPSolution -Identity "My.wsp" -WebApplication "http://mysite.corp.com/" FullTrustBinDeployment -force  
Or
Install-SPSolution –Identity "My.wsp" –WebApplication "http://mysite.corp.com/" –GACDeployment -Force

Remove and Uninstall

Remove-SPSolution -Identity My.wsp
Uninstall-SPSolution -Identity My.wsp

Update

Update-SPSolution -Identity "My.wsp" -LiteralPath "D:\Rajesh\My.wsp" -FullTrustBinDeployment -Forc

Dismount and Mount of Content Database in SharePoint

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