Getting Started

Quick start guide to get up and running with SPE.

Ready to start using SPE? This guide will get you up and running in minutes.

What You Need

Before starting, ensure you have:

  • ✅ SPE installed in your Sitecore instance → Installation Guide

  • ✅ Appropriate permissions to access PowerShell tools → Security

  • ✅ Basic understanding of Sitecore concepts (items, templates, fields)

You don't need to know PowerShell or programming to get started! This guide is designed for Sitecore users who want to automate tasks.

Opening the PowerShell Interfaces

SPE provides two main interfaces for running scripts:

The Console - Quick Commands

The PowerShell Console is perfect for running quick, one-off commands.

How to open:

  1. Log into Sitecore

  2. Go to Desktop (bottom left icon)

  3. Click PowerShell Console

Console Interface

When to use the Console:

  • Running single commands

  • Quick queries and checks

  • Interactive exploration

  • Testing command syntax

The ISE - Script Development

The PowerShell ISE (Integrated Scripting Environment) is a full-featured script editor.

How to open:

  1. Log into Sitecore

  2. Go to Desktop (bottom left icon)

  3. Click Development Tools

  4. Click PowerShell ISE

ISE Interface

When to use the ISE:

  • Writing multi-line scripts

  • Developing reusable tools

  • Saving scripts for later use

  • Debugging complex logic

Learn more: Console | ISE

Your First Command

Let's run your very first SPE command!

Step 1: Open the Console

Follow the instructions above to open the PowerShell Console.

Step 2: Run a Command

Type this command and press Enter:

Step 3: Examine the Results

You should see output showing details about your Home item:

Understanding What Just Happened

Let's break down that command:

  • Get-Item - The command (cmdlet) that retrieves an item

  • -Path - A parameter that specifies which item to get

  • "master:\content\home" - The location of the item

    • master: - The database

    • \content\home - The path to the item

Try These Next

Now that you've run your first command, try these:

List Children of Home

This shows all direct children of the Home item.

List All Descendants

Get Item Properties

PowerShell has a default set of properties to format to the output window even though the objects returned still contain all the properties.

Using Select-Object, the properties are trimmed and the output window reflects the specific fields.

Output:

Find Items by Name

This finds all items under Home that have "Sample" in their name.

Using the ISE

The ISE is more powerful for writing longer scripts. Let's try it out.

Step 1: Open the ISE

Follow the instructions above to open the PowerShell ISE.

Step 2: Write a Script

In the top pane (script editor), type:

Step 3: Execute the Script

Click the Execute button (▶️) or press Ctrl-E.

Step 4: View Results

The bottom pane shows the output of your script.

The ISE provides IntelliSense - start typing a command and press Ctrl+Space to see suggestions!

Key Concepts

Variables

Variables store data and start with $:

Learn more: Variables

Pipelines

The pipe | chains commands together:

Learn more: Commands and Pipelines

Providers

SPE uses providers to access different data stores. The most important is the Sitecore provider:

Learn more: Providers

Common Tasks

Here are some common tasks you can do right now:

Check if Item Exists

Count Items by Template

Find Items Modified Recently

Export Data to CSV

Getting Help

SPE includes extensive built-in help:

Get Help for a Command

Get Detailed Help

Get Examples

List All SPE Commands

Learn more: Help

Script Library

The ISE includes a Script Library with ready-to-use examples:

  1. Open the ISE

  2. Click Open in the ribbon

  3. Click to expand SPE in the tree

  4. Expand folders to find examples:

    • Training - Learning exercises

    • Reports - Content reports

    • Tools - Utility scripts

The Script Library is a great way to learn! Read through examples to see how different commands work together.

Safety Tips

Before you continue, remember these important safety rules:

Always Test First

  • Don't run scripts in production without testing

  • Do test in development first

  • Do understand what a script does before running it

Be Careful with Modifications

Commands that change data:

  • Remove-Item - Deletes items (can be recovered from Recycle Bin)

  • Set-Item - Modifies items

  • Move-Item - Moves items

  • Publish-Item - Publishes changes to web database

Use Version Control

  • Save important scripts to source control

  • Document what your scripts do

  • Share scripts with your team

Review Security

Next Steps

Now that you're up and running:

  1. Learn the syntax: Language Basics

  2. Master commands: Commands and Pipelines

  3. Understand providers: Providers

  4. Write your first scripts: Your First Scripts

  5. Avoid mistakes: Common Pitfalls

Quick Reference

Essential Commands

Command
Description

Get-Item

Returns an object at the specified path.

Get-ChildItem

Returns children at the specified path. Supports recursion.

Get-Help

Returns the help documentation for the specified command or document.

Get-Command

Returns a list of commands.

ForEach-Object

Enumerates over the objects passed through the pipeline.

Where-Object

Enumerates over the objects passed through the pipeline and filters objects.

Select-Object

Returns objects from the pipeline with the specified properties and filters objects.

Sort-Object

Sorts the pipeline objects with the specified criteria; usually a property name.

Get-Member

Returns the methods and properties for the specified object.

Path Format

Special Variables

Ready to dive deeper? Continue with Language Basics!

Last updated