Working with Items
The Sitecore PowerShell Extensions (SPE) module provides powerful cmdlets for managing Sitecore content items. This section covers everything you need to know about working with items programmatically.
Quick Start
The core item management cmdlets mirror standard PowerShell conventions:
Get-Item
Retrieve a single item
Get-Item -Path "master:\content\home"
Get-ChildItem
Retrieve children and descendants
Get-ChildItem -Path "master:\content" -Recurse
New-Item
Create a new item
New-Item -Path "master:\content\home" -Name "Page" -ItemType "Sample/Sample Item"
Set-ItemProperty
Update item properties
Set-ItemProperty -Path "master:\content\home" -Name "Title" -Value "Welcome"
Copy-Item
Duplicate an item
Copy-Item -Path "master:\content\home\source" -Destination "master:\content\home\target"
Move-Item
Transfer an item
Move-Item -Path "master:\content\home\old" -Destination "master:\content\home\new"
Remove-Item
Delete or recycle an item
Remove-Item -Path "master:\content\home\demo" -Permanently
Documentation Topics
Fundamentals
Before working with items, understand these foundational concepts:
Providers - PowerShell providers and navigating Sitecore databases
Variables - Built-in variables available in SPE scripts
Core Item Operations
Learn how to perform essential item operations:
Retrieving Items - Find items by path, ID, query, or URI
Editing Items - Update properties, work with field types, and manage versions
Creating and Removing Items - Create new items and delete existing ones
Moving and Copying Items - Transfer and duplicate items
Specialized Operations
Handle specific aspects of item management:
Item Languages - Add, remove, and manage language versions
Item Renderings - Work with presentation details and renderings
Item Security - Manage item permissions and access control
Advanced Topics
Optimize your scripts and follow best practices:
Best Practices - Performance optimization, bulk operations, and coding patterns
Common Patterns
Pattern: Find and Update Items
Pattern: Bulk Create Items
Pattern: Copy Content Between Databases
Pattern: Audit and Report
Dynamic Parameters
SPE extends standard PowerShell cmdlets with dynamic parameters specific to Sitecore. These parameters appear based on context:
Language - Specify language versions (
-Language "en-US"or-Language *)Version - Specify item versions (
-Version 2or-Version *)Database - Target specific databases when using IDs
Query - Execute Sitecore queries (
query:orfast:)ID - Work with items by GUID
Uri - Use ItemUri for complete item identification
See the Retrieving Items page for detailed parameter documentation.
Path Formats
SPE supports multiple path formats for flexibility:
Note: The /sitecore portion is optional when using provider paths.
Working with Field Types
SPE provides intelligent handling of Sitecore field types through automated PowerShell properties:
See Editing Items for comprehensive field type examples.
Performance Considerations
When working with large datasets, consider these performance tips:
Use
fast:queries instead ofGet-ChildItem -Recursewhen possibleLeverage
BulkUpdateContextfor multiple updatesUse
SecurityDisablerjudiciously for read operationsBatch operations and provide progress feedback
See Best Practices for detailed performance guidance.
See Also
Security - Securing SPE and managing users/roles
Appendix - Common - Core cmdlet reference
Appendix - Security - Security cmdlet reference
Remoting - Automate item operations remotely
Getting Help
Last updated