Posts

Showing posts from 2016

How to check the Site template name & ID of a site collection.

$web = Get-SPWeb https://abc.xyz.com/sites/sitename write-host "Web Template:" $web.WebTemplate " | Web Template ID:" $web.WebTemplateId $web.Dispose()

PowerShell to find Available workflows in site collection

$site = Get-SPSite("http://yoursiteurl/sites/ss"); $site.AllWebs | foreach { $_.Lists | foreach { $_.WorkflowAssociations | foreach { write-host "Site URL :" $_.ParentWeb.Url ", List Name :" $_.ParentList.Title ", Workflow Name :" $_.Name } } } $siteurl="http://yoursiteurl/sites/ss" $site=Get-SPSite("http://yoursiteurl/sites/ss"); #Initialize Workflow Count variable $workflowcount = 0 #Foreach loop to loop through all webs, and lists with workflow associations, and exclude workflows that have previous versions and write findings to .csv file. function Get-Workflows() { foreach($web in $site.AllWebs) { foreach($list in $web.Lists) { foreach($wf in $list.WorkflowAssociations) { if ($wf.Name -notlike "*Previous Version*") { $hash = @{"[URL]"=$web.Url;"[List Name]"=$list.Title;"[Workflow]"=$wf.Name} New-Object PSObject -Property $hash | Sort-Object } } } } } foreach($web in $si...

Sign in as different user option in SharePoint 2013

http://yoursite/_layouts/closeConnection.aspx?loginasanotheruser=true  

How to Create a Subsite based on Site template ID

New-SPWeb http://yoursiteurl/sites/spdemos/DocLibTest -Template “GENERALPROJECTTEMP#1” Add-PSSnapin Microsoft.Sharepoint.Powershell $web = get-spweb https://sharepoint $template = $web.GetAvailableWebTemplates(1033) | Where-Object {$_.Title -eq “ ”} $newweb = New-SPWeb -Url “https://sharepoint/newsubsite”  $newweb.ApplyWebTemplate($template.Name)

PowerShell to find all available workflows in site collection & Subsites with their names & location.

$site = Get-SPSite(" http://sharepoint.site.com/sites/abc "); $site.AllWebs | foreach { $_.Lists | foreach { $_.WorkflowAssociations | foreach { write-host "Site URL :" $_.ParentWeb.Url ", List Name :" $_.ParentList.Title ", Workflow Name :" $_.Name } } } $siteurl=" http://sharepoint.site.com/sites/abc " $site=Get-SPSite(" http://sharepoint.site.com/sites/abc "); #Initialize Workflow Count variable $workflowcount = 0 #Foreach loop to loop through all webs, and lists with workflow associations, and exclude workflows that have previous versions and write findings to .csv file. function Get-Workflows() { foreach($web in $site.AllWebs) { foreach($list in $web.Lists) { foreach($wf in $list.WorkflowAssociations) { if ($wf.Name -notlike "*Previous Version*") { $hash = @{"[URL]"=$web.Url;"[List Name]"=$list.Title;"[Workflow]"=$wf.Name} New-Object PSObject -Property $hash ...

PowerShell script to count & show available docuements in Site collection & Sub sites.

[System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") [System.Reflection.Assembly]::Load("System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") function Get-DocInventory([string]$siteUrl) { $site = New-Object Microsoft.SharePoint.SPSite $siteUrl foreach ($web in $site.AllWebs) { foreach ($list in $web.Lists) { if ($list.BaseType -ne “DocumentLibrary”) { continue } foreach ($item in $list.Items) { $data = @{ "Site" = $site.Url "Web" = $web.Url "list" = $list.Title "Item ID" = $item.ID "Item URL" = $item.Url "Item Title" =...