This one definitely took more time than I initially expected, and before I devote even more to it I would very much like to hear your opinion. Do you find it useful? Which way should the development be going? But first things first…

Have you ever found yourself:

  • having to make a mundane change to a large number of pages?
  • in need of getting statistics on page properties or page type usages?
  • being curious of e.g. what’s the oldest page on your site?
  • having to copy or move a large number of files from one folder to another or between versioning and non versioning virtual path providers?
  • renaming or deleting files in your file store en-masse?

If the answer to any of those (and more) is a “yes!”, I believe you might find my little plugin useful.

The idea is to create a scripting environment to work with EPiServer on a more granular level than the existing PowerShell SnapIn API enables us currently. Manipulate not just sites, but files and pages on a large scale or perform statistical analysis of your content using  a familiar and well documented query language.

PowerShell1

The PowerShell console for EPiServer provides you with two abstractions to work with:

Virtual Path Provider Drive

With the console you can browse the VPP and perform a number of file operations just like you were doing it in a regular PowerShell console on a regular disk drive. Especially…

  • move files between Virtual path providers
  • move, copy or rename files and folders

Known limitations:

  • You cannot load files from disk directly onto a VPP and vice versa (this however can be overcome by mapping the path you want to migrate into your CMS as a native path provider and copying from that).
  • some actions might not respect or might unintentionally force recursive operation.
  • the console might blow up unexpectedly (What do you mean crippled? I got all five fingers! Three on this hand, two on the other one!)

I think you might find it quite useful offloading files from versioning VPP onto a Native VPP once you decide that you want to access the content of the files outside the CMS. Or pulling your files into the Database VPP (available for download from EPiCode).

Page Store Drives

The console will map all your CMS page roots as drives based on the site name (site name should not have space in it for the current version to work). Now this one… the sky is the limit!

The items that the drive exposes are fully functional PageData’s, additionally – for your scripting convenience all page properties are mapped so that you can access them like they were regular POCO properties.

By far this is the coolest little toy I’ve recently played with – I would strongly advised that you look into the samples and put your imagination to work!

PowerShell2

You can create statistics, modify pages based on regular expressions, filter, delete, rename, move around…

PowerShell3

Naturally the Obligatory disclaimer is that you use the tool at your own responsibility. Make backups, test your script on staging before doing anything. Heck! Don’t use it on production at all yet (!) – it’s very much an alpha and a technology demo.

[Download & Enjoy]

How to install?

Extract the DLL form the ZIP file into the BIN folder of your web application to install the plugin. Remove the DLL to uninstall it.

All constructive feedback appreciated!

1 Star2 Stars3 Stars4 Stars5 Stars (5 votes, average: 4.80 out of 5)
Loading...



This entry (Permalink) was posted on Wednesday, September 22nd, 2010 at 12:02 am and is filed under .Net Framework, ASP.NET, C#, Code Samples, EPiCode, EPiServer, PowerShell, Software Development, Solution, Web applications. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response , or trackback from your own site.