Posts

Showing posts with the label PowerShell

Sharepoint : get all sites where feature is active at site or web level

Sharepoint : get all sites where feature is active at site or web level Please do not forget to comment if this helps. Get all Site Colletions where GUID matched to site colleation feature Get-SPSite -limit ALL | foreach{ $_.features["GUID"] } | select Parent Get all Webs where GUID matched to web feature Get-SPSite -limit ALL | Get-SPWeb -limit ALL | foreach{ $_.features["GUID"] } | select Parent

How to get wsp/dlls/code from SharePoint deployed solution?

How to get wsp/dll/code from SharePoint deployed solution? Please do not forget to comment if this helps. Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue $farm = Get-SpFarm $file = $farm.Solutions.Item("wsp_name.wsp ").SolutionFile $file.SaveAs("D:\Temp\wsp_name.wsp") reanme .wsp to .cab and extract DLL now you can use http://ilspy.net/ to see whats inside DLL. Enjoy

The file is locked for exclusive use by user... SharePoint

The file is locked for exclusive use by SharePoint Please do not forget to comment if this helps. Use below PS script to unlock document. (Will need farm admin access) $web = Get-SpWeb <SP Web URL> $item = $web.GetListItem("<Document URL including web>") #e.g : https://my.sp.com/sites/test1/2017/myPlan.xlsx $item.file.LockType $item.file.LockedByUser $item.file.LockExpires ## Unlock $userId = $item.File.LockedByUser.ID $user = $web.AllUsers.GetById($userId) $impSite = New-Object Microsoft.SharePoint.SPSite($web.Url, $user.UserToken); $impWeb = $impSite.OpenWeb(); $impItem = $impWeb.GetListItem("http:\\domain.FULLURL.com\FilaName.xlsx") $impItem.File.ReleaseLock($impItem.File.LockId) $web.dispose() $impWeb.dispose()
Get all SharePoint content databases using PS : get-spcontentdatabas : This will give you all databased which are set to mode started in centarl admin To get all use below command : Get-SPWebApplication | ForEach {$_.ContentDatabases} | Select Name