Posts

Showing posts with the label 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...

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...

PowerShell scripts for Updating content types and Page Layouts in Page

In this blog we are going see how to change page layout and content type of publishing pages in document library using PowerShell script. Page Layout and Content Type Page layout is a publishing feature that defines the layout of a page. So we need to import the Microsoft.SharePoint.Publishing.dll into PowerShell. Then follow these steps: Get the object of PublishingWeb from SPWeb. $publishingWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web);   Get the object of page layout from then title of page layout. $allPageLayouts = $publishingWeb.GetAvailablePageLayouts(); $pageLayout = $null; foreach($pl in $allPageLayouts){     if($pl.Title -eq $NewPageLayout){         $pageLayout = $pl;         break;     } }   Then get the object of publishing page object using page url and publishing web object. $page = $pu...