Community
See some of the community contributed modules built for SPE.
There are some really amazing contributions and add-ons to SPE from the community.

Unicorn

SPE + Unicorn
A well known and widely adopted module Unicorn has published some SPE commands. These commands are available (and optional) after installing Unicorn. Below are some samples ripped off from Kam Figy's blog posts here and here.

Configurations

Example: The following lists configurations by name.
1
# Default returns all configurations
2
Get-UnicornConfiguration
3
4
# Exact match
5
Get-UnicornConfiguration -Filter "Foundation.Foo"
6
7
# Filter using a wildcard
8
Get-UnicornConfiguration -Filter "Foundation.*"
Copied!

Syncing

Example: The following syncs configurations just like you would through the Unicorn Control Panel or the PowerShell API.
1
# Sync one
2
Sync-UnicornConfiguration "Foundation.Foo"
3
4
# Sync multiple by name
5
Sync-UnicornConfiguration @("Foundation.Foo", "Foundation.Bar")
6
7
# Sync multiple from pipeline
8
Get-UnicornConfiguration "Foundation.*" | Sync-UnicornConfiguration
9
10
# Sync all, except transparent sync-enabled configurations
11
Get-UnicornConfiguration | Sync-UnicornConfiguration -SkipTransparent
12
13
# Optionally set log output level (Debug, Info, Warn, Error)
14
Sync-UnicornConfiguration -LogLevel Warn
Copied!
Example Syncing

Partial Syncing

1
# Sync a single item (note: must be under Unicorn control)
2
Get-Item "/sitecore/content" | Sync-UnicornItem
3
4
# Sync multiple single items (note: all must be under Unicorn control)
5
Get-ChildItem "/sitecore/content" | Sync-UnicornItem
6
7
# Sync an entire item tree, show only warnings and errors
8
Get-Item "/sitecore/content" | Sync-UnicornItem -Recurse -LogLevel Warn
Copied!

Reserializing

1
# Reserialize one
2
Export-UnicornConfiguration "Foundation.Foo"
3
4
# Reserialize multiple by name
5
Export-UnicornConfiguration @("Foundation.Foo", "Foundation.Bar")
6
7
# Reserialize from pipeline
8
Get-UnicornConfiguration "Foundation.*" | Export-UnicornConfiguration
Copied!

Partial Reserializing

1
# Reserialize a single item (note: must be under Unicorn control)
2
Get-Item "/sitecore/content" | Export-UnicornItem
3
4
# Reserialize multiple single items (note: all must be under Unicorn control)
5
Get-ChildItem "/sitecore/content" | Export-UnicornItem
6
7
# Reserialize an entire item tree
8
Get-Item "/sitecore/content" | Export-UnicornItem -Recurse
Copied!

Converting to Raw Yaml

1
# Convert an item to YAML format (always uses default excludes and field formatters)
2
Get-Item "/sitecore/content" | ConvertTo-RainbowYaml
3
4
# Convert many items to YAML strings
5
Get-ChildItem "/sitecore/content" | ConvertTo-RainbowYaml
6
7
# Disable all field formats and field filtering
8
# (e.g. disable XML pretty printing,
9
# and don't ignore the Revision and Modified fields, etc)
10
Get-Item "/sitecore/content" | ConvertTo-RainbowYaml -Raw
Copied!
Converting To Yaml

Converting from Raw Yaml

1
# Get IItemDatas from YAML variable
2
$rawYaml | ConvertFrom-RainbowYaml
3
4
# Get IItemData and disable all field filters
5
# (use this if you ran ConvertTo-RainbowYaml with -Raw)
6
$yaml | ConvertFrom-RainbowYaml -Raw
Copied!
Converting from Yaml

Deserialization

1
# Deserialize IItemDatas from ConvertFrom-RainbowYaml
2
$rawYaml | ConvertFrom-RainbowYaml | Import-RainbowItem
3
4
# Deserialize raw YAML from pipeline into Sitecore
5
# Shortcut bypassing ConvertFrom-RainbowYaml
6
$yaml | Import-RainbowItem
7
8
# Deserialize and disable all field filters
9
# (use this if you ran ConvertTo-RainbowYaml with -Raw)
10
$yaml | Import-RainbowItem -Raw
11
12
# Deserialize multiple at once
13
$yamlStringArray | Import-RainbowItem
14
15
# Complete example that does nothing but eat CPU
16
Get-ChildItem "/sitecore/content" | ConvertTo-RainbowYaml | Import-RainbowItem
Copied!
Deserialization

Packaging

1
# Create a new Sitecore Package (SPE cmdlet)
2
$pkg = New-Package -Name MyCustomPackage
3
4
# Get the Unicorn Configuration(s) we want to package
5
$configs = Get-UnicornConfiguration "Foundation.*"
6
7
# Pipe the configs into New-UnicornItemSource
8
# to process them and add them to the package project
9
# (without -Project, this would emit the source object(s)
10
# which can be manually added with $pkg.Sources.Add())
11
$configs | New-UnicornItemSource -Project $pkg
12
13
# Export the package to a zip file on disk
14
Export-Package -Project $pkg -Path "C:\foo.zip" -Zip
Copied!

SPE Modules

The following are Sitecore modules that enhance the SPE experience.
Last modified 2yr ago