I still cannot believe that there are Sitecore developers out there that are still not using Sitecore Powershell Extensions. Since I discovered SPE, it’s saved me what I can only estimate as being hundreds of hours of headaches and hundreds of dollars in therapist bills! Admittedly, there’s a pretty steep learning curve, but the ROI is well worth the pain. If you’ve used MS PowerShell in the past with any proficiency your learning curve is going to be far easier – only having to understand the particulars of the Sitecore Extensions themselves.
So What Is It?
If you’re old enough to remember the old commercials… “You got your chocolate in my peanut butter! You got your peanut butter in my chocolate!”, you can understand the two great tastes that come together to form the Sitecore Powershell Extensions. You get all the power, flexibility, and rapid scripting merged with the power of the Sitecore API and any libraries your code base has access to in your site. That’s right, you can access all .NET classes and libraries that are deployed in your Sitecore instance! Not only can you access the .NET libraries, but at some points I’ve even used classes from my custom code including a Glass Mapper context where I could interact with my items using my custom models! Fortunately, you don’t often need to do that, but your ability to imagine and code is really the only limiting factor with what you can accomplish.
SPE starts by providing an interface right in your Sitecore Content Editor:
If you’ve used PowerShell in Windows, this should look pretty familiar. We’ll be covering how to use this in future posts. For now, just understand that you have a fully working console at your fingertips from anywhere in the content tree or your desktop! This is just a small part of what you get however. There is also a scripting environment, called the PowerShell ISE (just like the desktop version) that lets you create, save/load, execute, and debug scripts in a more development friendly fashion. You get syntax highlighting, limited intellisense and code completion, and a large library of example scripts to borrow and learn from.
As we dive deeper into the code library, you’ll learn that SPE provides integration points into the content tree, the context menu, the ribbon, reporting, and even event handling within Sitecore! Have you ever wanted to give your users a quick utility to run on a certain type of item? You can do this with SPE. If you’ve ever had to write custom code to generate reports for your users, you’ll love the reporting capabilities of SPE. There are even a number of out of the box reports that are very useful.
There’s a lot more that we’ll eventually get into in the series, and where possible I’ll include videos demonstrating SPE in action.
So How Do I Get It?
Well, if you are friends with the creator, Adam Najmanowicz or any of the rest of his team you could ask them… but the quickest way is to grab it from the Sitecore Marketplace. Here is the link. There are a lot of downloads available, but assuming you’re using Sitecore 7 or 8, you should choose the appropriate version displayed below:
Here you’ll download a Sitecore package that you can install like any other.
Select Development Tools > Installation Wizard from the Sitecore Desktop and follow the wizard to upload and/or install the package. Restart the Sitecore Client, and you’re now on your way to ultimate Sitecore power!
That Was Easy, What Now?
Now that you’ve got SPE installed, we’ll be spending the next six to eight posts going over the basics. Then we’ll get into the juicy bits you’re really looking for!
Here’s my preliminary topic list, to be updated as I complete the articles:
- Part 2: The Fantastic Voyage! Getting around in Sitecore Powershell and the Anatomy of an Item
- Part 3: Little House on the Query: How to build useful statements in Sitecore Powershell Extensions
- Part 4: By the PowerShell of Grayskull! A primer on PowerShell Commands, Commandlets, and other Tools
- Part 5: ISE, ISE, Baby!: Using the Sitecore PowerShell Extensions Integrated Script Editor
- More TBD
If you have any special requests, you can always tweet it to me: @SitecoreJon or @JonUpchurch or leave a comment below!