Your First Scripts
Hands-on examples to get you started with practical Sitecore automation.
Example 1: Find Items Ready for Review
# Navigate to the home item
$homeItem = Get-Item -Path "master:\content\home"
# Get all descendants
$items = Get-ChildItem -Path $homeItem.ProviderPath -Recurse
# Filter items in "Draft" workflow state
$draftItems = $items | Where-Object {
$_.Fields["__Workflow state"] -ne $null -and
$_."__Workflow state" -match "{190B1C84-F1BE-47ED-AA41-F42193D9C8FC}"
}
# Display results in an interactive list
$draftItems | Show-ListView -Property Name, ItemPath, "__Updated", "__Updated by"Example 2: Bulk Update Item Fields
Example 3: Interactive User Input
Try It Yourself
Step 1: Open the ISE
Step 2: Run Your First Command
Step 3: Execute the Script
Step 4: Explore the Results
Practice Exercises
Exercise 1: Find Empty Items
Exercise 2: Count Items by Template
Exercise 3: Export Item Data
Common Patterns
Pattern: Safe Item Editing
Pattern: Check if Item Exists
Pattern: Process Items with Progress
Next Steps
Last updated