Providers
Understanding PowerShell providers and the Sitecore provider.
The provider architecture in PowerShell enables a developer to make a command like Get-Item interact with the filesystem files and folders, and then interact with the Sitecore CMS items. This is one of the most powerful concepts in PowerShell!
What is a Provider?
A provider is an adapter that makes a data store look like a drive. Think of it like this:
File system provider: Makes
C:\look like a navigable driveRegistry provider: Makes
HKLM:\look like a navigable driveSitecore provider: Makes
master:\look like a navigable drive
This means you can use the same commands (Get-Item, Get-ChildItem, etc.) to work with files, registry keys, and Sitecore items!
Available Providers
The SPE module implements a new provider that bridges the Windows PowerShell platform with the Sitecore API. The following table demonstrates the use of Get-Item for a variety of providers.
Alias
Alias
Get-Item -Path alias:\dir
Sitecore
core, master, web
Get-Item -Path master:\
Environment
Env
Get-Item -Path env:\HOMEPATH
FileSystem
C, D, F, H
Get-Item -Path c:\Windows
Function
Function
Get-Item -Path function:\prompt
Registry
HKLM, HKCU
Get-Item -Path hklm:\SOFTWARE
Variable
Variable
Get-Item -Path variable:\PSVersionTable
The Sitecore Provider
The most important provider for SPE is named Sitecore. This provider gives you access to Sitecore databases.
Default Provider
The default provider used by the PowerShell Console and ISE is Sitecore with the drive set to the master database.
Database Drives
The Sitecore provider exposes these databases as drives:
Path Format
Sitecore provider paths follow this format:
Examples:
Switching Between Providers
Example: The following demonstrates switching between providers using the function cd, an alias for Set-Location, while in the Console.
You may have noticed that the C drive is the only path in which a backslash was used before changing drives. Leaving off the backslash will result in the path changing to C:\windows\system32\inetsrv. This similar behavior can be experienced while in the Windows PowerShell Console, where the path is changed to C:\Windows\System32.
Working with the Sitecore Provider
Getting Items
Creating Items
Removing Items
Testing if Item Exists
Provider-Specific Features
While all providers support basic operations like Get-Item and Get-ChildItem, some have special features:
Sitecore Provider Features
File System Provider Features
Why Providers Matter
Understanding providers is crucial because:
Same commands work everywhere - Learn
Get-Itemonce, use it for files, registry, and SitecorePath-based navigation - Everything has a path you can navigate
Consistent patterns - If it works on files, it probably works on Sitecore items
Powerful automation - Combine providers to move data between systems
Example: Cross-Provider Automation
Common Provider Operations
Get item
Get-Item C:\file.txt
Get-Item master:\content\home
List children
Get-ChildItem C:\
Get-ChildItem master:\content
Create
New-Item C:\file.txt
New-Item master:\content\home\item
Remove
Remove-Item C:\file.txt
Remove-Item master:\content\home\item
Test exists
Test-Path C:\file.txt
Test-Path master:\content\home\item
Move
Move-Item C:\old.txt C:\new.txt
Move-Item master:\a master:\b
Copy
Copy-Item C:\old.txt C:\new.txt
Copy-Item master:\a master:\b
Learn More
This introduction covers the basics of the provider architecture and how to use paths in SPE.
For comprehensive details about working with the Sitecore provider (item fields, languages, versions, wildcards, performance optimization, and advanced techniques), see the complete guide: Working with Items - Providers
Next Steps
Now that you understand providers:
Practice with examples: Your First Scripts
Avoid common mistakes: Common Pitfalls
Deep dive into items: Working with Items
Read comprehensive provider docs: Providers
Last updated