Posts

Showing posts with the label SharePoint Powershell

Powershell script for Creating Phase, Stage, PDPs in EPM 2013

Image
As we all know that PowerShell is a very strong tool for performing task in Windows environment. In this blog post I'm assuming you have basic knowledge of PowerShell scripting and Project Server 2013 as we are here to learn how to create Stages, Phases and PDPs in Enterprise Project Management 2013 (Project Server 2013) . For Windows PowerShell: Scripting Crash Course is a very good article written by Don Jone s in MSDN. People who have worked on custom workflows using Visual Studio in Project server must know that it uses unique id of each stage, which is automatically generated when the stages were created. So for moving workflow from one environment to another, we are required to the solution and update the Stage id of new environment. For every environment changing code and updating Stage id is not a feasible solution. To overcome the above problem we have come across the solution of creating Stages programmatically and assigning our own Guids. And that is possible...

How to flush the BLOB cache using powershell script

In this blog post I'm going to show you how to flush the BLOB cache using powershell script. Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue $webApp = Get-SPWebApplication "http://webapplicationurl/" [Microsoft.SharePoint.Publishing.PublishingCache]::FlushBlobCache($webApp) Write-Host "Flushed the BLOB cache for:" $webApp Hope this script will solve problems of people facing issues with SharePoint BLOB cache.

Release SharePoint site Lock using PowerShell Script

In this blog post I'm going to show you a PowerShell Script for releasing site lock. Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue $Admin = New-Object Microsoft.SharePoint.Administration.SPSiteAdministration("http:// sitecollection ") $Admin.ClearMaintenanceMode() $site = Get-SPSite -Identity "http://sitecollection" Write-Host $site.MaintenanceMode Hope this will help people facing the lock problem in SharePoint.

Download All Documents in SharePoint Web using Powershell Script

Image
In this blog post I'm going to show you how to download all document using Powershell script on your local drive. Please follow the below steps: 1. Creating commandlet bindings (command variables) 2. Add-PSSnapin statement for importing SharePoint library. 3. Now creating a recursive function for traversing all the folders in the specified folder and downloading it to local folder. In the second foreach loop we are checking if Folder not exists on local drive then create the folder and then call DownloadAllItemInFolder function recursively. 4. Create the instance of Site, Web and Folder to call  DownloadAllItemInFolder function. Once the downloading finished, dispose off the Site object. Full script can be downloaded from here . Below is the sample command to run this script. .\DownloadSPFiles -SiteCollectionUrl "http://siteurl" -SPFolderPath "<Folder>" -LocalDir "C:\BackupFiles" In that script I've used the Root Web for...

Clear SharePoint Site’s Recycle Bin using PowerShell Script

In this blog post I’m going to display how to delete all items from recycle bin of any SharePoint Site using PowerShell script. Steps: PowerShell script we can get the object of SPSite and SPWeb like this $Site = Get-SPSite “SiteUrl” $RootWeb = $Site.RootWeb We can iterate through all the subsites in any site using foreach loop foreach($web in $RootWeb.Webs) Next we need to call the DeleteAll method of Recycle Bin. {       $web.RecycleBin.DeleteAll(); } Next we need to clear the level 2 recycle bin i.e. at site collection level $Site.RecycleBin.DeleteAll(); And lastly we need to dispose the SPSite object $Site.Dispose();   That’s all you need to delete all items from recycle bin.