Sei sulla pagina 1di 463

Sitecore

PowerShell Extensions

Table of Contents
1. Introduction
2. Installation
i. Contributor Guide
3. Interfaces
i. Command Line Console
ii. Integrated Scripting Environment
iii. Interactive Dialogs
4. Working with Items
i. Item Languages
5. Toolbox
6. Modules
7. Reports
i. Authoring Reports
8. Remoting
9. Tasks
i. Authoring Tasks
10. Security
11. Releases
12. Troubleshooting
13. Appendix
i. Add-ItemAcl
ii. Add-ItemLanguage
iii. Add-Rendering
iv. Add-RoleMember
v. Clear-ItemAcl
vi. Close-Window
vii. ConvertFrom-CliXml
viii. ConvertFrom-ItemClone
ix. ConvertTo-CliXml
x. Disable-User
xi. Enable-User
xii. Expand-Token
xiii. Export-Item
xiv. Export-Package
xv. Export-Role
xvi. Export-UpdatePackage
xvii. Export-User
xviii. Find-Item
xix. Get-Archive
xx. Get-Cache
xxi. Get-Database
xxii. Get-Domain
xxiii. Get-ItemAcl
xxiv. Get-ItemClone
xxv. Get-ItemField
xxvi. Get-ItemReference
xxvii. Get-ItemReferrer
xxviii. Get-ItemTemplate
xxix. Get-ItemWorkflowEvent

2
Sitecore PowerShell Extensions

xxx. Get-Layout
xxxi. Get-LayoutDevice
xxxii. Get-Package
xxxiii. Get-Preset
xxxiv. Get-Rendering
xxxv. Get-Role
xxxvi. Get-RoleMember
xxxvii. Get-ScriptSession
xxxviii. Get-SearchIndex
xxxix. Get-Session
xl. Get-SpeModule
xli. Get-SpeModuleFeatureRoot
xlii. Get-TaskSchedule
xliii. Get-UpdatePackageDiff
xliv. Get-User
xlv. Get-UserAgent
xlvi. Import-Function
xlvii. Import-Item
xlviii. Import-Role
xlix. Import-User
l. Initialize-Item
li. Initialize-SearchIndex
lii. Install-Package
liii. Install-UpdatePackage
liv. Invoke-Script
lv. Invoke-ShellCommand
lvi. Invoke-Workflow
lvii. Lock-Item
lviii. Login-User
lix. Logout-User
lx. New-Domain
lxi. New-ExplicitFileSource
lxii. New-ExplicitItemSource
lxiii. New-FileSource
lxiv. New-ItemAcl
lxv. New-ItemClone
lxvi. New-ItemSource
lxvii. New-ItemWorkflowEvent
lxviii. New-Package
lxix. New-Rendering
lxx. New-Role
lxxi. New-SecuritySource
lxxii. New-User
lxxiii. Protect-Item
lxxiv. Publish-Item
lxxv. Read-Variable
lxxvi. Receive-File
lxxvii. Receive-ScriptSession
lxxviii. Remove-Domain
lxxix. Remove-ItemLanguage
lxxx. Remove-Rendering
lxxxi. Remove-Role
lxxxii. Remove-RoleMember

3
Sitecore PowerShell Extensions

lxxxiii. Remove-ScriptSession
lxxxiv. Remove-Session
lxxxv. Remove-User
lxxxvi. Reset-ItemField
lxxxvii. Reset-Layout
lxxxviii. Restart-Application
lxxxix. Resume-SearchIndex
xc. Send-File
xci. Send-SheerMessage
xcii. Set-HostProperty
xciii. Set-ItemAcl
xciv. Set-Layout
xcv. Set-Rendering
xcvi. Set-User
xcvii. Set-UserPassword
xcviii. Show-Alert
xcix. Show-Application
c. Show-Confirm
ci. Show-FieldEditor
cii. Show-Input
ciii. Show-ListView
civ. Show-ModalDialog
cv. Show-Result
cvi. Show-YesNoCancel
cvii. Start-ScriptSession
cviii. Start-TaskSchedule
cix. Stop-ScriptSession
cx. Stop-SearchIndex
cxi. Suspend-SearchIndex
cxii. Test-Account
cxiii. Test-ItemAcl
cxiv. Test-Rule
cxv. Unlock-Item
cxvi. Unlock-User
cxvii. Unprotect-Item
cxviii. Update-ListView
cxix. Wait-ScriptSession
cxx. Write-Log
14. Glossary

4
Sitecore PowerShell Extensions

Sitecore PowerShell Extensions


The Sitecore PowerShell Extensions (SPE) module is a Sitecore development accelerator which can drastically increase
your productivity and curtail the amount of time it takes to deliver a Sitecore solution.

The module provides a command line (CLI) and scripting environment (ISE) for automating tasks. SPE works with the
Sitecore process, capable of making native calls to the Sitecore API and manipulating files. Running commands and writing
scripts follow the standard and well-known Windows PowerShell syntax. Windows PowerShell is a common tool used in IT
for desktop and server management, so we decided to stick with that as a framework to build upon.

Below are some of the things you get with SPE:

Index Viewer
Scheduled Task Manager
Package Creator
Report Runner
User Session Manager
Bulk Rename/Remove/Create Tool
Data Importer
Professional Chef

Endorsements

"There is nothing you can not do with PowerShell Console, because you're inside the Sitecore application. You can call the
Sitecore API" - Alistair Deneys - Sitecore Symposium 2012

Recommended by John West to use as a tool for maximizing Sitecore developer productivity.

" Get a job done with a one liner! Just provisioned a new language for the whole content tree with a one-liner. Whaaaat?
Have to include it as a default install for all sandboxes now." - Alex Shyba's comment on Marketplace

"Thank you for the GitBook. Invaluable Reference." - Nick Wesselman's tweet

Training Material

The following book should provide you with enough information to use and be productive with SPE. Don't worry, you will be
able to use it without having to write any code.

We have a video series available to help walk you through the module here.

We also maintain a comprehensive list of links to blogs and videos to help you on your journey to SPE awesomeness.
Happy coding!

Development Team

Adam Najmanowicz | @adamnaj


Michael West | @michaelwest101

Help and Support

See the Troubleshooting section for some common fixes.

Introduction 5
Sitecore PowerShell Extensions

Questions, comments, and feature requests should be submitted on GitHub.

Introduction 6
Sitecore PowerShell Extensions

Installation
Prerequisites

Windows 7+
Microsoft .NET Framework 4+ : Download
Windows Management Framework 3+ : Download
The link provided will get you up to PowerShell 4
Detecting your PowerShell version
PowerShell Execution Policy set to RemoteSigned

Download the Module

The SPE module installs like any other for Sitecore.

Download the module from the Sitecore Marketplace and install through the Installation Wizard.

Following the installation you'll find these new items added to the Sitecore menu:

Sitecore -> PowerShell Console


Sitecore -> PowerShell Toolbox
Sitecore -> Development Tools -> PowerShell ISE
Sitecore -> Reporting Tools -> PowerShell Reports

Compile Your Own Binaries

You may also clone the project from GitHub and compile it. This allows you to access the latest functionality without waiting
for a new release. See the following contributor guide for instructions on how to get up and running.

Troubleshooting

See the troubleshooting section here

Installation 7
Sitecore PowerShell Extensions

Contributor Guide
The following guide should provide you with enough information to setup a development environment configured to
contribute to SPE. We'll begin with a single installation of Sitecore 8+. Adam wrote an article (written March 2015) that goes
into great detail about the installation steps, so we went ahead and added it to the book.

The solution requires Visual Studio 2015.

Single Instance

1. Meet the prerequisites found here


2. Install Sitecore 8+ to C:\inetpub\wwwroot\Console
3. Fetch source code to installation path

cd "C:\inetpub\wwwroot\Console"
git init
git remote add origin https://github.com/SitecorePowerShell/Console.git
git fetch origin
git checkout -b master --track origin/master

4. Copy C:\inetpub\wwwroot\Console\deploy.targets.sample to C:\inetpub\wwwroot\Console\deploy.targets


5. Edit the paths in deploy.targets with the appropriate SitecorePath and LibrariesPath
6. Copy Sitecore dependencies to C:\inetpub\wwwroot\Console\Libraries
Sitecore.Analytics.dll
Sitecore.Client.dll
Sitecore.ContentSearch.dll
Sitecore.ContentSearch.Linq.dll
Sitecore.ExperienceEditor.dll
Sitecore.Kernel.dll
Sitecore.Logging.dll
Sitecore.NVelocity.dll
Sitecore.Update.dll
7. Run the Windows PowerShell script as an Administrator

. C:\inetpub\wwwroot\Console\Setup-Folders.ps1

8. Compile the solution in Visual Studio


Because SPE supports Sitecore 7+, you'll need to unload the Cognfide.PowerShell.Sitecore7 project or setup the
reference path for Sitecore 7.x libraries. We'll see that later on in this tutorial.
9. Sync Sitecore items with the Windows PowerShell script as an Administrator

. C:\inetpub\wwwroot\Console\Setup-Module.ps1

10. Navigate to http://console/sitecore/login and verify that SPE works as expected.

Multiple Instance

1. Meet the prerequisites found here


2. Install Sitecore 7+ to the following paths
C:\inetpub\wwwroot\Sitecore8

C:\inetpub\wwwroot\Sitecore75

C:\inetpub\wwwroot\Sitecore70

Contributor Guide 8
Sitecore PowerShell Extensions

3. Fetch source code to installation path

cd "C:\Projects\SitecorePowerShell\"
git init
git remote add origin https://github.com/SitecorePowerShell/Console.git
git fetch origin
git checkout -b master --track origin/master

4. Copy C:\Projects\SitecorePowerShell\deploy.targets.sample to C:\Projects\SitecorePowerShell\deploy.targets


5. Edit the paths in deploy.targets with the appropriate SitecorePath and LibrariesPath
6. Copy Sitecore dependencies to C:\Projects\SitecorePowerShell\Libraries with a subfolder for each Sitecore version
(i.e. \SC8, \SC75, \SC7). Use the reference path in Visual Studio to match the right assembly versions in
Cognifide.PowerShell.Sitecore7 and Cognifide.PowerShell.Sitecore8 . Not doing so will result in error messages related

to those projects.
Sitecore.Analytics.dll
Sitecore.Client.dll
Sitecore.ContentSearch.dll
Sitecore.ContentSearch.Linq.dll
Sitecore.ExperienceEditor.dll
Sitecore.Kernel.dll
Sitecore.Logging.dll
Sitecore.NVelocity.dll
Sitecore.Update.dll
7. Run the Windows PowerShell script as an Administrator. Modifications to the script may be necessary to support your
installation paths.

. C:\inetpub\wwwroot\Console\Setup-Folders.ps1

8. Compile the solution in Visual Studio


9. Sync Sitecore items with the Windows PowerShell script as an Administrator. Modifications to the script may be
necessary to support your installation urls.

. C:\inetpub\wwwroot\Console\Setup-Module.ps1

10. Navigate to each of your installation urls and verify that SPE works as expected.

Contributor Guide 9
Sitecore PowerShell Extensions

Interfaces
Here we'll discuss the Console, ISE, and other dialogs made available through SPE.

Figure - PowerShell Console

Figure - PowerShell ISE

Interfaces 10
Sitecore PowerShell Extensions

Console
The SPE Console is a command line interface (CLI) designed for efficiency. The console provides a streamlined tool for
working within Windows PowerShell and Sitecore.

Figure - PowerShell Console

Providers

You can interact with the providers available in the standard Windows PowerShell Console. Below are some of the
important providers.Run the command Get-PSProvider to see the complete list.

FileSystem - Supports interacting with files and folders.


CmsItemProvider - Supports interacting with the Sitecore content items.

The console prompt typically begins with PS master:\> . The present working directory is using the CmsItemProvider and
set to the master database.

Example: Change directories between providers.

PS master:\> cd core:
PS core:\> cd C:
PS C:\windows\system32\inetsrv> Set-Location -Path master:
PS master:\>

Note: Include the backslash in the path (i.e. C:\) to get the root of the drive when interacting with the FileSystem provider;
the behavior seen is different than you might expeect because of w3wp.exe. See issue #314.

Variables

Command Line Console 11


Sitecore PowerShell Extensions

SPE provides some convenient variables out of the box for use in running commands and scripts. The variables prefixed
with Sitecore derive from the Web.config settings. Run the command Get-Variable to see the complete list.

Variable Example

AppPath C:\Inetpub\wwwroot\Console\Website\

Me sitecore\admin

PWD master:\

SitecoreDataFolder C:\Inetpub\wwwroot\Console\Data\

SitecoreDebugFolder C:\Inetpub\wwwroot\Console\Data\/debug

SitecoreIndexFolder C:\Inetpub\wwwroot\Console\Data\/indexes

SitecoreLayoutFolder C:\Inetpub\wwwroot\Console\Website\layouts

SitecoreLogFolder C:\Inetpub\wwwroot\Console\Data\/logs

SitecoreMediaFolder C:\Inetpub\wwwroot\Console\Website\upload

SitecorePackageFolder C:\Inetpub\wwwroot\Console\Data\/packages

SitecoreSerializationFolder C:\Inetpub\wwwroot\Console\Data\/serialization

SitecoreTempFolder /temp

Note: Any new variables created are stored within the session of console instance; when the session ends the variables
are removed.

Shortcuts

Below are the shortcuts available in the console.

Shortcut Usage

TAB Autocomplete commands. Press tab again to cycle through commands.

Up Arrow/Ctrl-P Show previous command from history

Down Arrow/Ctrl-N Show next command from history

Delete/backspace Remove one character from right/left to the cursor

Left Arrow/Ctrl-B Move cursor to the left

Right Arrow/Ctrl-F Move cursor to the right

Ctrl-Left Arrow Move cursor to previous word

Ctrl-Right Arrow Move cursor to next word

Ctrl-A/Home Move cursor to the beginning of the line

Ctrl-E/End Move cursor to the end of the line

Ctrl-K/Ctrl-H Remove the text after the cursor

Ctrl-U Remove the text before the cursor

Ctrl-V Insert text from the clipboard

Ctrl-Alt-Shift + Increase the font size

Ctrl-Alt-Shift - Decrease the font size

Command Line Console 12


Sitecore PowerShell Extensions

Scripting
Once you move beyond running a single commands, you will begin to combine those into scripts for automation. The
Integrated Scripting Environment (ISE) is a great way to group together commands and save for later use. The ISE is a
beefed up version of the Console.

Here's a quick look at the ISE:

Figure - PowerShell ISE

Now let's review each of the different features; take note of the numbered labels:

Figure - ISE Home Tab

Integrated Scripting Environment 13


Sitecore PowerShell Extensions

Figure - ISE Settings Tab

1. Write:
New - Creates a new script or module.
Open - Opens an existing script for the library.
Save - Saves the current script to the library.
Save As - Saves a copy of the current script to the library.
Reload - Opens the original copy of the current script without saving any modifications.
2. Script:
Execute - Runs the current script as a background job or in the http context.
Abort - Stops the execution of an executing script.
Runtime
3. Context:
Context - Specifies the current item in the script. Often denoted as a . (dot) or $pwd (present working directory).
Session - Specifies the session to use when executing the script. Reused sessions live in the HttpSession.
4. Script:
This is where you type all the commands for the script.
5. Output:
This is where you see the output of your script.
6. The Home and Settings tabs.
7. Tips:
This is where you find helpful shortcuts.
8. Line and Column:
This indicates the current position of the cursor.
9. Splitter:
This is where you change the height of the output pane.
10. Preferences:
Settings - Specifies the console, ise, and results look and behave.
11. Integration:
Rebuild All - Rebuilds the gutter, ribbon, and control panel integration.

Shortcuts
Integrated Scripting Environment 14
Sitecore PowerShell Extensions

Below are the shortcuts available in the console.

Shortcut Usage

TAB Indent

Ctrl-Space Autocomplete commands. Use the up or down direction keys to cycle through options.

Ctrl-Enter Displays the command help window.

Ctrl-Z Undo the previous change.

Ctrl-Alt-Shift + Increase the font size

Ctrl-Alt-Shift - Decrease the font size

Ctrl-E Executes the script

Alt-E Executes the selected text in the script

Ctrl-Shift-E Aborts the running script

Ctrl-F Search for keywords in the script

For more commands built into the script editor see here

Integrated Scripting Environment 15


Sitecore PowerShell Extensions

Interactive Dialogs
We've provided a few commands to interact with the user through dialogs.

Alert

Example: The following display a modal dialog.

Show-Alert -Title "SPE is great!"

No return value.

Figure - Show Alert

Variable Settings

Example: The following displays a dialog with a dropdown.

Note: The name selectedOption will result in a variable that contains the selected option.

$options = @{
"A"="a"
"B"="b"
}

$props = @{
Parameters = @(
@{Name="selectedOption"; Title="Choose an option"; Options=$options; Tooltip="Choose one."}
)
Title = "Option selector"
Description = "Choose the right option."
Width = 300
Height = 300
ShowHints = $true
}

Read-Variable @props

Button Name Return Value

OK ok

Interactive Dialogs 16
Sitecore PowerShell Extensions

Cancel cancel

< variables > < selection >

Figure - Read Variable

Confirmation

Example: The following displays a modal dialog with an OK or Cancel confirmation.

Show-Confirm -Title "Click OK to acknowledge SPE is great!"

Button Name Return Value

OK yes

Cancel no

Figure - Show Confirm

Interactive Dialogs 17
Sitecore PowerShell Extensions

Confirmation Choice

Example: The following displays a modal dialog with choices.

Show-ModalDialog -Control "ConfirmChoice" -Parameters @{btn_0="Yes (returns btn_0)"; btn_1="No (returns btn_1)"; btn_2=

Note: The hashtable keys should be incremented like btn_0, btn_1, and so on. The return value is the key name.

Button Name Return Value

< first button > btn_0

< second button > btn_1

< third button > btn_2

Figure - Show Confirm Choice

Upload

Example: The following displays an advanced upload dialog.

Receive-File (Get-Item "master:\media library\Files") -AdvancedDialog

No return value.

Interactive Dialogs 18
Sitecore PowerShell Extensions

Figure - Receive File

Download

Example: The following displays a download dialog.

Get-Item -Path "master:\media library\Files\readme" | Send-File

Interactive Dialogs 19
Sitecore PowerShell Extensions

Figure - Download

Field Editor

Example: The following displays a field editor dialog.

Get-Item "master:\content\home" | Show-FieldEditor -Name "*" -PreserveSections

Button Name Return Value

OK ok

Cancel cancel

Interactive Dialogs 20
Sitecore PowerShell Extensions

Figure - Show Field Editor

User Input

Example: The following displays an input dialog for text.

Show-Input "Please provide 5 characters at most" -MaxLength 5

Button Name Return Value

OK < user input >

Cancel $null

Interactive Dialogs 21
Sitecore PowerShell Extensions

Figure - Show Input

File Browser

Example: The following displays a file browser dialog for installation packages.

Show-ModalDialog -HandleParameters @{
"h"="Create an Anti-Package";
"t" = "Select a package that needs an anti-package";
"ic"="People/16x16/box.png";
"ok"="Pick";
"ask"="";
"path"= "packPath:$SitecorePackageFolder";
"mask"="*.zip";
} -Control "Installer.Browse"

Button Name Return Value

OK < selected file >

Cancel undetermined

Interactive Dialogs 22
Sitecore PowerShell Extensions

Figure - Show File Browser

Example: The following displays a simple file browser dialog.

Show-ModalDialog -HandleParameters @{
"h"="FileBrowser";
} -Control "FileBrowser" -Width 500

Button Name Return Value

OK < selected file >

Cancel undetermined

Interactive Dialogs 23
Sitecore PowerShell Extensions

Figure - Show File Browser

Data List

Example: The following displays a list view dialog with the child items under the Sitecore tree.

Get-Item -Path master:\* | Show-ListView -Property Name, DisplayName, ProviderPath, TemplateName, Language

Interactive Dialogs 24
Sitecore PowerShell Extensions

Figure - Show List View

Results

Show-Result

Interactive Dialogs 25
Sitecore PowerShell Extensions

Working with Sitecore items


How do I manage my content through PowerShell?

The following commands provide you with the core methods needed to manage your content. Due to the nature of
Windows PowerShell, commands such as these are extended with custom parameters and switches using Dynamic
Parameters. These parameters are then added to the command at the time of use and only appear when the conditions are
right. We've provided this table to help you discover the hidden gems within each command.

Parameter Copy- Get- Get- Move- New- Remove-


Description
Name Item Item ChildItem Item Item Item

More than one item


AmbiguousPaths matches the criteria
so show them all.

The specified
database will be
Database
used. Requires the ID
to be set.

Parent item to receive


DestinationItem
the copied item.

Unauthorized access
FailSilently errors will be
suppressed

Matches the item by


ID
ID.

Item Instance item.

Specifies the
Language
languages to include.

Specifies the parent


Parent
item.

Specifies the item


Permanently should be deleted
rather than recycled.

Matches the items by


Query
an XPath query.

Initiates the default


StartWorkflow
workflow, if any.

Options flag used


when copying from
TransferOptions
one database to
another.

Matches the item by


Uri
ItemUri.

Specifies the version


Version
to include.

Legend: "" - not supported; "" - supported.

Below we will show how to use each command with the Windows PowerShell syntax followed by some examples of the
common C# equivalent.

Working with Items 26


Sitecore PowerShell Extensions

If you have retrieved your items directly using the Sitecore API you can still add the nice wrapper. You can do that by piping
them through the Initialize-Item command.

Get items by Path

Example: The following will retrieve the item based on the Sitecore path.

PS master:\> Get-Item -Path master:\content\home

Name Children Languages Id TemplateName


---- -------- --------- -- ------------
Home True {en, de-DE, es-ES, pt... {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item

As you may have noticed, the /sitecore portion of the path is unnecessary. This is because the Sitecore item is
represented by the root item of the drive master: and is therefore optional.

Let's have a look at the equivalent code in C#.

Sitecore.Data.Database master = Sitecore.Configuration.Factory.GetDatabase("master");


Sitecore.Data.Items.Item item = master.GetItem("/sitecore/content/home");

The above will return the latest version of the item in your current language. But what if you want the item in another
language? No problem!

Example: The following will retrieve the Danish version of the Home item.

PS master:\> Get-Item -Path master:/content/home -Language da | Format-Table DisplayName, Language, Id, Version, TemplateName

DisplayName Language ID Version TemplateName


----------- -------- -- ------- ------------
Hjem da {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item

I've formatted the output above to show you that indeed the right language was returned. The command supports wildcards
for both -Language and -Version parameters. You may have also noticed that the forward and backward slashes can be
used interchangeably.

Example: The following retrieves the latest version for all languages of an item.

PS master:\> Get-Item master:/content/home -Language * | Format-Table DisplayName, Language, Id, Version, TemplateName

DisplayName Language ID Version TemplateName


----------- -------- -- ------- ------------
Home en {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item
Home de-DE {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item
Home pl-PL {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item
Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 3 Sample Item
Home en-GB {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item
Hjem da {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item

Notice that the item with language en-US at its third version.

Example: The following retrieves the item in all languages and versions.

Working with Items 27


Sitecore PowerShell Extensions

PS master:\> Get-Item master:/content/home -Language * -Version *| Format-Table DisplayName, Language, Id, Version, TemplateName

DisplayName Language ID Version TemplateName


----------- -------- -- ------- ------------
Home en {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item
Home de-DE {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item
Home pl-PL {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item
Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item
Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 2 Sample Item
Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 3 Sample Item
Home en-GB {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item
Hjem da {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item

You can see that specifying the language and version using the wildcard will retrieve all possible variants of an item. The
wildcard can also include a partial match like en-* . The use of that filter would return all items in the English language,
ignoring the region.

Example: The following retrieves the child items in all languages and versions.

PS master:\> Get-ChildItem master:/content -Language * -Version * | Format-Table DisplayName, Language, Id, Version, TemplateName

DisplayName Language ID Version TemplateName


----------- -------- -- ------- ------------
Home en {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item
Home de-DE {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item
Home pl-PL {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item
Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item
Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 2 Sample Item
Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 3 Sample Item
Home en-GB {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item
Hjem da {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item
CognifideCom en {6A1EC18E-AF9B-443E-84C7-5528F2363A10} 1 TenantTemplate
Demo en {4F02AEDF-1CC6-4B84-8B6E-F5CB465F8AD9} 1 TenantTemplate
GetEngaged en {68AD4037-EE50-4615-BA2E-AE11B1D3F6CC} 1 TenantTemplate
GetEngaged de-DE {68AD4037-EE50-4615-BA2E-AE11B1D3F6CC} 1 TenantTemplate
GetEngaged es-ES {68AD4037-EE50-4615-BA2E-AE11B1D3F6CC} 1 TenantTemplate
GetEngaged pt-BR {68AD4037-EE50-4615-BA2E-AE11B1D3F6CC} 1 TenantTemplate
GetEngaged pl-PL {68AD4037-EE50-4615-BA2E-AE11B1D3F6CC} 1 TenantTemplate

Getting items by Path with Sitecore query

It's not always most efficient to operate on items by traversing the tree using Get-ChildItem . This is especially true if you
need to work on large trees but need to select only a few items (e.g. a specific template). For this weve introduced support
for the Sitecore query within our provider.

Example: The following retrieves all items beneath the path /sitecore/content/ with the template of Sample Item.

PS master:\> Get-Item -Path master: -Query "/sitecore/content//*[@@templatename='Sample Item']"

Name Children Languages Id TemplateName


---- -------- --------- -- ------------
Copy of Home True {en, de-DE, es-ES, pt... {503713E5-F9EE-4847-AEAF-DD13FD853004} Sample Item
Home True {en, de-DE, es-ES, pt... {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item

Example: The following retrieves all items beneath the path /sitecore/content/ with the template of Sample Item in all
versions and languages.

PS master:\> Get-Item -Path master: -Query "/sitecore/content//*[@@templatename='Sample Item']" -Language * -Version * |

Working with Items 28


Sitecore PowerShell Extensions

DisplayName Language ID Version TemplateName


----------- -------- -- ------- ------------
Copy of Home en {503713E5-F9EE-4847-AEAF-DD13FD853004} 1 Sample Item
Home de-DE {503713E5-F9EE-4847-AEAF-DD13FD853004} 1 Sample Item
Copy of Home pl-PL {503713E5-F9EE-4847-AEAF-DD13FD853004} 1 Sample Item
Copy of Home en-US {503713E5-F9EE-4847-AEAF-DD13FD853004} 1 Sample Item
Hjem da {503713E5-F9EE-4847-AEAF-DD13FD853004} 1 Sample Item
Home en {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item
Home de-DE {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item
Home pl-PL {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item
Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item
Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 2 Sample Item
Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 3 Sample Item
Home en-GB {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item
Hjem da {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item

Get items by Id

Example: The following retrieves an item by id.

PS master:\> Get-Item -Path master: -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}"

Name Children Languages Id TemplateName


---- -------- --------- -- ------------
Home True {en, de-DE, es-ES, pt... {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item

Get items by Uri

The Uri encodes the language and version within the path.

Example: The following retrieves an item by uri.

PS master:\> Get-Item -Path master: -Uri "sitecore://master/{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}?lang=en&ver=1"

Name Children Languages Id TemplateName


---- -------- --------- -- ------------
Home True {en, de-DE, es-ES, pt... {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item

In all the examples you'll notice we specified the database. Windows PowerShell needs to know which provider to execute
within. This also signals to SPE to show the dynamic parameters. Other examples of providers include the following:

HKLM: - The registry provider for HKEY_LOCAL_MACHINE.


C: - The filesystem provider for the C drive.

Changing item properties

We often see the following two ways of accessing and changing fields used in scripts. One uses Set-ItemProperty and the
other is more natural to a Sitecore developer.

Example: The following sets the title property using Set-ItemProperty .

PS master:\> Set-ItemProperty -Path master:/content/home -Name "Title" -Value "New Title"

Example: The following sets the title property using .Editing.BeginEdit and .Editing.EndEdit methods.

Working with Items 29


Sitecore PowerShell Extensions

$item = Get-Item master:/content/home


$item.Editing.BeginEdit()
$item["Title"] = "New Title"
$item.Editing.EndEdit()

Note: The above example may also be written in the ISE where no console prompt is visible.

The previous examples work but are not the most efficient ways to change item content. The items returned by the provider
expose the Sitecore item fields as automated PowerShell properties.

Example: The following sets the title property using the automated PowerShell property.

$item = Get-Item master:/content/home


$item.Title = "New Title"

Example: The following sets the title property using the semi-native PowerShell property without the use of a variable.

(Get-Item master:/content/home).Title = "New Title"

This technique may be used for a wide variety of property types. There are a other hidden gems in those properties. For
example if we detect that the field is a Date or Datetime field, we will return System.DateTime typed value from a field rather
than the System.String Sitecore stores internally.

Example: The following gets the created date.

PS master:\> (Get-Item master:/content/home).__Created


Monday, April 07, 2008 1:59:00 PM

Example: The following assigns a System.DateTime value to the PowerShell automated property.

PS master:\> (Get-Item master:/content/home).__Created = [DateTime]::Now


PS master:\> (Get-Item master:/content/home).__Created
Monday, October 13, 2014 1:59:41 AM

Great we've just changed it! Our property handlers take care of all the necessary usages of .Editing.BeginEdit and
.Editing.EndEdit . This method can be applied for a variety of field types such as GeneralLink and Image.

To provide an example Ive extended my home with additional fields as follows:

Working with Items 30


Sitecore PowerShell Extensions

Figure - Extended Sample Item

Example: The following assigns an image to the Image field.

(Get-Item master:/content/home).Image = Get-Item 'master:\media library\logo'

Easy enough, isn't it? Let SPE detect the field type for you and worry about what to call! Now let's assign a content item to
GeneralLink.

Example: The following assigns a content item to a GeneralLink field.

(Get-Item master:/content/home).GeneralLink = Get-Item 'master:\content\CognifideCom'

What about fields that accept lists of items? We've got your back here as well.

Example: The following assigns all children of /sitecore/content/ item to the ItemList field.

(Get-Item master:/content/home).ItemList = Get-ChildItem 'master:\content\'

Let's see how our item looks in the Content editor after all the assignments that we've just performed:

Working with Items 31


Sitecore PowerShell Extensions

Figure - ItemList Assignment

Great! Looks like it worked.

Those little improvements make your scripts much more succinct and understandable. Try it for yourself!

When not to use the automated properties?

As with every rule there is an exception to this one. Those automated properties perform the $item.Editing.BeginEdit()
and $item.Editing.EndEdit() every time which results in saving the item after every assignment. Assigning multiple
properties on an item this way might be detrimental to the performance of your script. In such cases you might want to call
$item.Editing.BeginEdit() yourself before modifying the item. Subsequently call the $item["field name"] = "new value" for

each property modify. Finally end with the $item.Editing.EndEdit() .

Choosing this way is situational and will usually only be required if you're working with a large volume of data. In those
cases you might also want to introduce the Sitecore.Data.BulkUpdateContext trick used in this blog post.

Example: The following sets multiple automated properties while using the Sitecore.Data.BulkUpdateContext .

Import-Function -Name New-UsingBlock

New-UsingBlock (New-Object Sitecore.Data.BulkUpdateContext) {


foreach($item in Get-ChildItem -Path "master:\content\home") {
$item.Editing.BeginEdit()
$item["Title"] = "Sample Item"
$item["Text"] = "Sample Item"
$item.Editing.EndEdit() | Out-Null
}
}

Working with Items 32


Sitecore PowerShell Extensions

Some other classes you may want to use with the New-UsingBlock function:

Sitecore.SecurityModel.SecurityDisabler

Sitecore.Data.BulkUpdateContext

Sitecore.Globalization.LanguageSwitcher

Sitecore.Sites.SiteContextSwitcher

Sitecore.Data.DatabaseSwitcher

Sitecore.Security.Accounts.UserSwitcher

Sitecore.Data.Items.EditContext

Sitecore.Data.Proxies.ProxyDisabler

Sitecore.Data.DatabaseCacheDisabler

Sitecore.Data.Events.EventDisabler

Copy items to a new destination

You will find yourself one day in need of copying items on a small to large scale. The Copy-Item command will likely meet
the need.

Example: The following copies the item to the specified path with a new ID.

Copy-Item -Path "master:\content\home\Sample Item\Sample Item 1" -Destination "master:\content\home\Sample Item\Sample Item 2"

Note: The item name will match just as you type it in the command. Lowercase name in the destination will result in an item
with a lowercase name.

Move items to a new destination

There is a always a better way to do something. Moving items en masse is certainly one that you don't want to do by hand.
If the destination item exists the moved item will be added as a child. If the destination item does not exist the source item
will be renamed when moved.

Example: The following moves the item from one parent to another.

Move-Item -Path "master:\content\home\sample item\Sample Item 1" -Destination "master:\content\home\sample item 2\"

Create new items

Example: The following creates a new item with the specified template.

New-Item -Path "master:\content\home\sample item\Sample Item 3" -ItemType "Sample/Sample Item"

Name Children Languages Id TemplateName


---- -------- --------- -- ------------
Sample Item 3 False {en} {F6F4F7B7-5E72-4C16-9294-218D80ED89E8} Sample Item

Remove items permanently

Example: The following removes the item permanently. Proceed with caution.

Working with Items 33


Sitecore PowerShell Extensions

Remove-Item -Path "master:\content\home\sample item\Sample Item 3" -Permanently

References

Working with Sitecore Items in PowerShell Extensions

Working with Items 34


Sitecore PowerShell Extensions

Item Languages
References

Issue 184

Item Languages 35
Sitecore PowerShell Extensions

Toolbox
The PowerShell Toolbox is quick way to access frequently used scripts.

Navigate to Sitecore -> PowerShell Toolbox and after selecting you should see the configured scripts:

Figure - Toolbox

Available Tools

Index Viewer

This tool provides similar functionality to the Index Viewer module. Search and rebuild the index on-demand.

Logged in Session Manager

View the list of user sessions and "kick" them out as needed.

Rules based report

Generate a report using the Sitecore Rules Engine.

PowerShell Background Session Manager

View the list of SPE sessions and "kill" them as needed.

Create Anti-Package

This tool provides similar functionality to the Sitecore Rocks module.

Re-create Site from Sitemap

Simple tool for generating a site tree using an existing sitemap.

Task Manager

View and manage the configured scheduled tasks.

Create Tools for the Toolbox

Toolbox 36
Sitecore PowerShell Extensions

To create your own Toolbox item take the following steps:

1. Create the Toolbox folder under an SPE module. Use the context menu to simplify the process.
Right click the module name and choose Scripts -> Create libraries for integration points.

Figure - Module Libraries

Select the Toolbox item and click Proceed.

Toolbox 37
Sitecore PowerShell Extensions

Figure - Module Toolbox Library

2. Create a PowerShell Script under the Toolbox item.


Right click the Toolbox library and choose PowerShell Script.

Figure - Libary Script

3. Open and edit the PowerShell Script using the ISE.

Toolbox 38
Sitecore PowerShell Extensions

Figure - ISE Edit

4. Run the Rebuild All command in the ISE by navigating to the Settings tab and selecting the icon to rebuild. Be certain
to enable the module before running the rebuild command.

Figure - ISE Settings Tab

5. Verify the new toolbox item appears in the Toolbox.

Figure - Toolbox Item

Toolbox 39
Sitecore PowerShell Extensions

Modules
Sitecore PowerShell Extensions provides a way to organize your scripts into modules.

Some benefits to using modules:

You can enable or disable the module as needed. For this to take full affect the integration should be rebuilt in the ISE.
The out-of-the-box scripts are in their own module called Platform.
Adam's post on the module design goes in-depth to why we proposed this architectural change.

Getting started with your own module is a short process.

1. Navigate to the Script Library item and Insert -> PowerShell Script Module.

Figure - New Module

2. Enter the name for the new module and click OK.
3. Right click the new module and Scripts -> Create libraries for integration points.

Figure - Integration Points

Modules 40
Sitecore PowerShell Extensions

4. Select the appropriate integration points for your module.

Figure - Integration Point Libraries

5. Select the module and enable for use. This is where you would also open the ISE to rebuild integrations.

Figure - Module Activation

Modules 41
Sitecore PowerShell Extensions

Reports
The reports which come out of the box provide a wide variety of information regarding your Sitecore installation.

We've built quite a few reports, many similar to the Advanced System Report (ASR) module.

Running a Report

Figure - Reports

As an example, let's run the Unused media items report.

Figure - Unused Media Items

Once the report completes, the results appear in a report window.

Reports 42
Sitecore PowerShell Extensions

Figure - Unused Media Items Output

Reports in SPE similar to ASR

While SPE contains many reports, they don't match identical to ASR reports. We've done our best to build those that seem
most relevant or likely to be used. If you find a report in ASR that you would like to exist in SPE please submit a request.

SPE Report ASR Report

Active Aliases

Aliases

Audit

Broken Links2 Broken Links

Broken Links in publishable items

Item History

Items with Invalid Names

Items with security for an account2 Items with Security for an account

Items with Tokens in Fields

Links

Locked Items2 Locked Items

Logged errors

Logged in Session Manager5 Logged in Users

Limit number of versions4 Multiple versions

My Owned Items

Media items last updated before date3 Not recently modified

Media items not used by content items3 Orphaned media assets report

Owned items

Reports 43
Sitecore PowerShell Extensions

Recent Workflow History

Media items last updated after date3 Recently Modified

Regex Item Searcher

Renderings

Index Viewer5 -

Rules based report5 -

Task Manager report5 -

Report Location: Check the reports in SPE under these sections to see the full list.

Configuration Audit report 1


Content Audit report 2
Media Audit report 3
Solution Audit report 4
Toolbox 5

Reports 44
Sitecore PowerShell Extensions

Authoring Reports
Building reports is a straightforward task. We've provided a variety of examples for you to model when designing your own.

Dynamic Reports

The Authorable Reports module includes reports such as Index Viewer and Rules based report that provide input dialogs
to help make the reports dynamic.

Examples:

Turn Your Sitecore Powershell Reports into Applications with Action Scripts

Static Reports

The Content Reports module includes other reports used for auditing. Below are some examples on how to create your
own.

Examples:

Images with an empty alt field


Unused media items

Examples from the community!

Active Commerce for Sitecore product has published reports on Github that you can checkout here.

Authoring Reports 45
Sitecore PowerShell Extensions

Remoting
There are a number of use cases where you need to remotely run scripts within SPE. Here we will try to cover a few of
those use cases.

Remoting Automation Service

We have provided a handy way of executing scripts via web service using the Remoting Automation Service.

Remoting Module Setup

Figure - SPE Remoting Module

Sitecore to Sitecore communication

Example: The following connects a local instance of SPE to a remote instance and executes the provided script.

Import-Function -Name Remoting2

$session = New-ScriptSession -Username "admin" -Password "b" -ConnectionUri "http://remotesitecore"

$script = {
[Sitecore.Security.Accounts.User]$user = Get-User -Identity admin
$user
$params.date.ToString()
}

$args = @{
"date" = [datetime]::Now
}

Invoke-RemoteScript -ScriptBlock $script -Session $session -ArgumentList $args

Name Domain IsAdministrator IsAuthenticated


---- ------ --------------- ---------------
sitecore\admin sitecore True False

Remoting 46
Sitecore PowerShell Extensions

4/26/2015 6:15:41 PM

Windows PowerShell ISE to Sitecore communication

To setup this scenario you'll need to follow these steps:

Download the SPE Remoting package from the Sitecore Marketplace.


Extract the package to to your module path. Instructions can be found here.

Example: The following connects Windows PowerShell ISE to a remote Sitecore instance and executes the provided
script.

Import-Module -Name SPE

$session = New-ScriptSession -Username "admin" -Password "b" -ConnectionUri http://remotesitecore

$libraryPath = "/sitecore/media library/images/image.png"


Get-Item -Path C:\image.png | Send-MediaItem -Session $session -Destination $libraryPath

$savePath = "C:\image-$([datetime]::Now.ToString("yyyyddMM-HHmmss")).png"
Receive-MediaItem -Session $session -Path $libraryPath -Destination $savePath

Directory: C:\

Mode LastWriteTime Length Name


---- ------------- ------ ----
-a--- 5/25/2015 11:23 AM 0 image-20152505-112302.png

Example: The following downloads all the images in the media library under the specified directory.

$session = New-ScriptSession -Username admin -Password b -ConnectionUri http://remotesitecore

Invoke-RemoteScript -Session $session -ScriptBlock {


Get-ChildItem -Path "master:/sitecore/media library/Images/Icons/" | Select-Object -Expand ItemPath
} | Receive-MediaItem -Session $session -Destination C:\Temp\Images\

Windows Authenticated Requests

If you have configured the services to run under Windows Authentication mode then you'll need to use the Credential
parameter for the commands.

You'll definitely know you need it when you receive an error like the following:

New-WebServiceProxy : The request failed with HTTP status 401: Unauthorized.

Example: The following connects Windows PowerShell ISE to a remote Sitecore instance using Windows credentials and
executes the provided script.

Import-Module -Name SPE


$credential = Get-Credential
$session = New-ScriptSession -Username admin -Password b -ConnectionUri http://remotesitecore -Credential $credential
Invoke-RemoteScript -Session $session -ScriptBlock { Get-User -id admin }

Name Domain IsAdministrator IsAuthenticated


---- ------ --------------- ---------------
sitecore\admin sitecore True False

Remoting 47
Sitecore PowerShell Extensions

Example: The following connects to several remote instances of Sitecore and returns the server name.

# If you need to connect to more than one instance of Sitecore add it to the list.
$instanceUrls = @("http://remotesitecore","http://remotesitecore2")
$session = New-ScriptSession -Username admin -Password b -ConnectionUri $instanceUrls
Invoke-RemoteScript -Session $session -ScriptBlock { $env:computername }

File and Media Service

We have provided a service for downloading all files and media items from the server. This disabled by default and can be
enabled using a patch file. See the Security page for more details about the services available and how to configure.

Example: The following downloads a single file from the Package directory.

Import-Module -Name SPE


$session = New-ScriptSession -Username admin -Password b -ConnectionUri http://remotesitecore
Receive-RemoteItem -Session $session -Path "default.js" -RootPath App -Destination "C:\Files\"

Example: The following downloads a single media item from the library.

Import-Module -Name SPE


$session = New-ScriptSession -Username admin -Password b -ConnectionUri http://remotesitecore
Receive-RemoteItem -Session $session -Path "/Default Website/cover" -Destination "C:\Images\" -Database master

Script Sessions and Web API Tutorial

Figure - SPE Web API

Advanced Script Sessions

Inevitably you will need to have long running processes triggered remotely. In order to support this functionality without

Remoting 48
Sitecore PowerShell Extensions

encountering a timeout using Invoke-RemoteScript you can use the following list of commands.

Get-ScriptSession - Returns details about script sessions.

Receive-ScriptSession - Returns the results of a completed script session.

Remove-ScriptSession - Removes the script session from memory.

Start-ScriptSession - Executes a new script session.

Stop-ScriptSession - Terminates an existing script session.

Wait-ScriptSession - Waits for all the script sessions to complete before continuing.

Example: The following remotely runs a ScriptSession and polls the server until completed.

Import-Module -Name SPE


$session = New-ScriptSession -Username admin -Password b -ConnectionUri http://remotesitecore

$job = Invoke-RemoteScript -Session $session -ScriptBlock {


Start-ScriptSession -ScriptBlock {
# Replace the contents of this scriptblock with your installation steps.
# I just put $true there so something would come back.
Start-Sleep -Seconds 10
[PSCustomObject]@{"IsComplete"=$true}
}
}

$keepRunning = $true
while($keepRunning) {
$done = Invoke-RemoteScript -Session $session -ScriptBlock {
$scriptSession = Get-ScriptSession -Id $params.JobId
$scriptSession.State -ne "Busy"
} -Arguments @{"JobId" = $job.ID}

if($done) {
$keepRunning = $false

Invoke-RemoteScript -Session $session -ScriptBlock {


$scriptSession = Get-ScriptSession -Id $params.JobId
if($scriptSession.State -ne "Busy") {
$scriptSession | Receive-ScriptSession
}
} -Arguments @{"JobId" = $job.ID}
} else {
Start-Sleep -Milliseconds 500
}
}

References:

Michael's follow up post on Remoting


Adam's initial post on Remoting

Remoting 49
Sitecore PowerShell Extensions

Task Scheduler
The task scheduler is a great way to run scripts in a periodic fashion. You may find the need to automatically archive log
files into a compressed file. Perhaps send an email with a generated report based on stale site content.

Video Tutorial

Figure - Scheduled Task Editor

Scheduled Task Command

To help make the setup simple, we've provided a Task Command.

Figure - PowerShell Script Command

The command shown above is simply a type exposed as a public method in the Cognifide.PowerShell assembly. There
exists an update method which accepts one or more items and executes the associated script.

Beneath Schedules you can create as many tasks as Sitecore will allow. Configure the Command and Items fields like that
shown below.

Tasks 50
Sitecore PowerShell Extensions

Figure - PowerShell Script Task

The Items field contains the path to a script in the Script Library.

Below are some of the scripts found out-of-the-box with SPE.

Module Script

System Maintenance Archive Sitecore logs, Clean up deleted items older than 30 days

User Session Management Remove idle user sessions

Create and Manage Tasks

We've added a context menu item to provide you with a shortcut to the Task Scheduler Editor.

Create a new scheduled task:

Figure - Insert Option for Task

Run or edit the scheduled task:

Tasks 51
Sitecore PowerShell Extensions

Figure - Run or Edit Task Schedule

The scheduled task is capable of running 1-to-many scripts. Choose all that apply for the selected task.

Figure - Dialog to Select Task Scripts

The task schedule has an intuitive dialog for working with and changing the frequency.

Tasks 52
Sitecore PowerShell Extensions

Figure - Dialog to Edit Task Schedule

Tasks 53
Sitecore PowerShell Extensions

Authoring Tasks
The following article shows how to create a custom scheduled task.

Custom Scheduled Task by Mike Reynolds

Authoring Tasks 54
Sitecore PowerShell Extensions

Security
Security Policies

There are two main security policies to consider when using the SPE module:

Application Pool service account


Sitecore user account

Application Pool Service Account

The first policy relates to the Application Pool service account running in IIS. The Windows PowerShell runspace will have
access to the local system via providers (i.e. FileSystem, Registry), and be managed through the Console or ISE. If the
service account is capable of removing files from the root directory, then SPE can accomplish the same.

When using the IIS identities such as ApplicationPoolIdentity and NetworkService the scripts will not have access to
directories outside of the application such as the drive root. You may also notice that the $HOME variable is empty; this is
because only named service accounts have profiles.

Sitecore User Account

The second policy relates to the Sitecore user account. The code executed through SPE operates within the privileges of
the logged in user. Keep in mind that this can be bypassed just as can be through the Sitecore API.

Security Hardening

The time will come when you need to lock down the SPE module. The following section outlines steps you can take to
minimize the surface area for attack.

Disable Web Services

You can disable the web services by overriding the following configuration file
\App_Config\Include\Cognifide.PowerShell.config .

Look for the following section and enable/disable as needed.

<sitecore>
<services>
<restfulv1 enabled="false" />
<restfulv2 enabled="true" />
<remoting enabled="true" />
<fileDownload enabled="false" />
<mediaDownload enabled="false" />
<client enabled="true" />
</services>
</sitecore>

RESTful v1 - Used in early version of SPE. Disabled by default. Service associated with RemoteScriptCall.ashx .
RESTful v2 - Used when the url contains all the information needed to execute a script saved in the SPE library.
Service associated with RemoteScriptCall.ashx .
Remoting - Used when passing scripts to SPE for execution. Service associated with RemoteAutomation.asmx .
File Download - Used when the url contains contains all the information needed to download a file from the server.
Service associated with RemoteScriptCall.ashx .
Media Item Download - Used when the url contains contains all the information needed to download a media item
from the server. Service associated with RemoteScriptCall.ashx .

Security 55
Sitecore PowerShell Extensions

Client - Used for the SPE Console. Service associated with PowerShellWebService.asmx .

Restrict Users and Roles

Deny access to the web services for unauthenticated users and roles using the <deny> element as described here in
sitecore modules\PowerShell\Services\web.config .

Example: The following configuration will deny anonymous calls to the web services.

<configuration>
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration>

If you disable Anonymous Authentication and enable Windows Authentication in IIS, such as the directory sitecore
modules\PowerShell\Services\ you'll need to use the Credential parameter for any command that interacts with the services.

See the Remoting section for examples.

Minimal Web Service Configuration

The following files are the bare minimum required to support SPE web services. This setup is suitable for environments
such as the Content Delivery.

Required:

App_Config\Include\Cognifide.PowerShell.config

App_Config\Include\Cognifide.PowerShell.Minimal.config

bin\Cognifide.PowerShell.dll

bin\Cognifide.PowerShell.VersionSpecific.dll

sitecore modules\PowerShell\Services\web.config

sitecore modules\PowerShell\Services\RemoteAutomation.asmx

You will also need to patch the configuration with the following:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<controlSources>
<source mode="on" namespace="Cognifide.PowerShell.Client.Controls" assembly="Cognifide.PowerShell">
<patch:delete />
</source>
<source mode="on" namespace="Cognifide.PowerShell.Client.Applications"
folder="/sitecore modules/Shell/PowerShell/" deep="true">
<patch:delete />
</source>
</controlSources>
</sitecore>
</configuration>

For your convenience we've included a package bundled with all of the above called SPE Minimal-3.x for Sitecore x.zip.
Any of the disabled configuration files should be enabled following extraction.

Security 56
Sitecore PowerShell Extensions

Releases
Thank you for taking the time to check out the latest and greatest changes for SPE. Please provide your feedback and
recommend SPE on Twitter and the Marketplace or report issues on Github.

Version 3.3
Yet another little-over-a-month update and in many aspects a major one!

Full issue list available on GitHub - 35 issues and new contributing members @Kasaku & @marrrcin!

Summary of important changes

New Features

Major re-work to our script session management engine allowing us to 463 spin up new script sessions from your
scripts. This allows you to divide scripts into asynchronous parts that can execute in parallel or run operations that
would otherwise 462 cause your remoting operations to time out.
You can even 475 run more interactive sessions from an existing interactive session!
The 454 remoting web service added the ability to download large files streamed from server rather than serialized in a
SOAP envelope and this has already been 461 conveniently exposed using our remoting module!
Our new member has contributed a cool functionality that 472 allows you to reset fields and layouts to standard values.
More of the PowerShell scripts that you can find online will also work OOTB for you as we have implemented the logic
that 471 allows the Read-Host command to run in our interactive sessions. This command will now pop-up a dialog
asking you to provide a line of text like it would in Windows PowerShell.
Your scripts using 473 Read-Variable can now request for strings from users that will be hidden from the prying eyes of
bystanders when you specify the Editor to be password . The typed characters will be replaced with the standard
password masking characters in the editor. Your script will still receive a proper string back though.

Enhancements

One weakness the script session management exposed particularly was that 479 interactive cmdlets like Read-
Variable would cause a script session to hang in non interactive scenario as there would be no UI to handle the

message from the script. This has now been fixed and 475 sessions are aware whether they are interactive or not.
To compliment the new functionality we have 467 extended the Background Session Manager available from the
toolbox to show next to each session whether it is busy running a script or not.
476 Script sessions are now also aware whether they are busy running script or not and will gracefully reject another
script being sent to them if asked to execute one.
it is now significantly easier to find the item template when using the New-Item command as the -ItemType parameter
now features a fully dynamic autocompletion.
The 448 Broken Links report now can analyse all versions, not just the latest one.
The 447 Lock-Item command now supports transferring a lock to another user. If the item is piped to it that is already
locked - using the -Force parameter will cause the lock to be transferred to the new user specified in the command.
Some of the 446 commonly used types have gotten type accelerators specified for them so you can use those and
cast to them much easier.
Last but not least our second new contributor @marrrcin has contributed 444 a way to Get-ChildItem by providing item
ID with the -ID parameter rather than using the path.

Fixes

Releases 57
Sitecore PowerShell Extensions

We discovered that when removing more than one rendering the 453 Remove-Rendering command encountered an
error .
The very useful 455 Get-ItemReference command returned the wrong item, so we fixed that.
Lots and lots more of them... actually 10 more!

Potential Breaking Changes

You may find that the changes to 463 Get-ScriptSession syntax can potentially interfere with scripts using it.

Version 3.2
We've managed to turnaround a release in a little over a month!

Full issue list available on GitHub - 62 issues closed!

Summary of important changes

New Features

383 ISE plugin tab and integration point added - you can now write scripts to process your scripts!
390 ISE plugin added to find scripts containing selected text
388 ISE plugin added to prettify edited script
422 Expand-Archive command added
411 ISE dialog to search for scripts by name
396 New-Role , Test-Role , Remove-Role commands added
435 Get-SearchIndex , Rebuild-SearchIndex , Stop-SearchIndex , Resume-SearchIndex , Suspend-SearchIndex commands
added
434 Render-ReportField function-script added to improve Authorable Reports

Enhancements

438 Console and 436 ISE results are output in real time
421 Read-Variable dialogs can now show variable editors in a grid-like manner where you can assign 1-12 columns
per variable editor
413 Read-Variable dialogs showing non-editable messages (for additional dialog explanatory messages where
needed)
259 Read-Variable dialogs can now have mandatory fields
427 Read-Variable dialogs can now have placeholder text.
412 Show-ListView can now contain links executing actions in a specific report row
382 SPE Remoting module improvements
415 Find-Item criteria now supports inverted Filter
418 Improved formatting for Find-Item results
379 SPE Remoting support for Windows Authentication
417 Verbose messages are now yellow and black
391 Find-Item DecendentOf criteria added for faster searches
424 Find-Item supports Fuzzy and Date search
401 Read-Variable supports "item" editor that has no value selected on input or output.

Fixes

420 Find-Item Contains criteria complained about case sensitivity


419 ISE did not format data in the results pane

Releases 58
Sitecore PowerShell Extensions

414 ISE buttons would enable at the wrong time


... many, many more

Potential Breaking Changes

376 Compress-Archive api change

356 Changes in existing commandlets for old Sitecore search APIs - Get-SearchIndex repurposed for new api, Get-
Index and Get-ItemByUri are no longer available.

Version 3.1
It's already June and been way too long since we last released SPE. The SPE team has been hard at work preparing for
version 3.1 and we hope this version introduces many welcomed changes long overdue. The most important changes are
explained below. As always - please provide any and all feedback either on twitter or GitHub.

Full issue list available on GitHub

Short summary of important changes

New Features

337 Create anti-packages


293 Rules-based report creator
318 Content Editor "Insert" menu integration
368 Content Editor warning integration
364 Experience Editor notification integration
227 New cmdlets for managing Item security allowing for changing which users/roles can do what to which items.
341 New-SecuritySource command added to enable inclusion of Users and Roles in packages
324 New SPE Remoting module for use outside of Sitecore
372 Most Recently Used scripts are now user specific and be stored in master database with user settings.
371 Ability to open and save in ISE scripts stored in different database than the current ContentDatabase.

Enhancements

326 Read-Variable cmdlet provides the ability to edit Sitecore rules.


333 Write-Log now defaults to the DEBUG log
363 Script errors are now logged to the ERROR log, which will then show line numbers
339 New-FileSource and New-ExplicitFileSource commands support InstallMode for package creation
338 Export-Package command supports NoClobber for package creation
336 Event settings moved to a separate include file
334 Added System Maintenance Module containing instance optimization scripts
350 New version specific dll introduced for compatibility
316 Ability to set height of a field in dialog created by Read-Variable
374 Show-ModalDialog can pass parameters through Url handles opening more OOTB Sitecore dialogs for re-use.

Fixes

357 Find-Item command no longer throws Operation Unsupported warning


358 Remove-RoleMember command did not properly remove users from roles.
361 Find-Item command Contains filter indicates properly that case sensitiveness is not Supported by Sitecore if that
functionality is used.

Releases 59
Sitecore PowerShell Extensions

Potential Breaking Changes

365 Prescript functionality removed from ISE, Console, and Default settings
365 core database no longer can contain scripts
366 LoggingIn, LoggedIn, and LoggedOut pipelines now use the variable $pipelineArgs rather than $args

Stuff we're so excited about that we needed to tell you more so you don't miss
out!

Improved documentation

We have gone through most of the documentation wehave created for out cmdlets; fixed and improved those. Just like you
could before - you can put the text cursor after any cmdlet and press Ctrl+Enter to see the help for it - it's just that now you
will see a lot more info there with better explanation and examples. We have also consolidated our documentation effort on
this book. We will still blog and record videos but we recognize the need for a centralized and are going to act upon it.

Create anti-packages

This is one of those exciting new features, mainly because SPE has had the ability to create packages for a long time, so
why not the reverse!? A new library needs to be included in order for the a delete post step to work. It works very much like
the feature you can find in Sitecore Rocks. If you haven't used that you are missing out on a great tool.

We started off by adding a new toolbox item.

Figure - Toolbox

We enhanced the experience by adding a modal dialog.

Releases 60
Sitecore PowerShell Extensions

Figure - Package Browser

Rules-based report creator

We had this idea to allow users to generate reports without having to know PowerShell. With this simple toolbox item you
can generate a new report in under a minute.

After you launch the toolbox item Rules based report you are prompted with a dialog to choose the root node along with the
rules.

Releases 61
Sitecore PowerShell Extensions

Figure - Rules Based Report

Choose which custom fields and standard fields you wish to be included in the final report.

Releases 62
Sitecore PowerShell Extensions

Figure - Rules Report Fields

Content Editor Insert Menu Integration

If you put a script in the Content Editor/Insert Item/ library in an active module it will automatically get exposed to your
users when they select an "Insert" option on an item in content tree in Content Editor. Just like with other integrations you
can control if and when the script appears by setting appropriate rules on the script item.

Releases 63
Sitecore PowerShell Extensions

Figure - Content Editor Insert Menu

Content/Experience Editor Message integration

Now it's possible to write a script for generating warnings in the Content Editor and notifications in the Page Editor. We've
included a new module in SPE called License Expiration that utilizes the new functionality into something useful. Every
module does include a disable feature.

Figure - Content Editor Notification

Releases 64
Sitecore PowerShell Extensions

Figure - Experience Editor Notification

Manage Item Security

The module commands now include a number of comands that allow for managing item security

New-ItemAcl - Creates a new access rule for use with Set-ItemAcl and Add-ItemAcl cmdlets.

Get-ItemAcl - Retrieves security access rules from an item. Those rules can later be used with Set-ItemAcl and Add-

ItemAcl cmdlets to copy them to another item or manipulated and saved back to the same item.

Add-ItemAcl - Adds new access rule to an item allowing for the item to have the access granted or denied for a

provided role or user. The new rules will be appended to the existing security descriptors on the item.
Set-ItemAcl - Sets new security information on an item. The new rules will overwrite the existing security descriptors

on the item.
Clear-ItemAcl - Removes all security information from the item specified.

Test-ItemAcl allows script to determine whether the specified user can perform a specified operation.

Packaging of Users and Roles

The module commands now include a new one called New-SecuritySource which adds the ability to store Users and Roles
in packages created with SPE.

ISE Script opening enhancements

Your Most Recently Used scripts are now specific to your account. This means that if your colleagues are using ISE as well
you will no longer see their most recently used scripts.

Releases 65
Sitecore PowerShell Extensions

Figure - Most Recently Used Scripts Gallery

While we were at it, we've also added the tree view for faster access to your scripts. In the second tab in that gallery you
can open scripts really quickly. Also if you are already editing a script - your currently edited script will be highlighted so you
can switch between scripts in a single module much quicker.

Releases 66
Sitecore PowerShell Extensions

Figure - Switch between scripts quicker

Not stopping there, we have also added the ability to open scripts from other databases. You can see the database selector
drop-down in the above screenshot that gives you ability to open scripts in a different database than your current context
database. This gives you ability to edit your scripts in the master database while you're working in Content Editor in core
database.

The same database switcher has also been added to the full Open Script dialog.

SPE module for use outside of Sitecore

We have finally introduced a Windows PowerShell module that can be used outside of Sitecore. The module includes
commands to interact with the SPE web services and should be the preferred method.

Either from the downloads section on the Sitecore Marketplace or in Github repo you'll find the package SPE Remoting-
3.1.zip .

You'll want to extract the contents to your Windows PowerShell module directory as defined in $env:PSModulePath or
perhaps even add a new path if necessary.

Releases 67
Sitecore PowerShell Extensions

Since I am using the module under my account I can save it my $home path:

C:\Users\Michael\Documents\WindowsPowerShell\Modules\SPE

Running Get-Command you can get the list of supported commands:

PS C:\Windows\system32> Get-Command -Module SPE

CommandType Name ModuleName


----------- ---- ----------
Function ConvertFrom-CliXml SPE
Function ConvertTo-CliXml SPE
Function Invoke-RemoteScript SPE
Function New-ScriptSession SPE
Function Receive-MediaItem SPE
Function Send-MediaItem SPE

Script errors log to the Sitecore ERROR log

One of the pain points I noticed was that script errors encountered by scripts running outside of the Console and ISE
provided insufficient details. Now you can find the error details and with line numbers in the log.

4620 19:05:24 ERROR The property 'Icon1' cannot be found on this object. Verify that the property exists and can be set.At line:9 char:
+ $warning.Icon1 = $icon
+ ~~~~~~~~~~~~~~~~~~~~~

New config file and libraries introduced

In order to improve how we maintain SPE and to be able to work off of a common branch to support both Sitecore 7 and 8
we've shifted a few things around. Nothing too crazy.

First we split the functionality that was different between major Sitecore versions (like classes moving between assembiles)
into a separate dll called Cognifide.PowerShell.VersionSpecific.dll . Doing this allowed us to maintain a single branch of
code, where the version specific libraries are compiled with their respective Sitecore versions.

Second we've split the Cognifide.PowerShell.config by removing previously unused events section. There are 3 or so
events that SPE depends on, so we kept that in the original file. Any of the events you wish to use like "item:saved" will
now reside in Cognifide.PowerShell.Events.config.disabled , if you want to enable hooking into Sitecore events simply
rename it to Cognifide.PowerShell.Events.config .

Third we added a new library called Cognifide.PowerShell.Package.dll which enables the deletion of items and files when
installing anti-packages. The library does not have any dependencies other than the Sitecore libraries.

Removed functionality

Prescript

We decided that the Prescript functionality was unlikely to be widely used and only introduced confusion when scripts
executed. In some situations your prescript would execute, and in others it would never execute. It's gone.

Core database scripts

The existence of script libraries in core database was problematic to at least one of our users 375 and we've never really
leveraged that capability in the platform either. As a result this functionality has been removed and if you've put any scripts

Releases 68
Sitecore PowerShell Extensions

there, you are now asked to kindly move them to either master database or one of the publishing target databases.

Happy Scripting!

// Michael and Adam

Github issue lists for past releases

Version 3.1 (June 2015)

Release Notes

Version 3.0 (February 2015)

Release Notes

Version 2.8 (December 2014)

Release Notes

Version 2.7.5 (November 2014)

Release Notes

Version 2.7.1 (September 2014)

Release Notes

Version 2.7 (August 2014)

Release Notes

Version 2.6 (April 2014)

Release Notes

Version 2.5 (28 October 2013)

Release Notes

Version 2.4 (23 September 2013)

Release Notes

Version 2.3.1 (1 September 2013)

Release Notes

Version 2.2 (30 July 2013)

Release Notes

Version 2.1 (15 July 2013)

Releases 69
Sitecore PowerShell Extensions

Release Notes

Releases 70
Sitecore PowerShell Extensions

Troubleshooting
Hanging Installation

Some users have reported an issue where the package installation in Sitecore hangs while installing SPE. One possible fix
is to disable the Sitecore Analytics feature; this of course assumes you do not plan on using it for your instance.

$paths = @("C:\inetpub\wwwroot\Console\Website\App_Config\Include\*")
$patterns = @("Sitecore.Analytics*.config", "Sitecore.ExperienceAnalytics*.config")

$paths | Get-ChildItem -Include $patterns -Recurse | Rename-Item -NewName { $PSItem.Name + ".disabled" }

ISE throws exception when /sitecore/content/home is missing

378 - Missing Home item (fixed in 3.2)

Troubleshooting 71
Sitecore PowerShell Extensions

Appendix

Compatibility Table

CMS CMS CMS CMS CMS CMS CMS XP XP


SPE
6.4 6.4.1 6.5 6.6 7.0 7.1 7.2 7.5 8.0

3.0-

3.3

Legend: "" - not supported; "" - supported.

Commands
The following commands are distributed with the Sitecore PowerShell Extensions module.

Add-ItemAcl
Add-ItemLanguage
Add-Rendering
Add-RoleMember
Clear-ItemAcl
Close-Window
ConvertFrom-CliXml
ConvertFrom-ItemClone
ConvertTo-CliXml
Disable-User
Enable-User
Expand-Token
Export-Item
Export-Package
Export-Role
Export-UpdatePackage
Export-User
Find-Item
Get-Archive
Get-Cache
Get-Database
Get-Domain
Get-ItemAcl
Get-ItemClone
Get-ItemField
Get-ItemReference
Get-ItemReferrer
Get-ItemTemplate
Get-ItemWorkflowEvent
Get-Layout
Get-LayoutDevice
Get-Package
Get-Preset
Get-Rendering

Appendix 72
Sitecore PowerShell Extensions

Get-Role
Get-RoleMember
Get-ScriptSession
Get-SearchIndex
Get-Session
Get-SpeModule
Get-SpeModuleFeatureRoot
Get-TaskSchedule
Get-UpdatePackageDiff
Get-User
Get-UserAgent
Import-Function
Import-Item
Import-Role
Import-User
Initialize-Item
Initialize-SearchIndex
Install-Package
Install-UpdatePackage
Invoke-Script
Invoke-ShellCommand
Invoke-Workflow
Lock-Item
Login-User
Logout-User
New-Domain
New-ExplicitFileSource
New-ExplicitItemSource
New-FileSource
New-ItemAcl
New-ItemClone
New-ItemSource
New-ItemWorkflowEvent
New-Package
New-Rendering
New-Role
New-SecuritySource
New-User
Protect-Item
Publish-Item
Read-Variable
Receive-File
Receive-ScriptSession
Remove-Domain
Remove-ItemLanguage
Remove-Rendering
Remove-Role
Remove-RoleMember
Remove-ScriptSession
Remove-Session
Remove-User
Reset-ItemField
Reset-Layout

Appendix 73
Sitecore PowerShell Extensions

Restart-Application
Resume-SearchIndex
Send-File
Send-SheerMessage
Set-HostProperty
Set-ItemAcl
Set-Layout
Set-Rendering
Set-User
Set-UserPassword
Show-Alert
Show-Application
Show-Confirm
Show-FieldEditor
Show-Input
Show-ListView
Show-ModalDialog
Show-Result
Show-YesNoCancel
Start-ScriptSession
Start-TaskSchedule
Stop-ScriptSession
Stop-SearchIndex
Suspend-SearchIndex
Test-Account
Test-ItemAcl
Test-Rule
Unlock-Item
Unlock-User
Unprotect-Item
Update-ListView
Wait-ScriptSession
Write-Log

Appendix 74
Sitecore PowerShell Extensions

Add-ItemAcl
Adds new access rule to an item allowing for the item to have the access granted or denied for a provided role or user.

Syntax
Add-ItemAcl -PropagationType -SecurityPermission -AccessRight -Identity -Path [-PassThru]

Add-ItemAcl -PropagationType -SecurityPermission -AccessRight -Identity -Id [-Database ] [-PassThru]

Add-ItemAcl -PropagationType -SecurityPermission -AccessRight -Identity -Item [-PassThru]

Add-ItemAcl -AccessRules -Path [-PassThru]

Add-ItemAcl -AccessRules -Id [-PassThru]

Add-ItemAcl -AccessRules -Item [-PassThru]

Add-ItemAcl -Item [-PassThru]

Add-ItemAcl -Path [-PassThru]

Add-ItemAcl -Id [-Database ] [-PassThru]

Detailed Description
Adds new access rule to an item allowing for the item to have the access granted or denied for a provided role or user. The
new rules will be appended to the existing security descriptors on the item.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-PropagationType <PropagationType>

The PropagationType enumeration determines which items will be granted the access right.

Any - the item and all items inheriting


Descendants - applies rights to inheriting children only
Entity - applies right to the item only

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Add-ItemAcl 75
Sitecore PowerShell Extensions

-SecurityPermission <SecurityPermission>

The SecurityPermission determines whether to grant (allow) or deny the access right, and deny or allow inheritance of the
right.

- AllowAccess -
- DenyAccess -
- AllowInheritance -
- DenyInheritance -

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-AccessRules <AccessRuleCollection>

A single or multiple access rules created e.g. through the New-ItemAcl or obtained from other item using the Get-ItemAcl
cmdlet. This information will be appended to the existing security descriptors on the item.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-PassThru <SwitchParameter>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-AccessRight <String>

The access right to grand or deny. Well known rights are:

field:read - "Field Read" - controls whether an account can read a specific field on an item..
field:write - "Field Write" - controls whether an account can update a specific field on an item.

Add-ItemAcl 76
Sitecore PowerShell Extensions

item:read - "Read" - controls whether an account can see an item in the content tree and/or on the published Web site,
including all of its properties and field values.

item:write - "Write" - controls whether an account can update field values. The write access right requires the read
access right and field read and field write access rights for individual fields (field read and field write are allowed by
default).
item:rename - "Rename" - controls whether an account can change the name of an item. The rename access right
requires the read access right.
item:create - "Create" - controls whether an account can create child items. The create access right requires the read
access right.
item:delete - "Delete" - Delete right for items. controls whether an account can delete an item. The delete access right
requires the read access right Important! The Delete command also deletes all child items, even if the account has
been denied Delete rights for one or more of the subitems.
item:admin - "Administer" - controls whether an account can configure access rights on an item. The administer access
right requires the read and write access rights.
language:read - "Language Read" - controls whether a user can read a specific language version of items.
language:write - "Language Write" - controls whether a user can update a specific language version of items.
site:enter - controls whether a user can access a specific site.
insert:show - "Show in Insert" - Determines if the user can see the insert option
workflowState:delete - "Workflow State Delete" - controls whether a user can delete items which are currently
associated with a specific workflow state.
workflowState:write - "Workflow State Write" - controls whether a user can update items which are currently associated
with a specific workflow state.
workflowCommand:execute - "Workflow Command Execute" - controls whether a user is shown specific workflow
commands.
profile:customize - "Customize Profile Key Values" - The right to input out of range values of profile keys, that belong to
this profile.
bucket:makebucket - "Create Bucket" - convert item to bucket.
bucket:unmake - "Revert Bucket" - convert item back from bucket.
remote:fieldread - "Field Remote Read" - Field Read right for remoted clients.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Identity <AccountIdentity>

User name including domain for which the access rule is being created. If no domain is specified - 'sitecore' will be used as
the default domain.

Specifies the Sitecore user by providing one of the following values.

Local Name
Example: adam
Fully Qualified Name
Example: sitecore\adam

Aliases

Add-ItemAcl 77
Sitecore PowerShell Extensions

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

The item to be processed.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be processed.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the item to be processed. Requires Database parameter to be specified

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be fetched using the Id Parameter.

Add-ItemAcl 78
Sitecore PowerShell Extensions

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

can be piped from another cmdlet* Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Only if -PassThru is used* Sitecore.Data.Items.Item

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

allows the "sitecore\adam" user to rename the Home item and all of its childre

PS master:\> Add-ItemAcl -Path master:\content\Home -AccessRight "item:rename" -PropagationType Any -SecurityPermission AllowAccess -Id

EXAMPLE 2

Allows the "sitecore\adam" user to delete the Home item and all of its children. Denies the "sitecore\mikey" user reading the
descendants of the Home item. ;P The security info is created prior to adding it to the item. The item is delivered to the
Add-ItemAcl from the pipeline and returned to the pipeline after processing due to the -PassThru parameter.

$acl1 = New-ItemAcl -AccessRight item:delete -PropagationType Any -SecurityPermission AllowAccess -Identity "sitecore\admin"
$acl2 = New-ItemAcl -AccessRight item:read -PropagationType Descendants -SecurityPermission DenyAccess -Identity "sitecore\mikey"
Get-Item -Path master:\content\home | Add-ItemAcl -AccessRules $acl1, $acl2 -PassThru

Name Children Languages Id TemplateName


---- -------- --------- -- ------------
Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item

Add-ItemAcl 79
Sitecore PowerShell Extensions

Related Topics
https://github.com/SitecorePowerShell/Console/
Add-ItemAcl
Clear-ItemAcl
Get-ItemAcl
New-ItemAcl
Set-ItemAcl
Test-ItemAcl
https://sdn.sitecore.net/upload/sitecore6/security_administrators_cookbook_a4.pdf
https://sdn.sitecore.net/upload/sitecore6/61/security_reference-a4.pdf
https://sdn.sitecore.net/upload/sitecore6/64/content_api_cookbook_sc64_and_later-a4.pdf
http://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2013/01/sitecore-security-access-
rights.aspx
https://briancaos.wordpress.com/2009/10/02/assigning-security-to-items-in-sitecore-6-programatically/

Add-ItemAcl 80
Sitecore PowerShell Extensions

Add-ItemLanguage
Creates a version of the item in a new language based on an existing language version.

Syntax
Add-ItemLanguage [-Language ] [-Path] [-Recurse] [-IfExist ] -TargetLanguage [-DoNotCopyFields] [-IgnoredFields ]

Add-ItemLanguage [-Language ] -Id [-Database ] [-Recurse] [-IfExist ] -TargetLanguage [-DoNotCopyFields] [-IgnoredFields


]

Add-ItemLanguage [-Language ] [-Item] [-Recurse] [-IfExist ] -TargetLanguage [-DoNotCopyFields] [-IgnoredFields ]

Detailed Description
Creates a version of the item in a new language based on an existing language version. Based on parameters you can
make the command bahave differently when a version in the target language already exists and define which fields if any
should be copied over from the original language.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Recurse <SwitchParameter>

Process the item and all of its children.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-IfExist <ActionIfExists>

Accepts one of 3 pretty self explanatory actions:

Skip - if language version exists don't do anything


Append - if language version exists create a new version with values copied from the original language
OverwriteLatest - if language version exists overwrite the last version with values copied from the original language

Aliases

Required? false

Position? named

Add-ItemLanguage 81
Sitecore PowerShell Extensions

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-TargetLanguage <String[]>

Language or a list of languages that should be created

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-DoNotCopyFields <SwitchParameter>

Creates a version in the target language but does not copy field values from the original language

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-IgnoredFields <String[]>

List of fields that should not be copied over from original item. As an example, use "__Security" if you don't want the new
version to have the same restrictions as the original version.

In addition to the fields in -IgnoredFields the following fields are ignored as configured in Cognifide.PowerShell.config file in
the following location: configuration/sitecore/powershell/translation/ignoredFields.

Fields ignored out of the box include:

__Archive date
__Archive Version date
__Lock
__Owner
__Page Level Test Set Definition
__Reminder date
__Reminder recipients
__Reminder text

Aliases

Required? false

Add-ItemLanguage 82
Sitecore PowerShell Extensions

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Language <String[]>

Language that will be used as source language. If not specified the current user language will be used.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

The item to be processed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be processed - additionally specify Language parameter to fetch different item language than the current
user language.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the item to be processed - additionally specify Language parameter to fetch different item language than the current
user language.

Add-ItemLanguage 83
Sitecore PowerShell Extensions

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Data.Items.Item

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Translate the Home Item from English to US and Polish leaving the "Title" field blank. If a version exists don't do anything

PS master:\> Add-ItemLanguage -Path "master:\content\home" -Language "en" -TargetLanguage "pl-pl", "en-us" -IfExist Skip -IgnoredFields

Add-ItemLanguage 84
Sitecore PowerShell Extensions

EXAMPLE 2

Translate the children of Home item (but only those of Template Name "Sample Item") from English to US and Polish. If a
version exists create a new version for that language. Display results in a table listing item name, language and created
version number.

Get-ChildItem "master:\content\home" -Language "en" -Recurse | `


Where-Object { $_.TemplateName -eq "Sample Item" } | `
Add-ItemLanguage -TargetLanguage "pl-pl" -IfExist Append | `
Format-Table Name, Language, Version -auto

Related Topics
https://github.com/SitecorePowerShell/Console/
Remove-ItemLanguage
New-Item

Add-ItemLanguage 85
Sitecore PowerShell Extensions

Add-Rendering
Adds a rendering to a chosen device for the presentation of an item.

Syntax
Add-Rendering [-Item] -Instance [-Parameter ] -PlaceHolder [-DataSource ] [-Index ] [-Device ]

Add-Rendering [-Path] -Instance [-Parameter ] -PlaceHolder [-DataSource ] [-Index ] [-Device ]

Add-Rendering -Id [-Database ] -Instance [-Parameter ] -PlaceHolder [-DataSource ] [-Index ] [-Device ]

Detailed Description
Adds a rendering to a chosen device for the presentation of an item.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Instance <RenderingDefinition>

Rendering definition to be added to the item

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Parameter <Hashtable>

Rendering Parameters to be overriden on the Rendering that is being updated - if not specified the value provided in
rendering definition specified in the Instance parameter will be used.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-PlaceHolder <String>

Add-Rendering 86
Sitecore PowerShell Extensions

Placeholder path the Rendering should be added to - if not specified the value provided in rendering definition specified in
the Instance parameter will be used.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-DataSource <String>

Data source of the Rendering - if not specified the value provided in rendering definition specified in the Instance parameter
will be used.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Index <Int32>

Index at which the Rendering should be inserted. If not provided the rendering will be appended at the end of the list.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Device <DeviceItem>

Device the rendering is assigned to. If not specified - default device will be used.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Add-Rendering 87
Sitecore PowerShell Extensions

-Item <Item>

The item to be processed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Add-Rendering 88
Sitecore PowerShell Extensions

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Layouts.RenderingDefinitio

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

find item defining rendering and create rendering definitio

PS master:\> $renderingItem = gi master:\layout\Sublayouts\ZenGarden\Basic\Content | New-Rendering -Placeholder "main"


# find item you want the rendering added to
PS master:\> $item = gi master:\content\Demo\Int\Home
# Add the rendering to the item
PS master:\> Add-Rendering -Item $item -PlaceHolder "main" -Rendering $renderingItem -Parameter @{ FieldName = "Content"

Related Topics
https://github.com/SitecorePowerShell/Console/
New-Rendering
Set-Rendering
Get-Rendering
Get-LayoutDevice
Remove-Rendering
Get-Layout
Set-Layout

Add-Rendering 89
Sitecore PowerShell Extensions

Add-RoleMember
Adds one or more Sitecore users to the specified role.

Syntax
Add-RoleMember [-Identity] -Members

Detailed Description
The Add-RoleMember command assigns Sitecore users as members of the specified role.

The Identity parameter specifies the Sitecore role to get. You can specify a role by its local name or fully qualified name.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

Specifies the Sitecore role by providing one of the following values.

Local Name
Example: developer
Fully Qualified Name
Example: sitecore\developer

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Members <AccountIdentity[]>

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Add-RoleMember 90
Sitecore PowerShell Extensions

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

System.String Represents the identity of a role.

Outputs
The output type is the type of the objects that the cmdlet emits.

None.

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Add-RoleMember -Identity developer -Members "michael","adam","mike"

Related Topics
https://github.com/SitecorePowerShell/Console/
Get-RoleMember
Remove-RoleMember

Add-RoleMember 91
Sitecore PowerShell Extensions

Clear-ItemAcl
Removes all security information from the item specified.

Syntax
Clear-ItemAcl [-Item] [-PassThru]

Clear-ItemAcl [-Path] [-PassThru]

Clear-ItemAcl -Id [-Database ] [-PassThru]

Detailed Description
Removes all security information from the item specified.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-PassThru <SwitchParameter>

Passes the processed item back into the pipeline.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

The item to be processed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Clear-ItemAcl 92
Sitecore PowerShell Extensions

Path to the item to be processed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the item to be processed. Requires the Database parameter to be specified.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be fetched with Id parameter.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

can be piped from another cmdlet* Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Only if -PassThru is used* Sitecore.Data.Items.Item

Notes
Clear-ItemAcl 93
Sitecore PowerShell Extensions

Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Clears the security information from the Home item providing its path

PS master:\> Clear-ItemAcl -Path master:\content\home

EXAMPLE 2

Clears the security information from the Home item by providing it from the pipeline and passing it back to the pipeline.

PS master:\> Get-Item -Path master:\content\home | Clear-ItemAcl -PassThru

Name Children Languages Id TemplateName


---- -------- --------- -- ------------
Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item

Related Topics
Add-ItemAcl
Get-ItemAcl
New-ItemAcl
Set-ItemAcl
Test-ItemAcl
https://sdn.sitecore.net/upload/sitecore6/security_administrators_cookbook_a4.pdf
https://sdn.sitecore.net/upload/sitecore6/61/security_reference-a4.pdf
https://sdn.sitecore.net/upload/sitecore6/64/content_api_cookbook_sc64_and_later-a4.pdf
http://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2013/01/sitecore-security-access-
rights.aspx
https://briancaos.wordpress.com/2009/10/02/assigning-security-to-items-in-sitecore-6-programatically/

Clear-ItemAcl 94
Sitecore PowerShell Extensions

Close-Window
Closes the runner job window after the script completes.

Syntax

Detailed Description
Ensures the runner proces window is closed after the script finishes execution.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Close-Window

Related Topics
https://github.com/SitecorePowerShell/Console/

Close-Window 95
Sitecore PowerShell Extensions

ConvertFrom-CliXml
Imports a CliXml string with data that represents Microsoft .NET objects and creates the objects within PowerShell.

Syntax
ConvertFrom-CliXml [-InputObject]

Detailed Description
The ConvertFrom-CliXml command imports a CliXml string with data that represents Microsoft .NET Framework objects
and creates the objects in PowerShell.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-InputObject <String>

String containing the Xml with serialized objects.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

System.String

Outputs
The output type is the type of the objects that the cmdlet emits.

object

Notes
Help Author: Adam Najmanowicz, Michael West

ConvertFrom-CliXml 96
Sitecore PowerShell Extensions

Examples

EXAMPLE

PS master:\> #Convert original item to xml


PS master:\> $myCliXmlItem = Get-Item -Path master:\content\home | ConvertTo-CliXml
PS master:\> #print the CliXml
PS master:\> $myCliXmlItem
PS master:\> #print the Item converted back from CliXml
PS master:\> $myCliXmlItem | ConvertFrom-CliXml

Related Topics
https://github.com/SitecorePowerShell/Console/
ConvertTo-CliXml
ConvertTo-Xml
ConvertFrom-Xml
Export-CliXml
Import-CliXml
https://github.com/SitecorePowerShell/Console/issues/218

ConvertFrom-CliXml 97
Sitecore PowerShell Extensions

ConvertFrom-ItemClone
Converts an item from a clone to a fully independent item.

Syntax
ConvertFrom-ItemClone [-Item]

ConvertFrom-ItemClone [-Path]

ConvertFrom-ItemClone -Id [-Database ]

Detailed Description
Converts an item from a clone to a fully independent item.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Item <Item>

The item to be converted.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be converted

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

ConvertFrom-ItemClone 98
Sitecore PowerShell Extensions

Id of the item to be converted

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be converted

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Data.Items.Item

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> ConvertFrom-ItemClone -Path master:\content\home

Related Topics
ConvertFrom-ItemClone 99
Sitecore PowerShell Extensions

New-ItemClone
Get-ItemClone
https://github.com/SitecorePowerShell/Console/

ConvertFrom-ItemClone 100
Sitecore PowerShell Extensions

ConvertTo-CliXml
Exports Microsoft .NET objects froms PowerShell to a CliXml string.

Syntax
ConvertTo-CliXml [-InputObject]

Detailed Description
The ConvertTo-CliXml command exports Microsoft .NET Framework objects from PowerShell to a CliXml string.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-InputObject <PSObject>

Specifies the object to be converted. Enter a variable that contains the objects, or type a command or expression that gets
the objects. You can also pipe objects to ConvertTo-CliXml.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

object

Outputs
The output type is the type of the objects that the cmdlet emits.

System.String

Notes
Help Author: Adam Najmanowicz, Michael West

ConvertTo-CliXml 101
Sitecore PowerShell Extensions

Examples

EXAMPLE

PS master:\> #Convert original item to xml


PS master:\> $myCliXmlItem = Get-Item -Path master:\content\home | ConvertTo-CliXml
PS master:\> #print the CliXml
PS master:\> $myCliXmlItem
PS master:\> #print the Item converted back from CliXml
PS master:\> $myCliXmlItem | ConvertFrom-CliXml

Related Topics
https://github.com/SitecorePowerShell/Console/
ConvertFrom-CliXml
ConvertFrom-Xml
ConvertTo-Xml
Export-CliXml
Import-CliXml

ConvertTo-CliXml 102
Sitecore PowerShell Extensions

Disable-User
Disables the specified Sitecore user.

Syntax
Disable-User [-Identity]

Disable-User -Instance

Detailed Description
The Disable-User command gets a user and disables the account in Sitecore.

The Identity parameter specifies the Sitecore user to get. You can specify a user by its local name or fully qualified name.
You can also specify user object variable, such as $<user>.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

Specifies the Sitecore user by providing one of the following values.

Local Name
Example: michael
Fully Qualified Name
Example: sitecore\michael

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Instance <User>

Specifies the Sitecore user by providing an instance of a user.

Aliases

Required? true

Position? named

Default Value

Disable-User 103
Sitecore PowerShell Extensions

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

System.String Represents the identity of a user.

Sitecore.Security.Accounts.User One or more user instances.

Outputs
The output type is the type of the objects that the cmdlet emits.

None.

Notes
Michael West

Examples

EXAMPLE 1

PS master:\> Disable-User -Identity michael

EXAMPLE 2

PS master:\> Get-User -Filter * | Disable-User

Related Topics
http://michaellwest.blogspot.com

Disable-User 104
Sitecore PowerShell Extensions

Enable-User
Enables the specified Sitecore user.

Syntax
Enable-User [-Identity]

Enable-User -Instance

Detailed Description
The Enable-User command gets a user and enables the account in Sitecore.

The Identity parameter specifies the Sitecore user to get. You can specify a user by its local name or fully qualified name.
You can also specify user object variable, such as $<user>.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

Specifies the Sitecore user by providing one of the following values.

Local Name
Example: michael
Fully Qualified Name
Example: sitecore\michael

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Instance <User>

Specifies the Sitecore user by providing an instance of a user.

Aliases

Required? true

Position? named

Default Value

Enable-User 105
Sitecore PowerShell Extensions

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

System.String Represents the identity of one or more users.

Sitecore.Security.Accounts.User One or more user instances.

Outputs
The output type is the type of the objects that the cmdlet emits.

None.

Notes
Michael West

Examples

EXAMPLE 1

PS master:\> Enable-User -Identity michael

EXAMPLE 2

PS master:\> Get-User -Filter * | Enable-User

Related Topics
http://michaellwest.blogspot.com

Enable-User 106
Sitecore PowerShell Extensions

Expand-Token
Expands tokens in fields for items.

Syntax
Expand-Token [-Language ] [-Path]

Expand-Token [-Language ] -Id [-Database ]

Expand-Token [-Language ] [-Item]

Detailed Description
The Expand-Token command expands the tokens in fields for items.

Some example of tokens include:

$name
$time

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Language <String[]>

Language that will be processed. If not specified the current user language will be used. Globbing/wildcard supported.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

The item to be processed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Expand-Token 107
Sitecore PowerShell Extensions

Accept Wildcard Characters? false

-Path <String>

Path to the item to be processed - additionally specify Language parameter to fetch different item language than the current
user language.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the the item to be processed - additionally specify Language parameter to fetch different item language than the
current user language.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs

Expand-Token 108
Sitecore PowerShell Extensions

The output type is the type of the objects that the cmdlet emits.

Sitecore.Data.Items.Item

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Get-Item master:\content\home | Expand-Token

Related Topics
https://github.com/SitecorePowerShell/Console/
http://sitecorejunkie.com/2014/05/27/launch-powershell-scripts-in-the-item-context-menu-using-sitecore-powershell-
extensions/
http://sitecorejunkie.com/2014/06/02/make-bulk-item-updates-using-sitecore-powershell-extensions/

Expand-Token 109
Sitecore PowerShell Extensions

Export-Item
Exports (serializes) the Sitecore item to the filesystem.

Syntax
Export-Item [-Entry ] [-Recurse] [-ItemPathsAbsolute] [-Root ]

Export-Item [-Item] [-Recurse] [-ItemPathsAbsolute] [-Root ]

Export-Item [-Path] [-Recurse] [-ItemPathsAbsolute] [-Root ]

Export-Item -Id [-Database ] [-Recurse] [-ItemPathsAbsolute] [-Root ]

Detailed Description
The Export-Item command serializes Sitecore items to the filesystem. The alias for the command is Serialize-Item. The
simplest command syntax is: Export-Item -path "master:\content"

or

Get-Item "master:\content" | Export-Item

Both of them will serialize the content item in the master database. In first case we pass the path to the item as a
parameter, in second case we serialize the items which come from the pipeline. You can send more items from the pipeline
to the Export-Item command, e.g. if you need to serialize all the descendants of the home item created by sitecore\admin,
you can use:

Get-Childitem "master:\content\home" -recurse | Where-Object { $_."__Created By" -eq "sitecore\admin" } | Export-Item

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions##
Aliases

The following abbreviations are aliases for this cmdlet:

Serialize-Item

Parameters

-Entry <IncludeEntry>

Serialization preset to be serialized. Obtain the preset through the use of Get-Preset command.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Export-Item 110
Sitecore PowerShell Extensions

Accept Wildcard Characters? false

-Recurse <SwitchParameter>

Process the item and all of its children - switch which decides if serialization concerns only the single item or the whole tree
below the item, e.g.

Export-Item -path "master:\content\articles" -recurse

Root - directory where the serialized files should be saved, e.g. Export-Item -path "master:\content" -Root "c:\tmp"

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-ItemPathsAbsolute <SwitchParameter>

Works only with Root parameter and decides if folder structure starting from "sitecore\content" should be created, e.g. if you
want to serialize articles item in directory c:\tmp\sitecore\content you can use. For example: Export-Item -Path
"master:\content\articles" -ItemPathsAbsolute -Root "c:\tmp"

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Root <String>

Directory where the serialized files should be saved, e.g.

Export-Item -Path "master:\content" -Root "c:\tmp"

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

Export-Item 111
Sitecore PowerShell Extensions

The item to be serialized.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

You can pass the id of serialized item instead of path, e.g. Export-Item -id "{0DE95AE4-41AB-4D01-9EB0-67441B7C2450}"

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs

Export-Item 112
Sitecore PowerShell Extensions

The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Notes
Help Author: Marek Musielak, Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Export-Item -Path master:\content\home

Related Topics
https://github.com/SitecorePowerShell/Console/
Get-Preset
Import-Item
http://www.cognifide.com/blogs/sitecore/serialization-and-deserialization-with-sitecore-powershell-extensions/
https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=7
https://gist.github.com/AdamNaj/6c86f61510dc3d2d8b2f
http://stackoverflow.com/questions/20266841/sitecore-powershell-deserialization
http://stackoverflow.com/questions/20195718/sitecore-serialization-powershell
http://stackoverflow.com/questions/20283438/sitecore-powershell-deserialization-core-db

Export-Item 113
Sitecore PowerShell Extensions

Export-Package
Exports a Sitecore installation package and project.

Syntax
Export-Package [[-Path] ] [[-Project] ] [-Zip] [-NoClobber] [-IncludeProject]

Detailed Description
The Export-Package command creates a Sitecore installation package as either a .zip containing all items and files or .xml
with project definition.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Path <String>

Path the project should be saved under.

Aliases

Required? false

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Project <PackageProject>

Project object created ealier with the New-Package. or Loaded with Get-Package.

Aliases

Required? false

Position? 2

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Zip <SwitchParameter>

Specify this parameter to exposrt package with all its assets in a zip file. If this parameter is missing only Xml file with the
package project definition will be saved.

Export-Package 114
Sitecore PowerShell Extensions

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-NoClobber <SwitchParameter>

Do not overwrite (replace the contents) of an existing file. By default, if a file exists in the specified path, Export-Package
overwrites the file without warning.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-IncludeProject <SwitchParameter>

Specify this parameter if exporting the zip file and when you want it to contain the project definitnion xml file in it.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Install.PackageProject

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

Export-Package 115
Sitecore PowerShell Extensions

Following example creates a new package, adds content/home item to it and saves it in the Sitecore Package folder+ gives
you an option to download the saved package.

# Create package
$package = new-package "Sitecore PowerShell Extensions";

# Set package metadata


$package.Sources.Clear();

$package.Metadata.Author = "Adam Najmanowicz - Cognifide, Michael West";


$package.Metadata.Publisher = "Cognifide Limited";
$package.Metadata.Version = "2.7";
$package.Metadata.Readme = 'This text will be visible to people installing your package'

# Add contnet/home to the package


$source = Get-Item 'master:\content\home' | New-ItemSource -Name 'Home Page' -InstallMode Overwrite
$package.Sources.Add($source);

# Save package
Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip

# Offer the user to download the package


Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip"

Related Topics
Get-Package
Import-Package
Install-UpdatePackage
New-ExplicitFileSource
New-ExplicitItemSource
New-FileSource
New-ItemSource
New-Package
https://github.com/SitecorePowerShell/Console/
http://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/
https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae

Export-Package 116
Sitecore PowerShell Extensions

Export-Role
Exports (serializes) Sitecore roles to the filesystem on the server.

Syntax
Export-Role [-Identity] [-Root ]

Export-Role [-Identity] -Path

Export-Role -Filter [-Root ]

Export-Role [-Role] [-Root ]

Export-Role [-Role] -Path

Detailed Description
The Export-Role command exports (serializes) Sitecore roles to the filesystem on the server.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

Specifies the Sitecore role by providing one of the following values.

Local Name
Example: developer
Fully Qualified Name
Example: sitecore\developer

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Filter <String>

Specifies a simple pattern to match Sitecore roles.

Examples: The following examples show how to use the filter syntax.

To get all the roles, use the asterisk wildcard: Export-Role -Filter *

Export-Role 117
Sitecore PowerShell Extensions

To get all the roles in a domain use the following command: Export-Role -Filter "sitecore*"

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Role <Role>

Specifies the role to be exported

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Path <String>

Path to the file the role should be saved to.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Root <String>

Specifies the serialization root directory. If this parameter is not specified - the default Sitecore serialization folder will be
used (unless you're saving to an explicit location with the -Path parameter).

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Export-Role 118
Sitecore PowerShell Extensions

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

System.String Sitecore.Security.Accounts.Role

Outputs
The output type is the type of the objects that the cmdlet emits.

System.String

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\> Export-Role -Identity sitecore\Author

EXAMPLE 2

PS master:\> Export-Role -Filter sitecore\*

EXAMPLE 3

PS master:\> Export-Role -Root C:\my\Serialization\Folder\ -Filter *\*

EXAMPLE 4

PS master:\> Export-Role -Path C:\my\Serialization\Folder\Authors.role -Identity sitecore\Author

Related Topics
Import-Role
Export-User
Import-User
Export-Item
Import-Item

Export-Role 119
Sitecore PowerShell Extensions

https://github.com/SitecorePowerShell/Console/

Export-Role 120
Sitecore PowerShell Extensions

Export-UpdatePackage
Exports a Sitecore update package containing a serialization diff list.

Syntax
Export-UpdatePackage [-CommandList] [[-Name] ] [[-Path] ] [-Readme ] [-LicenseFileName ] [-Tag ]

Detailed Description
The Export-UpdatePackage command generates a Sitecore update package containing a serialization diff list.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-CommandList <List`1>

List of changes to be included in the package.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Name <String>

Name of the package.

Aliases

Required? false

Position? 2

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Path <String>

Path the update package should be saved under.

Aliases

Export-UpdatePackage 121
Sitecore PowerShell Extensions

Required? false

Position? 3

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Readme <String>

Contents of the "read me" instruction for the package

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-LicenseFileName <String>

file name of the license to be included with the package.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Tag <String>

Package tag.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Notes
Help Author: Adam Najmanowicz, Michael West

Export-UpdatePackage 122
Sitecore PowerShell Extensions

Examples

EXAMPLE

Create an update package that transforms the serialized database state defined in C:\temp\SerializationSource into into set
defined in C:\temp\SerializationTarget

$diff = Get-UpdatePackageDiff -SourcePath C:\temp\SerializationSource -TargetPath C:\temp\SerializationTarget


Export-UpdatePackage -Path C:\temp\SerializationDiff.update -CommandList $diff -Name name

Related Topics
Get-UpdatePackageDiff
Install-UpdatePackage
http://sitecoresnippets.blogspot.com/2012/10/sitecore-courier-effortless-packaging.html
https://github.com/adoprog/Sitecore-Courier
https://github.com/SitecorePowerShell/Console/

Export-UpdatePackage 123
Sitecore PowerShell Extensions

Export-User
Export (serialize) a Sitecore user to the filesystem on the server.

Syntax
Export-User [-Identity] [-Root ]

Export-User [-Identity] -Path

Export-User -Filter [-Root ]

Export-User [-User] [-Root ]

Export-User [-User] -Path

Export-User -Current [-Root ]

Export-User -Current -Path

Detailed Description
The Export-User command serializes a Sitecore user to the filesystem on the server.

The Identity parameter specifies the Sitecore user to get. You can specify a user by its local name or fully qualified name.
You can also specify user object variable, such as $<user>.

To search for and retrieve more than one user, use the Filter parameter.

You can also pipe a user from the Get-user command.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

Specifies the Sitecore user by providing one of the following values.

Local Name
Example: admin
Fully Qualified Name
Example: sitecore\admi

Aliases

Required? true

Position? 1

Default Value

Export-User 124
Sitecore PowerShell Extensions

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Filter <String>

Specifies a simple pattern to match Sitecore users.

Examples: The following examples show how to use the filter syntax.

To get all the users, use the asterisk wildcard: Export-User -Filter *

To get all the users in a domain use the following command: Export-User -Filter "sitecore*"

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-User <User>

User object retrieved from the Sitecore API or using the Get-User command.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Current <SwitchParameter>

Specifies that the current user should be serialized.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Path <String>

Path to the file the user should be saved to.

Export-User 125
Sitecore PowerShell Extensions

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Root <String>

Overrides Sitecore Serialization root directory

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Security.Accounts.User

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Export-User -Identify sitecore\admin

Related Topics
Export-Role
Import-User
Export-Item
Import-Role
Import-Item
Get-User
https://github.com/SitecorePowerShell/Console/

Export-User 126
Sitecore PowerShell Extensions

Export-User 127
Sitecore PowerShell Extensions

Find-Item
Finds items using the Sitecore Content Search API.

Syntax
Find-Item [-Index] [-Criteria ] [-Where ] [-WhereValues ] [-OrderBy ] [-First ] [-Last ] [-Skip ]

Detailed Description
The Find-Item command searches for items using the Sitecore Content Search API.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Index <String>

Name of the Index that will be used for the search:

Find-Item -Index sitecore_master_index -First 10

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Criteria <SearchCriteria[]>

simple search criteria in the following example form:

@{ Filter = "Equals"; Field = "_templatename"; Value = "PowerShell Script"; }, @{ Filter = "StartsWith"; Field = "_fullpath";
Value = "/sitecore/system/Modules/PowerShell/Script Library/System Maintenance"; }, @{ Filter = "DescendantOf"; Value =
(Get-Item "master:/system/Modules/PowerShell/Script Library/") }

Where "Filter" is one of the following values:

Equals
StartsWith,
Contains,
EndsWith
DescendantOf

Fields by which you can filter can be discovered using the following script:

Find-Item 128
Sitecore PowerShell Extensions

Find-Item -Index sitecore_master_index -Criteria @{Filter = "StartsWith"; Field = "_fullpath"; Value =


"/sitecore/content/" } -First 1 | select -expand "Fields"

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Where <String>

Works on Sitecore 7.5 and later versions only.

Filtering Criteria using Dynamic Linq syntax: http://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-


query-library

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-WhereValues <Object[]>

Works on Sitecore 7.5 and later versions only.

An Array of objects for Dynamic Linq "-Where" parameter as explained in: http://weblogs.asp.net/scottgu/dynamic-linq-part-
1-using-the-linq-dynamic-query-library

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-OrderBy <String>

Works on Sitecore 7.5 and later versions only.

Field by which the search results sorting should be performed. Dynamic Linq ordering syntax used.
http://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library

Aliases

Find-Item 129
Sitecore PowerShell Extensions

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-First <Int32>

Number of returned search results.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Last <Int32>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Skip <Int32>

Number of search results to be skipped skip before returning the results commences.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.ContentSearch.SearchTypes.SearchResultItem

Find-Item 130
Sitecore PowerShell Extensions

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Fields by which filtering can be performed using the -Criteria parameter

Find-Item -Index sitecore_master_index `


-Criteria @{Filter = "StartsWith"; Field = "_fullpath"; Value = "/sitecore/content/" } `
-First 1 |
select -expand "Fields"

EXAMPLE 2

Find all children of a specific item including that item - return Sitecore items

$root = (Get-Item "master:/system/Modules/PowerShell/Script Library/")


Find-Item -Index sitecore_master_index `
-Criteria @{Filter = "DescendantOf"; Field = $root } |
Initialize-Item

EXAMPLE 3

Find all Template Fields using Dynamic LINQ syntax

Find-Item `
-Index sitecore_master_index `
-Where 'TemplateName = @0 And Language=@1' `
-WhereValues "Template Field", "en"

EXAMPLE 4

Find all Template Fields using the -Criteria parameter syntax

Find-Item `
-Index sitecore_master_index `
-Criteria @{Filter = "Equals"; Field = "_templatename"; Value = "Template Field"},
@{Filter = "Equals"; Field = "_language"; Value = "en"}

Related Topics
Initialize-Item
Get-Item
Get-ChildItem

Find-Item 131
Sitecore PowerShell Extensions

https://gist.github.com/AdamNaj/273458beb3f2b179a0b6
http://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library
https://github.com/SitecorePowerShell/Console/

Find-Item 132
Sitecore PowerShell Extensions

Get-Archive
Returns Sitecore database archives.

Syntax
Get-Archive [[-Database] ] [[-Name] ]

Detailed Description
The Get-Archive command returns Sitecore archives in context of the specified database.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Name <String>

Name of the archive to retrieve.

Aliases

Required? false

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <Database>

Database for which the archives should be retrieved.

Aliases

Required? false

Position? 2

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Database

Get-Archive 133
Sitecore PowerShell Extensions

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Data.Archiving.Archive

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Get-Archive -Database "master"

Name Items
---- -----
archive 0
recyclebin 1950

Related Topics
https://github.com/SitecorePowerShell/Console/

Get-Archive 134
Sitecore PowerShell Extensions

Get-Cache
Retrieves a Sitecore cache.

Syntax
Get-Cache [[-Name] ]

Detailed Description
The Get-Cache command retrieves a Sitecore cache.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Name <String>

Name of the cache to retrieve. Supports wildcards.

Aliases

Required? false

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Caching.Cache

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Get-Cache -Name master*

Get-Cache 135
Sitecore PowerShell Extensions

Name Enabled Count Size Max Size Default Scavengable


Priority
---- ------- ----- ---- -------- -------- -----------
master[blobIDs] True 0 0 512000 Normal False
master[blobIDs] True 0 0 512000 Normal False
master[blobIDs] True 0 0 512000 Normal False
master[itempaths] True 292 108228 10485760 Normal False
master[standardValues] True 57 38610 512000 Normal False
master[paths] True 108 13608 512000 Normal False
master[items] True 1010 5080300 10485760 Normal False
master[data] True 3427 7420654 20971520 Normal False

Related Topics
https://github.com/SitecorePowerShell/Console/

Get-Cache 136
Sitecore PowerShell Extensions

Get-Database
Retrieves a Sitecore Database.

Syntax
Get-Database [[-Name] ] [-Item ]

Detailed Description
The Get-Database command retrieves one or more Sitecore Database objects based on name or item passed to it.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Name <String>

Name of the database to be returned.

Aliases

Required? false

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Item <Item>

Database returned will be taken from the item passed to the command.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item System.String

Get-Database 137
Sitecore PowerShell Extensions

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Data.Database

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\> Get-Database
Name Languages Protected Read Only
---- --------- --------- ---------
core {da, pl-PL, ja-JP, en...} False False
master {en, de-DE, es-ES, pt-BR...} False False
web {es-ES, de-DE, pt-BR, pl-PL... False False
filesystem {en, en-US} False True

EXAMPLE 2

PS master:\> Get-Database -Name "master"

Name Languages Protected Read Only


---- --------- --------- ---------
master {en, de-DE, es-ES, pt-BR...} False False

EXAMPLE 3

PS master:\> Get-Item . | Get-Database

Name Languages Protected Read Only


---- --------- --------- ---------
master {en, de-DE, es-ES, pt-BR...} False False

Related Topics
https://github.com/SitecorePowerShell/Console/

Get-Database 138
Sitecore PowerShell Extensions

Get-Domain
Gets all available domains or the specified domain.

Syntax
Get-Domain [-Name ]

Detailed Description
The Get-Domain command returns all the domains or the specified domain.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Name <String>

The name of the domai

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

System.String Represents the name of a domain.

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Security.Domains.Domai

Notes
Help Author: Adam Najmanowicz, Michael West

Examples
Get-Domain 139
Sitecore PowerShell Extensions

EXAMPLE 1

PS master:\> Get-Domain -Name sitecore


Name AccountPrefix EnsureAnonymousUser LocallyManaged
---- ------------- ------------------- --------------
sitecore sitecore\ False False

EXAMPLE 2

PS master:\> Get-Domain

Name AccountPrefix EnsureAnonymousUser LocallyManaged


---- ------------- ------------------- --------------
sitecore sitecore\ False False
extranet extranet\ True False
default default\ True False

Related Topics
https://github.com/SitecorePowerShell/Console/
Remove-Domain
New-Domain

Get-Domain 140
Sitecore PowerShell Extensions

Get-ItemAcl
Retrieves security access rules from an item.

Syntax
Get-ItemAcl -Identity -Path

Get-ItemAcl -Identity -Id [-Database ]

Get-ItemAcl -Identity -Item

Get-ItemAcl -Filter -Path

Get-ItemAcl -Filter -Id [-Database ]

Get-ItemAcl -Filter -Item

Get-ItemAcl -Item

Get-ItemAcl -Path

Get-ItemAcl -Id

Detailed Description
Retrieves security access rules from an item.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

User name including domain for which the access rule is being created. If no domain is specified - 'sitecore' will be used as
the default domain.

Specifies the Sitecore user by providing one of the following values.

Local Name
Example: adam
Fully Qualified Name
Example: sitecore\adam

Aliases

Required? true

Position? named

Default Value

Get-ItemAcl 141
Sitecore PowerShell Extensions

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Filter <String>

Specifies a simple pattern to match Sitecore roles & users.

Examples: The following examples show how to use the filter syntax.

To get security for all roles, use the asterisk wildcard: Get-ItemAcl -Filter *

To security got all roles in a domain use the following command: Get-ItemAcl -Filter "sitecore*"

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

The item from which the security rules should be taken.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Path <String>

Path to the item from which the security rules should be taken.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the item from which the security rules should be taken.

Get-ItemAcl 142
Sitecore PowerShell Extensions

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be fetched with Id parameter containing the security rules that should be returned.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Security.AccessControl.AccessRule

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Take the security information from the Home item and apply it to the Settings item

$acl = Get-ItemAcl -Path master:\content\home


Set-ItemAcl -Path master:\content\Settings -AccessRules $acl -PassThru

EXAMPLE 2
Get-ItemAcl 143
Sitecore PowerShell Extensions

Take the security information from the Home item and add it to the access rules on the Settings item

$acl = Get-ItemAcl -Path master:\content\home


Add-ItemAcl -Path master:\content\Settings -AccessRules $acl -PassThru

Related Topics
Add-ItemAcl
Clear-ItemAcl
Set-ItemAcl
New-ItemAcl
Test-ItemAcl
https://sdn.sitecore.net/upload/sitecore6/security_administrators_cookbook_a4.pdf
https://sdn.sitecore.net/upload/sitecore6/61/security_reference-a4.pdf
https://sdn.sitecore.net/upload/sitecore6/64/content_api_cookbook_sc64_and_later-a4.pdf
http://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2013/01/sitecore-security-access-
rights.aspx
https://briancaos.wordpress.com/2009/10/02/assigning-security-to-items-in-sitecore-6-programatically/

Get-ItemAcl 144
Sitecore PowerShell Extensions

Get-ItemClone
Returns all the clones for the specified item.

Syntax
Get-ItemClone [-Item]

Get-ItemClone [-Path]

Get-ItemClone -Id [-Database ]

Detailed Description
The Get-ItemClone command returns all the clones for the specified item.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Item <Item>

The item to be analysed for clones presence.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be analysed for clones presence.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Get-ItemClone 145
Sitecore PowerShell Extensions

Id of the item to be analysed for clones presence.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be processed - if item is being provided through Id.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Data.Items.Item

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Get-ItemClone -Path master:\content\home

Related Topics
Get-ItemClone 146
Sitecore PowerShell Extensions

New-ItemClone
ConvertFrom-ItemClone
https://github.com/SitecorePowerShell/Console/
https://github.com/SitecorePowerShell/Console/issues/218
Get-Item

Get-ItemClone 147
Sitecore PowerShell Extensions

Get-ItemField
Retrieves item fields as either names or fields or template fields.

Syntax
Get-ItemField [-Language ] [-Path] [-IncludeStandardFields] [-ReturnType ] [-Name ]

Get-ItemField [-Language ] -Id [-Database ] [-IncludeStandardFields] [-ReturnType ] [-Name ]

Get-ItemField [-Language ] [-Item] [-IncludeStandardFields] [-ReturnType ] [-Name ]

Detailed Description
Retrieves item fields as either names or fields or template fields.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-IncludeStandardFields <SwitchParameter>

Includes fields that are defined on "Standard template"

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-ReturnType <ReturnValue>

Determines type returned. The possible values include:

Name - strings with field names.


Field - fields on the item
TemplateField - template fields.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Get-ItemField 148
Sitecore PowerShell Extensions

-Name <String[]>

Array of names to include - supports wildcards.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Language <String[]>

Language that will be analysed. If not specified the current user language will be used. Globbing/wildcard supported.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

The item to be analysed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be analysed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Get-ItemField 149
Sitecore PowerShell Extensions

Accept Wildcard Characters? false

-Id <String>

Id of the item to be analysed.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be analysed - can work with Language parameter to narrow the publication scope.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Data.Items.Item Sitecore.Data.Templates.TemplateField Sitecore.Data.Fields.Field

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Get list of names of non standard fields from /sitecore/content/home item

Get-ItemField 150
Sitecore PowerShell Extensions

PS master:\> Get-ItemField -Path master:\content\home

Text
Title
Image

EXAMPLE 2

Get list of fields including standard fields from /sitecore/content/home item and list their Name, DisplayName,
SectionDisplayName and Description in a table.

PS master:\> Get-Item master:\content\home | Get-ItemField -IncludeStandardFields -ReturnType Field -Name "*" | ft Name, DisplayName, S

Name DisplayName SectionDisplayName Description


---- ----------- ------------------ -----------
__Revision Revision Statistics
__Standard values __Standard values Advanced
__Updated by Updated by Statistics
__Validate Button Validation Rules Validation Button Validation Rules Validation Rules
__Created Created Statistics
__Thumbnail Thumbnail Appearance
__Insert Rules Insert Rules Insert Options
__Short description Short description Help
__Created by Created by Statistics
__Presets Presets Layout
Text Text Data The text is the main content of the document.
__Read Only Read Only Appearance
__Quick Action Bar Validation Rules Quick Action Bar Validation Rules Validation Rules
__Reminder recipients Reminder recipients Tasks
__Default workflow Default workflow Workflow
__Owner Owner Security
Title Title Data The title is displayed at the top of the docu
__Hide version Hide version Lifetime
__Ribbon Ribbon Appearance
__Unpublish Unpublish Publishing
__Workflow Validation Rules Workflow Validation Rules Validation Rules
__Editors Editors Appearance
__Renderings Renderings Layout
__Masters Insert Options Insert Options
__Source __Source Advanced
__Page Level Test Set Definition Page Level Test Set Layout
__Validator Bar Validation Rules Validation Bar Validation Rules Validation Rules
__Reminder date Reminder date Tasks
__Updated Updated Statistics
__Workflow state State Workflow
__Renderers Renderers Layout
__Publishing groups Publishing targets Publishing
__Controller Action Controller Action Layout
__Tracking Tracking Advanced
__Originator __Originator Appearance
__Workflow Workflow Workflow
__Valid from Valid from Lifetime
__Publish Publish Publishing
__Editor Editor Appearance
__Archive Version date Archive Version date Tasks
__Controller Controller Layout
__Sortorder Sortorder Appearance
__Never publish Never publish Publishing
__Icon Icon Appearance
__Hidden Hidden Appearance
__Suppressed Validation Rules Suppressed Validation Rules Validation Rules
__Long description Long description Help
__Subitems Sorting Subitems Sorting Appearance
__Archive date Archive date Tasks
__Reminder text Reminder text Tasks
__Context Menu Context Menu Appearance
__Security Security Security
__Skin Skin Appearance
Image Image Data

Get-ItemField 151
Sitecore PowerShell Extensions

__Valid to Valid to Lifetime


__Style Style Appearance
__Lock Lock Workflow
__Help link Help link Help
__Display name Display name Appearance Is shown in the content editor.
__Preview __Preview Appearance

Related Topics
Get-ItemTemplate
Reset-ItemField
https://github.com/SitecorePowerShell/Console/

Get-ItemField 152
Sitecore PowerShell Extensions

Get-ItemReference
Returns all the items linked to the specified item..

Syntax
Get-ItemReference -Item

Get-ItemReference -Item -ItemLink

Get-ItemReference -Path [-Language ]

Get-ItemReference -Path [-Language ] -ItemLink

Get-ItemReference -Id [-Database ] [-Language ]

Get-ItemReference -Id [-Database ] [-Language ] -ItemLink

Detailed Description
The Get-ItemReference command returns all items linked to the specified item. If -ItemLink parameter is used the
command will return links rather than items.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Item <Item>

The item to be analysed.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be processed - additionally specify Language parameter to fetch different item language than the current
user language.

Aliases

Required? true

Position? named

Get-ItemReference 153
Sitecore PowerShell Extensions

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the the item to be processed - additionally specify Language parameter to fetch different item language than the
current user language.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Language <String[]>

Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard
supported.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-ItemLink <SwitchParameter>

Return ItemLink that define both source and target of a link rather than items that are being linked to from the specified
item.

Aliases

Get-ItemReference 154
Sitecore PowerShell Extensions

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Data.Items.Item Sitecore.Links.ItemLink

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\>Get-ItemReference -Path master:\content\home

Name Children Languages Id TemplateName


---- -------- --------- -- ------------
Home True {en, de-DE, es-ES, pt... {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item
Home True {en, de-DE, es-ES, pt... {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item

EXAMPLE 2

PS master:\>Get-Item master:\content\home | Get-ItemReference -ItemLink

SourceItemLanguage : en
SourceItemVersion : 1
TargetItemLanguage :
TargetItemVersion : 0
SourceDatabaseName : master
SourceFieldID : {F685964D-02E1-4DB6-A0A2-BFA59F5F9806}
SourceItemID : {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}
TargetDatabaseName : master
TargetItemID : {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}
TargetPath : /sitecore/content/Home

Get-ItemReference 155
Sitecore PowerShell Extensions

Related Topics
Get-ItemReferrer
https://github.com/SitecorePowerShell/Console/

Get-ItemReference 156
Sitecore PowerShell Extensions

Get-ItemReferrer
Returns all the items referring to the specified item.

Syntax
Get-ItemReferrer -Item

Get-ItemReferrer -Item -ItemLink

Get-ItemReferrer -Path [-Language ]

Get-ItemReferrer -Path [-Language ] -ItemLink

Get-ItemReferrer -Id [-Database ] [-Language ]

Get-ItemReferrer -Id [-Database ] [-Language ] -ItemLink

Detailed Description
The Get-ItemReferrer command returns all items referring to the specified item. If -ItemLink parameter is used the
command will return links rather than items.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Item <Item>

The item to be analysed.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be processed - additionally specify Language parameter to fetch different item language than the current
user language.

Aliases

Required? true

Position? named

Get-ItemReferrer 157
Sitecore PowerShell Extensions

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the the item to be processed - additionally specify Language parameter to fetch different item language than the
current user language.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Language <String[]>

Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard
supported.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-ItemLink <SwitchParameter>

Return ItemLink that define both source and target of a link rather than items linking to the specified item.

Aliases

Get-ItemReferrer 158
Sitecore PowerShell Extensions

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Data.Items.Item Sitecore.Links.ItemLink

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\>Get-ItemReferrer -Path master:\content\home

Name Children Languages Id TemplateName


---- -------- --------- -- ------------
Home True {en, de-DE, es-ES, pt... {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item
Form False {en, de-DE, es-ES, pt... {6D3B4E7D-FEF8-4110-804A-B56605688830} Webcontrol
news True {en, de-DE, es-ES, pt... {DB894F2F-D53F-4A2D-B58F-957BFAC2C848} Article
learn-about-oms False {en, de-DE, es-ES, pt... {79ECF4DF-9DB7-430F-9BFF-D164978C2333} Link

EXAMPLE 2

PS master:\>Get-Item master:\content\home | Get-ItemReferrer -ItemLink

SourceItemLanguage : en
SourceItemVersion : 1
TargetItemLanguage :
TargetItemVersion : 0
SourceDatabaseName : master
SourceFieldID : {F685964D-02E1-4DB6-A0A2-BFA59F5F9806}
SourceItemID : {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}
TargetDatabaseName : master
TargetItemID : {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}
TargetPath : /sitecore/content/Home

Get-ItemReferrer 159
Sitecore PowerShell Extensions

Related Topics
Get-ItemReference
https://github.com/SitecorePowerShell/Console/

Get-ItemReferrer 160
Sitecore PowerShell Extensions

Get-ItemTemplate
Returns the item template and its base templates.

Syntax
Get-ItemTemplate [-Item] [-Recurse]

Get-ItemTemplate [-Path] [-Recurse]

Get-ItemTemplate -Id [-Database ] [-Recurse]

Detailed Description
The Get-ItemTemplate command returns the item template and its base templates.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Recurse <SwitchParameter>

Return the template the item is based on and all of its base templates.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

The item to be analysed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Get-ItemTemplate 161
Sitecore PowerShell Extensions

Path to the item to be analysed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the item to be analysed.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be analysed - required if item is specified with Id.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Data.Items.TemplateItem

Notes
Get-ItemTemplate 162
Sitecore PowerShell Extensions

Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Get template of /sitecore/conent/home item

PS master:\> Get-ItemTemplate -Path master:\content\home

BaseTemplates : {Standard template}


Fields : {__Context Menu, __Display name, __Editor, __Editors...}
FullName : Sample/Sample Item
Key : sample item
OwnFields : {Title, Text, Image, State...}
StandardValues : Sitecore.Data.Items.Item
Database : master
DisplayName : Sample Item
Icon : Applications/16x16/document.png
ID : {76036F5E-CBCE-46D1-AF0A-4143F9B557AA}
InnerItem : Sitecore.Data.Items.Item
Name : Sample Item

EXAMPLE 2

Get template of /sitecore/conent/home item and all of the templates its template is based on then format it to only show the
template name, path and Key

PS master:\> Get-Item -Path master:/content/Home | Get-ItemTemplate -Recurse | ft Name, FullName, Key -auto

Name FullName Key


---- -------- ---
Sample Item Sample/Sample Item sample item
Standard template System/Templates/Standard template standard template
Advanced System/Templates/Sections/Advanced advanced
Appearance System/Templates/Sections/Appearance appearance
Help System/Templates/Sections/Help help
Layout System/Templates/Sections/Layout layout
Lifetime System/Templates/Sections/Lifetime lifetime
Insert Options System/Templates/Sections/Insert Options insert options
Publishing System/Templates/Sections/Publishing publishing
Security System/Templates/Sections/Security security
Statistics System/Templates/Sections/Statistics statistics
Tasks System/Templates/Sections/Tasks tasks
Validators System/Templates/Sections/Validators validators
Workflow System/Templates/Sections/Workflow workflow

Related Topics
Get-ItemField
https://github.com/SitecorePowerShell/Console/

Get-ItemTemplate 163
Sitecore PowerShell Extensions

Get-ItemWorkflowEvent
Returns entries from the history store notifying of workflow state change for the specified item.

Syntax
Get-ItemWorkflowEvent [-Language ] [-Path] [-Identity ]

Get-ItemWorkflowEvent [-Language ] -Id [-Database ] [-Identity ]

Get-ItemWorkflowEvent [-Language ] [-Item] [-Identity ]

Detailed Description
The Get-ItemWorkflowEvent command returns entries from the history store notifying of workflow state change for the
specified item.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <String>

User that has been associated with the enteries. Wildcards are supported.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Language <String[]>

Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard
supported.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Get-ItemWorkflowEvent 164
Sitecore PowerShell Extensions

-Item <Item>

The item to have its history items returned.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to have its history items returned - additionally specify Language parameter to fetch different item language
than the current user language.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the the item to have its history items returned - additionally specify Language parameter to fetch different item
language than the current user language.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to have its history items returned - can work with Language parameter to narrow the
publication scope.

Aliases

Required? false

Position? named

Default Value

Get-ItemWorkflowEvent 165
Sitecore PowerShell Extensions

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Workflows.WorkflowEvent

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Get-ItemWorkflowEvent -Path master:\content\home


Date : 2014-07-27 14:23:33
NewState : {190B1C84-F1BE-47ED-AA41-F42193D9C8FC}
OldState : {46DA5376-10DC-4B66-B464-AFDAA29DE84F}
Text : Automated
User : sitecore\admin

Date : 2014-08-01 15:43:29


NewState : {190B1C84-F1BE-47ED-AA41-F42193D9C8FC}
OldState : {190B1C84-F1BE-47ED-AA41-F42193D9C8FC}
Text : Just leaving a note
User : sitecore\admin

Related Topics
New-ItemWorkflowEvent
Execute-Workflow
https://github.com/SitecorePowerShell/Console/

Get-ItemWorkflowEvent 166
Sitecore PowerShell Extensions

Get-Layout
Returns the layout for the specified item.

Syntax
Get-Layout [-Item] [-Device ]

Get-Layout [-Path] [-Device ]

Get-Layout -Id [-Database ] [-Device ]

Detailed Description
The Get-Layout command returns the layout for the specified item.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Device <DeviceItem>

Layout Device for which the item should be returned. If not specified All layouts used will be returned. If Device is specified
but no layout is specified the command will return an error that can be silenced

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

The item to be processed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Get-Layout 167
Sitecore PowerShell Extensions

Path to the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Data.Items.Item

Notes
Get-Layout 168
Sitecore PowerShell Extensions

Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Get-Layout -Path master:\content\home

Related Topics
https://github.com/SitecorePowerShell/Console/
Add-Rendering
New-Rendering
Set-Rendering
Get-Rendering
Get-LayoutDevice
Remove-Rendering
Set-Layout
Reset-Layout

Get-Layout 169
Sitecore PowerShell Extensions

Get-LayoutDevice
Returns the layout for the specified device.

Syntax
Get-LayoutDevice [-Name]

Get-LayoutDevice [-Default]

Detailed Description
The Get-LayoutDevice command returns the layout for the specified device.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Name <String>

Name of the device to return.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Default <SwitchParameter>

Determines that a default system layout device should be returned.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Get-LayoutDevice 170
Sitecore PowerShell Extensions

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Data.Items.DeviceItem

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Get Print device

PS master:\> Get-LayoutDevice "Print"

EXAMPLE 2

Get default device

PS master:\> Get-LayoutDevice -Default

EXAMPLE 3

Get all layout devices

PS master:\> Get-LayoutDevice *

Related Topics
https://github.com/SitecorePowerShell/Console/
Add-Rendering
New-Rendering
Set-Rendering
Get-Rendering
Remove-Rendering
Get-Layout
Set-Layout

Get-LayoutDevice 171
Sitecore PowerShell Extensions

Get-Package
Loads the package definition (xml) from the specified path.

Syntax
Get-Package [-Path]

Detailed Description
The Get-Package commands loads the package definition (xml) and returns the package project. Package definitions can
be created by PowerShell scripts using the Export-Package command (without the -Zip parameter)

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Path <String>

Path to the package file. If the path is not absolute the path needs to be relative to the Sitecore Package path defined in the
"PackagePath" setting and later exposed in the Sitecore.Shell.Applications.Install.PackageProjectPath

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Install.PackageProject

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

Get-Package 172
Sitecore PowerShell Extensions

PS master:\> Get-Package -Path master:\content\home

Related Topics
Export-Package
Import-Package
Install-UpdatePackage
New-ExplicitFileSource
New-ExplicitItemSource
New-FileSource
New-ItemSource
New-Package
https://github.com/SitecorePowerShell/Console/
http://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/
https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae
https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=7

Get-Package 173
Sitecore PowerShell Extensions

Get-Preset
Returns a serialization preset for use with Export-Item.

Syntax
Get-Preset [[-Name] ]

Detailed Description
The Get-Preset command returns a serialization preset for use with Export-Item.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Name <String[]>

Name of the serialization preset.

Aliases

Required? false

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Data.Serialization.Presets.IncludeEntry

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Get-Preset -Name "PowerShell", "AssetsOptimiser" | ft PresetName, Database, Path -AutoSize

Get-Preset 174
Sitecore PowerShell Extensions

PresetName Database Path


---------- -------- ----
PowerShell core /sitecore/templates/Modules/PowerShell Console
PowerShell core /sitecore/system/Modules/PowerShell/Console Colors
PowerShell core /sitecore/system/Modules/PowerShell/Script Library
PowerShell core /sitecore/layout/Layouts/Applications/PowerShell Console
PowerShell core /sitecore/layout/Layouts/Applications/PowerShell ISE Sheer
PowerShell core /sitecore/layout/Layouts/Applications/PowerShell ISE
PowerShell core /sitecore/layout/Layouts/Applications/PowerShell ListView
PowerShell core /sitecore/content/Documents and Settings/All users/Start menu/Right/PowerShell Toolbox
PowerShell core /sitecore/content/Applications/PowerShell
PowerShell core /sitecore/content/Applications/Content Editor/Context Menues/Default/Context PowerShell Scripts
PowerShell master /sitecore/templates/Modules/PowerShell Console
PowerShell master /sitecore/system/Modules/PowerShell/Console Colors
PowerShell master /sitecore/system/Modules/PowerShell/Rules
PowerShell master /sitecore/system/Modules/PowerShell/Script Library
AssetsOptimiser master /sitecore/templates/Cognifide/Optimiser
AssetsOptimiser master /sitecore/system/Modules/Optimiser

Related Topics
Serialize-Item
Deserialize-Item
https://github.com/SitecorePowerShell/Console/

Get-Preset 175
Sitecore PowerShell Extensions

Get-Rendering
Returns a RenderingDefinition for an item using the filtering parameters.

Syntax
Get-Rendering -Item [-DataSource ] [-Rendering ] [-Index ] [-PlaceHolder ] [-Parameter ] [-Device ]

Get-Rendering -Item -Instance [-Device ]

Get-Rendering -Item -UniqueId [-Device ]

Get-Rendering -Path [-DataSource ] [-Rendering ] [-Index ] [-PlaceHolder ] [-Parameter ] [-Device ]

Get-Rendering -Path -Instance [-Device ]

Get-Rendering -Path -UniqueId [-Device ]

Get-Rendering [-Id ] [-Database ] [-DataSource ] [-Rendering ] [-Index ] [-PlaceHolder ] [-Parameter ] [-Device ]

Get-Rendering [-Id ] [-Database ] -Instance [-Device ]

Get-Rendering [-Id ] [-Database ] -UniqueId [-Device ]

Detailed Description
The Get-Rendering command returns a RenderingDefinition for an item using the filtering parameters.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Item <Item>

The item to be processed.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Get-Rendering 176
Sitecore PowerShell Extensions

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-DataSource <String>

Data source filter - supports wildcards.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Rendering <Item>

Item representing the sublayout/rendering. If matching the rendering will be returned.

Get-Rendering 177
Sitecore PowerShell Extensions

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Index <Int32>

Index at which the rendering exists in the layout. The rendering at that index will be returned.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-PlaceHolder <String>

Place holder at which the rendering exists in the layout. Renderings at that place holder will be returned.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Parameter <Hashtable>

Additional rendering parameter values. If both name and value match - the rendering will be returned. Values support
wildcards.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Instance <RenderingDefinition>

Get-Rendering 178
Sitecore PowerShell Extensions

Specific instance of rendering that should be returned. The instance could earlier be obtained through e.g. use of Get-
Rendering.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-UniqueId <String>

UniqueID of the rendering to be retrieved.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Device <DeviceItem>

Device for which the renderings will be retrieved.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Layouts.RenderingDefinitio

Get-Rendering 179
Sitecore PowerShell Extensions

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

get all renderings for "Default" device, located in the any placeholder that has name in it or any of its sub-placeholders

PS master:\> Get-Item master:\content\home | Get-Rendering -Placeholder "*main*" -Device (Get-LayoutDevice "Default")

Related Topics
https://github.com/SitecorePowerShell/Console/
Add-Rendering
New-Rendering
Set-Rendering
Get-LayoutDevice
Remove-Rendering
Get-Layout
Set-Layout

Get-Rendering 180
Sitecore PowerShell Extensions

Get-Role
Returns one or more Sitecore roles using the specified criteria.

Syntax
Get-Role [-Identity]

Get-Role -Filter

Detailed Description
The Get-Role command returns one or more Sitecore roles using the specified criteria.

The Identity parameter specifies the Sitecore role to get. You can specify a role by its local name or fully qualified name.
You can also specify role object variable, such as $<role>.

To search for and retrieve more than one role, use the Filter parameter.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

Specifies the Sitecore role by providing one of the following values.

Local Name
Example: developer
Fully Qualified Name
Example: sitecore\developer

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Filter <String>

Specifies a simple pattern to match Sitecore roles.

Examples: The following examples show how to use the filter syntax.

To get all the roles, use the asterisk wildcard: Get-Role -Filter *

Get-Role 181
Sitecore PowerShell Extensions

To get all the roles in a domain use the following command: Get-Role -Filter "sitecore*"

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

System.String Represents the identity of a role.

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Security.Accounts.Role Returns one or more roles.

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\> Get-Role -Identity developer

Name Domain IsEveryone


---- ------ ----------
sitecore\developer sitecore False

EXAMPLE 2

PS master:\> "developer","author" | Get-Role

Name Domain IsEveryone


---- ------ ----------
sitecore\author sitecore False
sitecore\developer sitecore False

EXAMPLE 3

Get-Role 182
Sitecore PowerShell Extensions

PS master:\> Get-Role -Filter sitecore\d*

Name Domain IsEveryone


---- ------ ----------
sitecore\Designer sitecore False
sitecore\Developer sitecore False

Related Topics
https://github.com/SitecorePowerShell/Console/
Get-RoleMember

Get-Role 183
Sitecore PowerShell Extensions

Get-RoleMember
Returns the Sitecore users in the specified role.

Syntax
Get-RoleMember [-Identity] [-Recursive]

Get-RoleMember [-Identity] [-UsersOnly] [-Recursive]

Get-RoleMember [-Identity] [-RolesOnly] [-Recursive]

Detailed Description
The Get-RoleMember command returns the Sitecore users in the specified role.

The Identity parameter specifies the Sitecore role to get. You can specify a role by its local name or fully qualified name.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

Specifies the Sitecore role by providing one of the following values.

Local Name
Example: developer
Fully Qualified Name
Example: sitecore\developer

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Recursive <SwitchParameter>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Get-RoleMember 184
Sitecore PowerShell Extensions

Accept Wildcard Characters? false

-UsersOnly <SwitchParameter>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-RolesOnly <SwitchParameter>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

System.String Represents the identity of a role.

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Security.Accounts.User Returns one or more users.

Sitecore.Security.Accounts.Role Returns one or more roles.

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\> Get-RoleMember -Identity developer

Get-RoleMember 185
Sitecore PowerShell Extensions

Name Domain IsAdministrator IsAuthenticated


---- ------ --------------- ---------------
sitecore\michael sitecore False False

EXAMPLE 2

PS master:\> Get-RoleMember -Identity author

Name Domain IsAdministrator IsAuthenticated


---- ------ --------------- ---------------
sitecore\michael sitecore False False

Domain : sitecore
IsEveryone : False
IsGlobal : False
AccountType : Role
Description : Role
DisplayName : sitecore\Developer
LocalName : sitecore\Developer
Name : sitecore\Developer

Related Topics
https://github.com/SitecorePowerShell/Console/
Get-Role
Remove-RoleMember
Add-RoleMember

Get-RoleMember 186
Sitecore PowerShell Extensions

Get-ScriptSession
Returns the list of PowerShell Extensions script sessions running in the system.

Syntax
Get-ScriptSession -Current [-SessionType ] [-State ]

Get-ScriptSession -Id [-SessionType ] [-State ]

Get-ScriptSession -Session [-SessionType ] [-State ]

Detailed Description
The Get-ScriptSession command returns the list of PowerShell Extensions script sessions running in the system. To find all
script sessions, running in the system type "Get-ScriptSession" without parameters.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Current <SwitchParameter>

Returns current script session if the session is run in a background job.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-SessionType <String[]>

Type of the script session to be retrieved. The SessionType is a string that identifies where the session has been launched.
You can type one or more session types (separated by commas) and use wildcards to filter. To find currently running types
of a script session, type "Get-ScriptSession" without parameters.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Get-ScriptSession 187
Sitecore PowerShell Extensions

-State <RunspaceAvailability>

Type of the script session to be retrieved. The parameter limits script sessions to be returned to only those in a specific
state, the values should be "Busy" or "Available". To find states of currently running script sessions, type "Get-
ScriptSession" without parameters.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String[]>

Gets the script session with the specified IDs. The ID is a string that uniquely identifies the script session within the server.
You can type one or more IDs (separated by commas). To find the ID of a script session, type "Get-ScriptSession" without
parameters.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Session <ScriptSession[]>

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

None

Outputs
The output type is the type of the objects that the cmdlet emits.

Get-ScriptSession 188
Sitecore PowerShell Extensions

Cognifide.PowerShell.PowerShellIntegrations.Host.ScriptSessio

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\>Get-ScriptSession

Type Key Location


---- --- --------
Console $scriptSession$|zwlyrcmmzwisv22djsv0ej2a|8d5c3e63-3fed-0532-e7c5-761760567b83
Context $scriptSession$|zwlyrcmmzwisv22djsv0ej2a|renderingCopySession master:\content\Home
Context $scriptSession$|zwlyrcmmzwisv22djsv0ej2a|packageBuilder master:\content\Home

EXAMPLE 2

PS master:\>Get-ScriptSession -Current

Type Key Location


---- --- --------
Console $scriptSession$|zwlyrcmmzwisv22djsv0ej2a|8d5c3e63-3fed-0532-e7c5-761760567b83

Related Topics
Receive-ScriptSession
Remove-ScriptSession
Start-ScriptSession
Stop-ScriptSession
Wait-ScriptSession
https://git.io/spe
http://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/

Get-ScriptSession 189
Sitecore PowerShell Extensions

Get-SearchIndex
Returns the available Sitecore indexes.

Syntax
Get-SearchIndex [[-Name] ]

Detailed Description
The Get-SearchIndex command returns the available Sitecore indexes. These are the same as those found in the Control
Panel.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Name <String>

Name of the index to return.

Aliases

Required? false

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

None or System.String

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.ContentSearch.ISearchIndex

Notes
Help Author: Adam Najmanowicz, Michael West

Get-SearchIndex 190
Sitecore PowerShell Extensions

Examples

EXAMPLE 1

The following lists all available indexes.

PS master:\>Get-SearchIndex

Name IndexingState IsRebuilding IsSharded


---- ------------- ------------ ---------
sitecore_analytics_index Started False False
sitecore_core_index Started False False
sitecore_master_index Started True False
sitecore_web_index Started False False
sitecore_marketing_asset_inde... Started False False
sitecore_marketing_asset_inde... Started False False
sitecore_testing_index Started False False
sitecore_suggested_test_index Started False False
sitecore_fxm_master_index Started False False
sitecore_fxm_web_index Started False False
sitecore_list_index Started False False
social_messages_master Started False False
social_messages_web Started False False

EXAMPLE 2

The following lists only the specified index.

PS master:\>Get-SearchIndex -Name sitecore_master_index

Name IndexingState IsRebuilding IsSharded


---- ------------- ------------ ---------
sitecore_master_index Started True False

Related Topics
Initialize-SearchIndex
Stop-SearchIndex
Resume-SearchIndex
Suspend-SearchIndex
https://github.com/SitecorePowerShell/Console/

Get-SearchIndex 191
Sitecore PowerShell Extensions

Get-Session
Returns one or more Sitecore user sessions using the specified criteria.

Syntax
Get-Session [-Identity ]

Get-Session -InstanceId

Detailed Description
The Get-Session command returns one or more Sitecore user sessions using the specified criteria.

The Identity parameter specifies the Sitecore user to get. You can specify a user by its local name or fully qualified name.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

Specifies the Sitecore user by providing one of the following values.

Local Name
Example: admin
Fully Qualified Name
Example: sitecore\admi

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-InstanceId <String[]>

Specifies the Sitecore SessionID.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Get-Session 192
Sitecore PowerShell Extensions

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

None.

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Web.Authentication.DomainAccessGuard.Session Returns one or more user sessions.

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\> Get-Session

Created LastRequest SessionID UserName


------- ----------- --------- --------
7/3/2014 3:30:39 PM 7/3/2014 3:44:27 PM tekipna1lk0ccr2z1bdjsua2 sitecore\admin
7/3/2014 4:13:55 PM 7/3/2014 4:13:55 PM wq4bfivfm2tbgkgdccpyzczp sitecore\michael

EXAMPLE 2

PS master:\> Get-Session -Identity admin

Created LastRequest SessionID UserName


------- ----------- --------- --------
7/3/2014 3:30:39 PM 7/3/2014 3:44:27 PM tekipna1lk0ccr2z1bdjsua2 sitecore\admin

EXAMPLE 3

PS master:\> Get-Session -InstanceId tekipna1lk0ccr2z1bdjsua2,wq4bfivfm2tbgkgdccpyzczp

Created LastRequest SessionID UserName


------- ----------- --------- --------
7/3/2014 3:30:39 PM 7/3/2014 3:44:27 PM tekipna1lk0ccr2z1bdjsua2 sitecore\admin

Related Topics

Get-Session 193
Sitecore PowerShell Extensions

https://github.com/SitecorePowerShell/Console/
Remove-Session

Get-Session 194
Sitecore PowerShell Extensions

Get-SpeModule
Returns the object that describes a Sitecore PowerShell Extensions Module

Syntax
Get-SpeModule -Item

Get-SpeModule -Path

Get-SpeModule -Id -Database

Get-SpeModule -Database

Get-SpeModule [-Database ] -Name

Detailed Description
The Get-SpeModule command returns the object that describes a Sitecore PowerShell Extensions Module.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Item <Item>

A script or library item that is defined within the module to be returned.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to a script or library item that is defined within the module to be returned.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Get-SpeModule 195
Sitecore PowerShell Extensions

-Id <String>

Id of a script or library item that is defined within the module to be returned.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the module to be returned.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Name <String>

Name fo the module to return. Supports wildcards.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item System.String

Outputs
The output type is the type of the objects that the cmdlet emits.

Get-SpeModule 196
Sitecore PowerShell Extensions

Cognifide.PowerShell.Core.Modules.Module

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Return all modules defined in the provided database

PS master:\> Get-SpeModule -Database (Get-Database "master")

EXAMPLE 2

Return all modules defined in the master database Matching the "Content*" wildcard

PS master:\> Get-SpeModule -Database (Get-Database "master")

EXAMPLE 3

Return the module the piped script belongs to

PS master:\> Get-item "master:\system\Modules\PowerShell\Script Library\Copy Renderings\Content Editor\Context Menu\Layout\Copy Renderi

Related Topics
Get-SpeModuleFeatureRoot
http://blog.najmanowicz.com/2014/11/01/sitecore-powershell-extensions-3-0-modules-proposal/
https://github.com/SitecorePowerShell/Console/

Get-SpeModule 197
Sitecore PowerShell Extensions

Get-SpeModuleFeatureRoot
Returns the library item or path to the library where scripts for a particular integration point should be located for a specific
module.

Syntax
Get-SpeModuleFeatureRoot [-Module ] [-ReturnPath] [-Feature]

Detailed Description
The Get-SpeModuleFeatureRoot command returns library item or path to the library where scripts for a particular
integration point should be located for a specific module.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Module <Module>

Module for which the feature root library should be returned. If not provided the feature root will be returned for all modules.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-ReturnPath <SwitchParameter>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Feature <String>

Feature for which the root library should be provided. If root item does not exist and -ReturnPath parameter is not specified
- nothing will be returned, If -ReturnPath parameter is provided the path in which the feature root should be located will be
returned

Get-SpeModuleFeatureRoot 198
Sitecore PowerShell Extensions

Valid features:

contentEditorContextMenu
contentEditorGutters
contentEditorRibbon
controlPanel
functions
listViewExport
listViewRibbon
pipelineLoggedIn
pipelineLoggingIn
pipelineLogout
toolbox
startMenuReports
eventHandlers
webAPI
pageEditorNotification
isePlugi

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Data.Items.Item System.String

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Return the library item for "Content Editor Context Menu"

Get-SpeModuleFeatureRoot 199
Sitecore PowerShell Extensions

$module = Get-SpeModule -Name "Copy Renderings"


Get-SpeModuleFeatureRoot -Feature contentEditorContextMenu -Module $module

EXAMPLE 2

Return the Path to where "List View Export" scripts would be located if this feature was defined

$module = Get-SpeModule -Name "Copy Renderings"


Get-SpeModuleFeatureRoot -Module $module -Feature listViewExport -ReturnPath

Related Topics
Get-SpeModule
http://blog.najmanowicz.com/2014/11/01/sitecore-powershell-extensions-3-0-modules-proposal/
https://github.com/SitecorePowerShell/Console/

Get-SpeModuleFeatureRoot 200
Sitecore PowerShell Extensions

Get-TaskSchedule
Returns one or more task schedule items using the specified criteria.

Syntax
Get-TaskSchedule -Item

Get-TaskSchedule -Path

Get-TaskSchedule [[-Database] ] [[-Name] ]

Detailed Description
The Get-TaskSchedule command returns one or more task schedule items, based on name/database filter, path or simply
converting a Sitecore item.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Item <Item>

Task item to be converted.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be returned as Task Schedule.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Database <Database>

Get-TaskSchedule 201
Sitecore PowerShell Extensions

Database containing the task items to be returned. If not provided all databases will be considered for filtering using the
"Name" parameter.

Aliases

Required? false

Position? 2

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Name <String>

Task filter - supports wildcards. Works with "Database" parameter to narrow tassk to only single database.

Aliases

Required? false

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Tasks.ScheduleItem

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\> Get-TaskSchedule
Name Database Active Auto Remove Is Due Expired Completed Last Run Next Run
---- -------- ------ ----------- ------ ------- --------- -------- --------
__Task Schedule master True False True False False 0001-01-01 00:00:

Get-TaskSchedule 202
Sitecore PowerShell Extensions

Check Bounced Messages master True False False False False 2014-07-29 10:18:
Check DSN Messages master True False False False False 2014-07-29 10:19:
Clean Confirmation IDs master True False False False False 2014-07-28 22:14:
Clean Message History master True False False False False 2014-07-29 10:19:
Close Outdated Connections master True False False False False 2014-07-29 12:30:
Test-PowerShell master True False False False False 2014-07-28 14:30:
__Task Schedule web True False True False False 0001-01-01 00:00:
Check Bounced Messages web True False True False False 2013-11-04 08:36:
Check DSN Messages web True False True False False 2013-11-04 08:36:
Clean Confirmation IDs web True False False False False 2013-11-04 08:36:
Clean Message History web True False True False False 2013-11-04 08:36:
Close Outdated Connections web True False True False False 2013-11-04 09:36:
Test-PowerShell web True False True False False 2013-11-04 09:46:

EXAMPLE 2

PS master:\> Get-TaskSchedule -Name "*Check*"


Name Database Active Auto Remove Is Due Expired Completed Last Run Next Run
---- -------- ------ ----------- ------ ------- --------- -------- --------
Check Bounced Messages master True False False False False 2014-07-29 10:18:
Check DSN Messages master True False False False False 2014-07-29 10:19:
Check Bounced Messages web True False True False False 2013-11-04 08:36:
Check DSN Messages web True False True False False 2013-11-04 08:36:

EXAMPLE 3

PS master:\> Get-TaskSchedule -Name "*Check*" -Database "master"


Name Database Active Auto Remove Is Due Expired Completed Last Run Next Run
---- -------- ------ ----------- ------ ------- --------- -------- --------
Check Bounced Messages master True False False False False 2014-07-29 10:18:
Check DSN Messages master True False False False False 2014-07-29 10:19:

Related Topics
Start-TaskSchedule
https://github.com/SitecorePowerShell/Console/
https://www.youtube.com/watch?v=N3xgZcU9FqQ&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=9

Get-TaskSchedule 203
Sitecore PowerShell Extensions

Get-UpdatePackageDiff
Performs a diff operation between the Source and taget path akin to Sitecore Courier. The diff is the difference that takes
the content of Source folder and transforms it to Target. IMPORTANT! This functionality requires changes to web.config file
on your sitecore server to work. Please consult the first Example.

Syntax
Get-UpdatePackageDiff [-SourcePath] [[-TargetPath] ]

Detailed Description
Performs a diff operation between the Source and taget path akin to Sitecore Courier. The diff is the difference that takes
the content of Source folder and transforms it to Target. IMPORTANT! This functionality requires changes to web.config file
on your sitecore server to work. Please consult the first Example.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-SourcePath <String>

Path containing the current serialization items that needs to be transformed into Target.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-TargetPath <String>

Path containing the desired serialization state that the Source needs to be transformed to.

Aliases

Required? false

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Outputs
Get-UpdatePackageDiff 204
Sitecore PowerShell Extensions

The output type is the type of the objects that the cmdlet emits.

Sitecore.Update.Interfaces.ICommand

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Required addition to web.config file for the functionality to work:

<configuration>
<configSections>
<section name="sitecorediff" type="Sitecore.Update.Configuration.ConfigReader, Sitecore.Update"/>
</configSections>
<sitecorediff>
<commandfilters>
<filter id="changedFieldsFilter" mode="on" type="Sitecore.Update.Commands.Filters.ChangedFieldsFilter, Sitecore.Update"
<fields hint="list">
<field>__Created</field>
<field>{5DD74568-4D4B-44C1-B513-0AF5F4CDA34F}</field>
<field>__Revision</field>
<field>__Updated</field>
<field>__Updated by</field>
</fields>
</filter>
</commandfilters>
<dataproviders>
<dataprovider id="filesystemmain" type="Sitecore.Update.Data.Providers.FileSystemProvider, Sitecore.Update">
<param>$(id)</param>
</dataprovider>
<dataprovider id="snapshotprovider" type="Sitecore.Update.Data.Providers.SnapShotProvider, Sitecore.Update">
<param>$(id)</param>
</dataprovider>
</dataproviders>

<source type="Sitecore.Update.Data.DataManager, Sitecore.Update">


<param>source</param>
</source>

<target type="Sitecore.Update.Data.DataManager, Sitecore.Update">


<param>target</param>
</target>
</sitecorediff>
</configuration>

EXAMPLE 2

Create an update package that transforms the serialized database state defined in C:\temp\SerializationSource into into set
defined in C:\temp\SerializationTarget

$diff = Get-UpdatePackageDiff -SourcePath C:\temp\SerializationSource -TargetPath C:\temp\SerializationTarget


Export-UpdatePackage -Path C:\temp\SerializationDiff.update -CommandList $diff -Name name

Get-UpdatePackageDiff 205
Sitecore PowerShell Extensions

Related Topics
Export-UpdatePackage
Install-UpdatePackage
http://sitecoresnippets.blogspot.com/2012/10/sitecore-courier-effortless-packaging.html
https://github.com/adoprog/Sitecore-Courier
https://github.com/SitecorePowerShell/Console/

Get-UpdatePackageDiff 206
Sitecore PowerShell Extensions

Get-User
Returns one or more Sitecore users using the specified criteria.

Syntax
Get-User [-Identity] [-Authenticated]

Get-User -Filter

Get-User -Current

Detailed Description
The Get-User command returns a user or performs a search to retrieve multiple users from Sitecore.

The Identity parameter specifies the Sitecore user to get. You can specify a user by its local name or fully qualified name.
You can also specify user object variable, such as $<user>.

To search for and retrieve more than one user, use the Filter parameter.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

Specifies the Sitecore user by providing one of the following values.

Local Name:

admin

Fully Qualified Name:

sitecore\admi

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Filter <String>
Get-User 207
Sitecore PowerShell Extensions

Specifies a simple pattern to match Sitecore users.

Examples: The following examples show how to use the filter syntax.

To get all the users, use the asterisk wildcard:

Get-User -Filter *

To get all the users in a domain use the following command:

Get-User -Filter "sitecore\*"

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Current <SwitchParameter>

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Authenticated <SwitchParameter>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

System.String Represents the identity of a user.

Get-User 208
Sitecore PowerShell Extensions

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Security.Accounts.User Returns one or more users.

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\> Get-User -Identity admin

Name Domain IsAdministrator IsAuthenticated


---- ------ --------------- ---------------
sitecore\admin sitecore True False

EXAMPLE 2

PS master:\> "admin","michael" | Get-User

Name Domain IsAdministrator IsAuthenticated


---- ------ --------------- ---------------
sitecore\Admin sitecore True False
sitecore\michael sitecore False False

EXAMPLE 3

PS master:\> Get-User -Filter *

Name Domain IsAdministrator IsAuthenticated


---- ------ --------------- ---------------
default\Anonymous default False False
extranet\Anonymous extranet False False
sitecore\Admin sitecore True False
sitecore\michael sitecore False False

EXAMPLE 4

PS master:\> Get-User -Filter "michaellwest@*.com"

Name Domain IsAdministrator IsAuthenticated


---- ------ --------------- ---------------
sitecore\michael sitecore False False

Get-User 209
Sitecore PowerShell Extensions

Related Topics
https://github.com/SitecorePowerShell/Console/
Set-User
New-User
Remove-User
Unlock-User

Get-User 210
Sitecore PowerShell Extensions

Get-UserAgent
Returns the current user's browser user agent.

Syntax

Detailed Description
Returns current user's browser user agent. Works only if Console is running outside of job. (e.g. in ISE - script needs to be
run from the dropdown under the "Execute" button)

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

Outputs
The output type is the type of the objects that the cmdlet emits.

System.String

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Get-UserAgent

Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36

Related Topics
https://github.com/SitecorePowerShell/Console/

Get-UserAgent 211
Sitecore PowerShell Extensions

Import-Function
Imports a function script from the script library's "Functions" folder.

Syntax
Import-Function [-Name] [-Library ] [-Module ]

Detailed Description
The Import-Function command imports a function script from the script library's "Functions" folder.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Name <String>

Name of the script in the "Functions" library or one of its sub-libraries.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Library <String>

Name of the library withing the "Functions" library. Provide this name to disambiguate a script from other scripts of the
same name that might exist in multiple sub-librarties of the Functions library.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Module <String>

Name of the module "Functions" are going to be taken from. Provide this name to disambiguate a script from other scripts
of the same name that might exist in multiple Modules.

Import-Function 212
Sitecore PowerShell Extensions

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

System.Object

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

The following imports a Resolve-Error function that you may later use to get a deeper understanding of a problem with
script should one occur by xecuting the "Resolve-Error" command that was imported as a result of the execution of the
following line

PS master:\> Import-Function -Name Resolve-Error

Related Topics
Invoke-Script
https://github.com/SitecorePowerShell/Console/

Import-Function 213
Sitecore PowerShell Extensions

Import-Item
Imports (deserializes) the specified path from the filesystem on the server as a Sitecore item.

Syntax
Import-Item [-Database ] [-Root ] [-UseNewId] [-DisableEvents] [-ForceUpdate]

Import-Item [-Item] [-Recurse] [-Root ] [-UseNewId] [-DisableEvents] [-ForceUpdate]

Import-Item [-Preset] [-Root ] [-UseNewId] [-DisableEvents] [-ForceUpdate]

Import-Item [-Path] [-Recurse] [-Root ] [-UseNewId] [-DisableEvents] [-ForceUpdate]

Detailed Description
The Import-Item command deserializes the specified items.

The simplest syntax requires 2 parameters:

-Path : which is a path to the item on the drive but without .item extension. If the item does not exist in the Sitecore tree
yet, you need to pass the parent item path.
-Root : the directory which is the root of serialization. Trailing slash \ character is required,

e.g.:

Import-Item -Path "c:\project\data\serialization\master\sitecore\content\articles" -Root "c:\project\data\serialization\"

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions##
Aliases

The following abbreviations are aliases for this cmdlet:

Deserialize-Item

Parameters

-Database <Database>

Database to contain the item to be deserialized.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

Import-Item 214
Sitecore PowerShell Extensions

-Item <Item>

The item to be serialized.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Preset <IncludeEntry>

Name of the preset to be deserialized.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item on the drive but without .item extension. If the item does not exist in the Sitecore tree yet, you need to pass
the parent item path.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Recurse <SwitchParameter>

If included in the execution - dederializes both the item and all of its children.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Import-Item 215
Sitecore PowerShell Extensions

-Root <String>

The directory which is the root of serialization. Trailing slash \ character is required. if not specified the default root will be
used.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-UseNewId <SwitchParameter>

Tells Sitecore if each of the items should be created with a newly generated ID, e.g. Import-Item -path
"c:\project\data\serialization\master\sitecore\content\articles" -root "c:\project\data\serialization\" -usenewid -recurse

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-DisableEvents <SwitchParameter>

If set Sitecore will use EventDisabler during deserialization, e.g.: Import-Item -path
"c:\project\data\serialization\master\sitecore\content\articles" -root "c:\project

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-ForceUpdate <SwitchParameter>

Forces item to be updated even if it has not changed.

Aliases

Required? false

Position? named

Import-Item 216
Sitecore PowerShell Extensions

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Outputs
The output type is the type of the objects that the cmdlet emits.

System.Void

Notes
Help Author: Marek Musielak, Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\> Import-Item -path "c:\project\data\serialization\master\sitecore\content\articles" -root "c:\project\data\serialization\"

EXAMPLE 2

PS master:\> Import-Item -path "c:\project\data\serialization\master\sitecore\content\articles" -root "c:\project\data\serialization\"

Related Topics
https://github.com/SitecorePowerShell/Console/
Export-Item
Get-Preset
http://www.cognifide.com/blogs/sitecore/serialization-and-deserialization-with-sitecore-powershell-extensions/
https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=7
https://gist.github.com/AdamNaj/6c86f61510dc3d2d8b2f
http://stackoverflow.com/questions/20266841/sitecore-powershell-deserialization
http://stackoverflow.com/questions/20195718/sitecore-serialization-powershell
http://stackoverflow.com/questions/20283438/sitecore-powershell-deserialization-core-db

Import-Item 217
Sitecore PowerShell Extensions

Import-Role
Imports (deserializes) Sitecore roles from the Sitecore server filesystem.

Syntax
Import-Role [-Identity] [-Root ]

Import-Role -Filter [-Root ]

Import-Role [-Role] [-Root ]

Import-Role -Path

Detailed Description
The Import-Role command imports (deserializes) Sitecore roles from the Sitecore server filesystem.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

Specifies the Sitecore role to be deserialized by providing one of the following values.

Local Name
Example: developer
Fully Qualified Name
Example: sitecore\developer

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Filter <String>

Specifies a simple pattern to match Sitecore roles.

Examples: The following examples show how to use the filter syntax.

To get all the roles, use the asterisk wildcard: Import-Role -Filter *

To get all the roles in a domain use the following command: Import-Role -Filter "sitecore*"

Import-Role 218
Sitecore PowerShell Extensions

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Role <User>

An existing role object to be restored to the version from disk

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Path <String>

Path to the file the role should be loaded from.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Root <String>

Specifies the serialization root directory. If this parameter is not specified - the default Sitecore serialization folder will be
used (unless you're reading from an explicit location with the -Path parameter).

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs

Import-Role 219
Sitecore PowerShell Extensions

The input type is the type of the objects that you can pipe to the cmdlet.

System.String Sitecore.Security.Accounts.Role

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\> Import-Role -Identity sitecore\Author

EXAMPLE 2

PS master:\> Import-Role -Filter sitecore\*

EXAMPLE 3

PS master:\> Import-Role -Root C:\my\Serialization\Folder\ -Filter *\*

EXAMPLE 4

PS master:\> Import-Role -Path C:\my\Serialization\Folder\Admins.role

Related Topics
https://github.com/SitecorePowerShell/Console/

Import-Role 220
Sitecore PowerShell Extensions

Import-User
Imports (deserializes) Sitecore users from the Sitecore server filesystem.

Syntax
Import-User [-Identity] [-Root ]

Import-User -Filter [-Root ]

Import-User [-User] [-Root ]

Import-User -Path

Detailed Description
The Import-User command imports (deserializes) Sitecore users from the Sitecore server filesystem.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

Specifies the Sitecore user to be deserialized by providing one of the following values.

Local Name
Example: developer
Fully Qualified Name
Example: sitecore\developer

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Filter <String>

Specifies a simple pattern to match Sitecore users.

Examples: The following examples show how to use the filter syntax.

To get all the roles, use the asterisk wildcard: Import-User -Filter *

To get all the roles in a domain use the following command: Import-User -Filter "sitecore*"

Import-User 221
Sitecore PowerShell Extensions

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-User <User>

User object retrieved from the Sitecore API or using the Get-User command identifying the user account to be deserialized.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Path <String>

Path to the file the user should be loaded from.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Root <String>

Specifies the serialization root directory. If this parameter is not specified - the default Sitecore serialization folder will be
used (unless you're reading from an explicit location with the -Path parameter).

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs

Import-User 222
Sitecore PowerShell Extensions

The input type is the type of the objects that you can pipe to the cmdlet.

System.String Sitecore.Security.Accounts.User

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\> Import-User -Identity sitecore\Admin

EXAMPLE 2

PS master:\> Import-User -Filter sitecore\*

EXAMPLE 3

PS master:\> Import-User -Root C:\my\Serialization\Folder\ -Filter *\*

EXAMPLE 4

PS master:\> Import-User -Path C:\my\Serialization\Folder\Admin.user

Related Topics
https://github.com/SitecorePowerShell/Console/

Import-User 223
Sitecore PowerShell Extensions

Initialize-Item
Initializes items with the PowerShell automatic properties for each field.

Syntax
Initialize-Item -Item

Initialize-Item -SearchResultItem

Detailed Description
The Initialize-Item command wraps Sitecore item with PowerShell property equivalents of fields for easy assignment of
values to fields and automatic saving. This command can also be used to translate the the
"Sitecore.ContentSearch.SearchTypes.SearchResultItem" items obtained from the Find-Item command into full Sitecore
Items. The alias for the command is Wrap-Item.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions##
Aliases

The following abbreviations are aliases for this cmdlet:

Wrap-Item

Parameters

-Item <Item>

The item to be wrapped/initialized.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-SearchResultItem <SearchResultItem>

The item obtained from Find-Item command to be translated into a sitecore item.

Aliases

Required? true

Position? named

Default Value

Initialize-Item 224
Sitecore PowerShell Extensions

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item Sitecore.ContentSearch.SearchTypes.SearchResultItem

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Data.Items.Item

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

Initialize the item obtained directly through the Sitecore API with additional PowerShell properties

$item = [Sitecore.Configuration.Factory]::GetDatabase("master").GetItem("/sitecore/content/home");
#So far the item does not have PowerShell instrumentation wrapped around it yet - the following like wraps $item in those additional pr
$item = Initialize-Item -Item $item
# The following line will assign text to the field named MyCustomeTextField and persist the item into the database automatically using
$item.Title = "New Title"

Related Topics
Find-Item
Get-Item
Get-ChildItem
https://github.com/SitecorePowerShell/Console/

Initialize-Item 225
Sitecore PowerShell Extensions

Initialize-SearchIndex
Rebuilds the Sitecore index.

Syntax
Initialize-SearchIndex [-Index] <ISearchIndex> [-IncludeRemoteIndex] [-AsJob]

Initialize-SearchIndex [[-Name] <String>] [-IncludeRemoteIndex] [-AsJob]

Detailed Description
The Rebuild-SearchIndex command rebuilds Sitecore index. This command is an alias for Initialize-SearchIndex.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions##
Aliases

The following abbreviations are aliases for this cmdlet:

Rebuild-SearchIndex

Parameters

-Index <ISearchIndex>

The index instance.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-IncludeRemoteIndex <SwitchParameter>

The remote indexing should be triggered.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Initialize-SearchIndex 226
Sitecore PowerShell Extensions

-AsJob <SwitchParameter>

The job created for rebuilding the index should be returned as output.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Name <String>

The name of the index to resume.

Aliases

Required? false

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

None or Sitecore.Jobs.Job

Outputs
The output type is the type of the objects that the cmdlet emits.

None

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

The following rebuilds the index.

Initialize-SearchIndex 227
Sitecore PowerShell Extensions

PS master:\> Rebuild-SearchIndex -Name sitecore_master_index

EXAMPLE 2

The following rebuilds the index.

PS master:\> Get-SearchIndex -Name sitecore_master_index | Rebuild-SearchIndex

Related Topics
Resume-SearchIndex
Suspend-SearchIndex
Stop-SearchIndex
Get-SearchIndex
https://github.com/SitecorePowerShell/Console/

Initialize-SearchIndex 228
Sitecore PowerShell Extensions

Install-Package
Installs a Sitecore package from the specified path.

Syntax
Install-Package [[-Path] ] [-InstallMode ] [-MergeMode ]

Detailed Description
Installs Sitecore package with the ability to provide default responses for merge and overwrite actions. The alias for the
command is Import-Package.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions##
Aliases

The following abbreviations are aliases for this cmdlet:

Import-Package

Parameters

-Path <String>

Path to the package file.

Aliases

Required? false

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-InstallMode <InstallMode>

Undefined, Overwrite, Merge, Skip, SideBySide

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Install-Package 229
Sitecore PowerShell Extensions

-MergeMode <MergeMode>

Undefined, Clear, Append, Merge

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Install-Package -Path SitecorePowerShellConsole.zip - InstallMode Merge -MergeMode Merge

Related Topics
Export-Package
Get-Package
Install-UpdatePackage
New-ExplicitFileSource
New-ExplicitItemSource
New-FileSource
New-ItemSource
New-Package
https://github.com/SitecorePowerShell/Console/
http://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/
https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae
https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=7

Install-Package 230
Sitecore PowerShell Extensions

Install-UpdatePackage
Installs a Sitecore update package from the specified path.

Syntax
Install-UpdatePackage [-Path] [[-RollbackPackagePath] ] -UpgradeAction -InstallMode

Detailed Description
The Install-UpdatePackage command installs update packages that are used created by Sitecore CMS updates, TDS, and
Courier.

Install-UpdatePackage. Install-UpdatePackage -Path "C:\Projects\LaunchSitecore.TDSMaster.update" -UpgradeAction


{Preview or Upgrade} -InstallMode {Install or Update}

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Path <String>

Path to the .update package on the Sitecore server disk drive.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-RollbackPackagePath <String>

Specify Rollback Package Path - for rolling back if the installation was not functioning as expected.

Aliases

Required? false

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-UpgradeAction <UpgradeAction>

Install-UpdatePackage 231
Sitecore PowerShell Extensions

Preview / Upgrade

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-InstallMode <InstallMode>

Install / Update

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Update.Installer.ContingencyEntry

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Install-UpdatePackage -Path "C:\Projects\LaunchSitecore.TDSMaster.update" -UpgradeAction Preview -InstallMode Install

Related Topics
Export-UpdatePackage
Get-UpdatePackageDiff
https://github.com/SitecorePowerShell/Console/

Install-UpdatePackage 232
Sitecore PowerShell Extensions

Invoke-Script
Executes a script from Sitecore PowerShell Extensions Script Library. This command used to be named Execute-Script - a
matching alias added for compatibility with older scripts.

Syntax
Invoke-Script [-Item] [-ArgumentList ]

Invoke-Script [-Path] [-ArgumentList ]

Detailed Description
Executes a script from Sitecore PowerShell Extensions Script Library.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions##
Aliases

The following abbreviations are aliases for this cmdlet:

Execute-Script

Parameters

-Item <Item>

The script item to be executed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the script item to be executed. Path can be absolute or Relavie to Script library root. e.g. the following two
commands are equivalent:

PS master:\> Invoke-Script 'master:\system\Modules\PowerShell\Script Library\Examples\Script Testing\Long Running


Script with Progress Demo' PS master:\> Invoke-Script 'Examples\Script Testing\Long Running Script with Progress Demo'

Aliases

Required? true

Position? 1

Invoke-Script 233
Sitecore PowerShell Extensions

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-ArgumentList <Object[]>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

System.Object

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Invoke-Script 'Examples\Script Testing\Long Running Script with Progress Demo'

Related Topics
https://github.com/SitecorePowerShell/Console/
Import-Function

Invoke-Script 234
Sitecore PowerShell Extensions

Invoke-ShellCommand
Executes Sitecore Shell command for an item. This command used to be named Execute-ShellCommand - a matching
alias added for compatibility with older scripts.

Syntax
Invoke-ShellCommand [-Language ] [-Path] [-Name]

Invoke-ShellCommand [-Language ] -Id [-Database ] [-Name]

Invoke-ShellCommand [-Language ] [-Item] [-Name]

Detailed Description
Executes Sitecore Shell command for an item. e.g. opening dialogs or performing commands that you can find in the
Content Editor ribbon or context menu.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions##
Aliases

The following abbreviations are aliases for this cmdlet:

Execute-ShellCommand

Parameters

-Name <String>

Name of the sitecore command e.g. "item:publishingviewer"

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Language <String[]>

Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard
supported.

Aliases

Required? false

Position? named

Invoke-ShellCommand 235
Sitecore PowerShell Extensions

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

The item to be sent to the command.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be sent to the command - additionally specify Language parameter to fetch different item language than
the current user language.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the the item to be sent to the command - additionally specify Language parameter to fetch different item language than
the current user language.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be sent to the command - can work with Language parameter to narrow the publication
scope.

Aliases

Invoke-ShellCommand 236
Sitecore PowerShell Extensions

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Data.Items.Item

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Launch Publishing Viewer for /sitecore/content/home item.

PS master:\> Get-Item master:\content\home\ | Invoke-ShellCommand "item:publishingviewer"

EXAMPLE 2

Initiate /sitecore/content/home item duplication.

PS master:\> Get-Item master:/content/home | Invoke-ShellCommand "item:duplicate"

EXAMPLE 3

Show properties of the /sitecore/content/home item.

PS master:\> Get-Item master:/content/home | Invoke-ShellCommand "contenteditor:properties"

Invoke-ShellCommand 237
Sitecore PowerShell Extensions

Related Topics
https://github.com/SitecorePowerShell/Console/

Invoke-ShellCommand 238
Sitecore PowerShell Extensions

Invoke-Workflow
Executes Workflow action for an item. This command used to be named Execute-Workflow - a matching alias added for
compatibility with older scripts.

Syntax
Invoke-Workflow [-Language ] [-Path] [-CommandName ] [-Comments ]

Invoke-Workflow [-Language ] -Id [-Database ] [-CommandName ] [-Comments ]

Invoke-Workflow [-Language ] [-Item] [-CommandName ] [-Comments ]

Detailed Description
Executes Workflow action for an item. If the workflow action could not be performed for any reason - an appropriate error
will be raised.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions##
Aliases

The following abbreviations are aliases for this cmdlet:

Execute-Workflow

Parameters

-CommandName <String>

Namer of the workflow command.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Comments <String>

Comment to be saved in the history table for the action.

Aliases

Required? false

Position? named

Default Value

Invoke-Workflow 239
Sitecore PowerShell Extensions

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Language <String[]>

Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard
supported.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

The item to have the workflow action executed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to have the workflow action executed - additionally specify Language parameter to fetch different item
language than the current user language.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the the item to have the workflow action executed - additionally specify Language parameter to fetch different item
language than the current user language.

Aliases

Invoke-Workflow 240
Sitecore PowerShell Extensions

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to have the workflow action executed - can work with Language parameter to narrow the
publication scope.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Submit item to approval, item gotten from path

PS master:\> Invoke-Workflow -Path master:/content/home -CommandName "Submit" -Comments "Automated"

EXAMPLE 2

Reject item, item gotten from pipeline

PS master:\> Get-Item master:/content/home | Invoke-Workflow -CommandName "Reject" -Comments "Automated"

Invoke-Workflow 241
Sitecore PowerShell Extensions

Related Topics
https://github.com/SitecorePowerShell/Console/

Invoke-Workflow 242
Sitecore PowerShell Extensions

Lock-Item
Locks the Sitecore item by the current or specified user.

Syntax
Lock-Item [-Item] [-Force] [-PassThru] [-Identity ]

Lock-Item [-Path] [-Force] [-PassThru] [-Identity ]

Lock-Item -Id [-Database ] [-Force] [-PassThru] [-Identity ]

Detailed Description
The Lock-Item command unlocks the item.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Force <SwitchParameter>

Forces the item to be locked by the specified user even if it's currently locked by another user.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-PassThru <SwitchParameter>

Passes the processed object back into the pipeline.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Identity <AccountIdentity>

Lock-Item 243
Sitecore PowerShell Extensions

User name including domain for which the item is to be locked. If no domain is specified - 'sitecore' will be used as the
default domain.

Specifies the Sitecore user by providing one of the following values.

Local Name
Example: adam
Fully Qualified Name
Example: sitecore\adam

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

The item to be processed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be processed - can work with Language parameter to specify the language other than current session
language.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the item to be processed.

Aliases

Lock-Item 244
Sitecore PowerShell Extensions

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be fetched with Id parameter.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

can be piped from another cmdlet* Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Only if -PassThru is used* Sitecore.Data.Items.Item

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Lock the Home item providing its path

PS master:\> Lock-Item -Path master:\content\home

EXAMPLE 2

Lock the Home item by providing it from the pipeline and passing it back to the pipeline. The Item is locked by the

Lock-Item 245
Sitecore PowerShell Extensions

"sitecore\adam" user.

PS master:\> Get-Item -Path master:\content\home | Lock-Item -PassThru -Identity sitecore\adam

Name Children Languages Id TemplateName


---- -------- --------- -- ------------
Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item

Related Topics
https://github.com/SitecorePowerShell/Console/
Unlock-Item
Get-Item

Lock-Item 246
Sitecore PowerShell Extensions

Login-User
Logs a user in and performs further script instructions in the context of the user.

Syntax
Login-User [-Identity] [-Password]

Detailed Description
Logs a user in and performs further script instructions in the context of the user.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <GenericIdentity>

User name including domain. If no domain is specified - 'sitecore' will be used as the default value

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Password <String>

Password for the account provided using the -Identity parameter.

Aliases

Required? true

Position? 2

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Notes
Help Author: Adam Najmanowicz, Michael West

Login-User 247
Sitecore PowerShell Extensions

Examples

EXAMPLE

PS master:\> Login-User -Identity "sitecore\admin" -Password "b"

Related Topics
https://github.com/SitecorePowerShell/Console/

Login-User 248
Sitecore PowerShell Extensions

Logout-User
Logs the current user out.

Syntax

Detailed Description
Logs the current user out.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Logout-User

Related Topics
https://github.com/SitecorePowerShell/Console/

Logout-User 249
Sitecore PowerShell Extensions

New-Domain
Creates a new domain with the specified name.

Syntax
New-Domain [-Name] [-LocallyManaged]

Detailed Description
The New-Domain command creates a domain if it does not exist.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Name <String>

The name of the domain.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-LocallyManaged <SwitchParameter>

TODO: Provide description for this parameter

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

System.String Represents the name of a domain.

New-Domain 250
Sitecore PowerShell Extensions

Outputs
The output type is the type of the objects that the cmdlet emits.

None.

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> New-Domain -Name "domainName"

Related Topics
https://github.com/SitecorePowerShell/Console/
Get-Domain
Remove-Domain

New-Domain 251
Sitecore PowerShell Extensions

New-ExplicitFileSource
Creates new File source that can be added to a Sitecore package.

Syntax
New-ExplicitFileSource [-Name] [-File ] [-InstallMode ]

Detailed Description
Creates new File source that can be added to a Sitecore package. Folder provided as Root will be added as well as all of
its content provided it matches the filters.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Name <String>

Name of the file source.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-File <FileSystemInfo>

Path to the file to be included. this can be automatically discovered if a stream of files is piped to the command.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-InstallMode <String>

Aliases

Required? false

New-ExplicitFileSource 252
Sitecore PowerShell Extensions

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Install.Files.ExplicitFileSource

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

Following example creates a new package, adds content of the Console folder (except the source files) under the site
folder saves it in the Sitecore Package folder + gives you an option to download the saved package.

# Create package
$package = new-package "Sitecore PowerShell Extensions";

# Set package metadata


$package.Sources.Clear();

$package.Metadata.Author = "Adam Najmanowicz - Cognifide, Michael West";


$package.Metadata.Publisher = "Cognifide Limited";
$package.Metadata.Version = "2.7";
$package.Metadata.Readme = 'This text will be visible to people installing your package'

# Add content of the Console folder (except the source files) located in the site folder to the package
$source = Get-ChildItem -exclude *.cs -Path "$AppPath\Console" -Recurse -File | New-ExplicitFileSource -Name "Console Assets"
$package.Sources.Add($source);

# Save package
Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip

# Offer the user to download the package


Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip"

Related Topics
Export-Package
Get-Package
Import-Package
Install-UpdatePackage
New-ExplicitItemSource
New-FileSource
New-ItemSource

New-ExplicitFileSource 253
Sitecore PowerShell Extensions

New-Package
https://github.com/SitecorePowerShell/Console/
http://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/
https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae
https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=7

New-ExplicitFileSource 254
Sitecore PowerShell Extensions

New-ExplicitItemSource
Creates new Explicit Item Source that can be added to a Sitecore package.

Syntax
New-ExplicitItemSource [-Item ] [-Name] [[-SkipVersions]] [-InstallMode ] [-MergeMode ]

Detailed Description
Creates new Item source that can be added to a Sitecore package. This source only includes items explicitly added to it
and not their children.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Item <Item>

The item to be added to the source. If used in pipeline after e.g. Get-Item the source is created once all items are piped into
it.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Name <String>

Name of the item source.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-SkipVersions <SwitchParameter>

Add this parameter if you want to skip versions of the item from being included in the source and only include the version
provided.

New-ExplicitItemSource 255
Sitecore PowerShell Extensions

Aliases

Required? false

Position? 2

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-InstallMode <InstallMode>

Specifies what installer should do if the item already exists. Possible values:

- Undefined - User will have to choose one of the below. But they probably don't really know what should be done so not a preferable
- Overwrite - All versions of the old item are removed and replaced with all versions of the new item. This option basically replace
- Merge - merge with existing item. How the item will be merged is defined with MergeMode parameter

Skip - All versions remains unchanged. Other languages remains unchanged. All children remains unchanged.

- SideBySide - all new item will be created.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-MergeMode <MergeMode>

Specifies what installer should do if the item already exists and InstallMode is specified as Merge. Possible values:

- Undefined - User will have to choose one of the below. But they probably don't really know what should be done so not a preferable
- Clear - All versions of the old item are removed and replaced with all versions of the new item. This option basically replaces th
- Append - All versions of the new item are added on top of versions of the previous item. This option allows for further manual mer
- Merge - All versions with the same number in both packages are replaced with versions from installed package. All versions which a

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

New-ExplicitItemSource 256
Sitecore PowerShell Extensions

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Install.Items.ExplicitItemSource

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

Following example creates a new package, adds content/home item and all of its children to it and saves it in the Sitecore
Package folder + gives you an option to download the saved package.

# Create package
$package = new-package "Sitecore PowerShell Extensions";

# Set package metadata


$package.Sources.Clear();

$package.Metadata.Author = "Adam Najmanowicz - Cognifide, Michael West";


$package.Metadata.Publisher = "Cognifide Limited";
$package.Metadata.Version = "2.7";
$package.Metadata.Readme = 'This text will be visible to people installing your package'

# Add content/home and all of its children to the package


$source = Get-Item 'master:\content\home' | New-ExplicitItemSource -Name 'Home Page' -InstallMode Overwrite
$package.Sources.Add($source);

# Save package
Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip

# Offer the user to download the package


Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip"

Related Topics
Export-Package
Get-Package
Import-Package
Install-UpdatePackage
New-ExplicitFileSource
New-FileSource
New-ItemSource
New-Package

New-ExplicitItemSource 257
Sitecore PowerShell Extensions

https://github.com/SitecorePowerShell/Console/
http://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/
https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae
https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=7

New-ExplicitItemSource 258
Sitecore PowerShell Extensions

New-FileSource
Creates new File source that can be added to a Sitecore package.

Syntax
New-FileSource [-Name] [-Root] [[-IncludeFilter] ] [[-ExcludeFilter] ] [-InstallMode ]

Detailed Description
Creates new File source that can be added to a Sitecore package. Folder provided as Root will be added as well as all of
its content provided it matches the filters.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Name <String>

Name of the file source.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Root <DirectoryInfo>

Root folder to include in the package

Aliases

Required? true

Position? 2

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-IncludeFilter <String>

Filter that defines which files will be included.

Aliases

New-FileSource 259
Sitecore PowerShell Extensions

Required? false

Position? 3

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-ExcludeFilter <String>

Filter that defines which files will NOT be included.

Aliases

Required? false

Position? 4

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-InstallMode <String>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Install.Files.FileSource

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

Following example creates a new package, adds content of the Console folder under the site folder saves it in the Sitecore
Package folder + gives you an option to download the saved package.

New-FileSource 260
Sitecore PowerShell Extensions

# Create package
$package = new-package "Sitecore PowerShell Extensions";

# Set package metadata


$package.Sources.Clear();

$package.Metadata.Author = "Adam Najmanowicz - Cognifide, Michael West";


$package.Metadata.Publisher = "Cognifide Limited";
$package.Metadata.Version = "2.7";
$package.Metadata.Readme = 'This text will be visible to people installing your package'

# Add content of the Console folder in the site folder to the package
$source = New-FileSource -Name "Console Assets" -Root "$AppPath\Console"
$package.Sources.Add($source);

# Save package
Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip

# Offer the user to download the package


Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip"

Related Topics
Export-Package
Get-Package
Import-Package
Install-UpdatePackage
New-ExplicitFileSource
New-ExplicitItemSource
New-ItemSource
New-Package
https://github.com/SitecorePowerShell/Console/
http://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/
https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae
https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=7

New-FileSource 261
Sitecore PowerShell Extensions

New-ItemAcl
Creates a new access rule for use with Set-ItemAcl and Add-ItemAcl cmdlets.

Syntax
New-ItemAcl [-Identity] [-AccessRight] [-PropagationType] [-SecurityPermission]

Detailed Description
Creates a new access rule for use with Set-ItemAcl and Add-ItemAcl cmdlets.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

User name including domain for which the access rule is being created. If no domain is specified - 'sitecore' will be used as
the default domain.

Specifies the Sitecore user by providing one of the following values.

Local Name
Example: adam
Fully Qualified Name
Example: sitecore\adam

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-AccessRight <String>

The access right to grand or deny. Well known rights are:

field:read - "Field Read" - controls whether an account can read a specific field on an item..
field:write - "Field Write" - controls whether an account can update a specific field on an item.

item:read - "Read" - controls whether an account can see an item in the content tree and/or on the published Web site,
including all of its properties and field values.

item:write - "Write" - controls whether an account can update field values. The write access right requires the read
access right and field read and field write access rights for individual fields (field read and field write are allowed by

New-ItemAcl 262
Sitecore PowerShell Extensions

default).
item:rename - "Rename" - controls whether an account can change the name of an item. The rename access right
requires the read access right.
item:create - "Create" - controls whether an account can create child items. The create access right requires the read
access right.
item:delete - "Delete" - Delete right for items. controls whether an account can delete an item. The delete access right
requires the read access right Important! The Delete command also deletes all child items, even if the account has
been denied Delete rights for one or more of the subitems.
item:admin - "Administer" - controls whether an account can configure access rights on an item. The administer access
right requires the read and write access rights.
language:read - "Language Read" - controls whether a user can read a specific language version of items.
language:write - "Language Write" - controls whether a user can update a specific language version of items.
site:enter - controls whether a user can access a specific site.
insert:show - "Show in Insert" - Determines if the user can see the insert option
workflowState:delete - "Workflow State Delete" - controls whether a user can delete items which are currently
associated with a specific workflow state.
workflowState:write - "Workflow State Write" - controls whether a user can update items which are currently associated
with a specific workflow state.
workflowCommand:execute - "Workflow Command Execute" - controls whether a user is shown specific workflow
commands.
profile:customize - "Customize Profile Key Values" - The right to input out of range values of profile keys, that belong to
this profile.
bucket:makebucket - "Create Bucket" - convert item to bucket.
bucket:unmake - "Revert Bucket" - convert item back from bucket.
remote:fieldread - "Field Remote Read" - Field Read right for remoted clients.

Aliases

Required? true

Position? 2

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-PropagationType <PropagationType>

The PropagationType enumeration determines which items will be granted the access right.

Any - the item and all items inheriting


Descendants - applies rights to inheriting children only
Entity - applies right to the item only

Aliases

Required? true

Position? 3

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

New-ItemAcl 263
Sitecore PowerShell Extensions

-SecurityPermission <SecurityPermission>

The SecurityPermission determines whether to grant (allow) or deny the access right, and deny or allow inheritance of the
right.

- AllowAccess -
- DenyAccess -
- AllowInheritance -
- DenyInheritance -

Aliases

Required? true

Position? 4

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Security.AccessControl.AccessRule

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Creates an access rule that allows the "sitecore\adam" user to delete the item to which it will be applied and all of its childre

PS master:\> New-ItemAcl -AccessRight item:delete -PropagationType Any -SecurityPermission AllowAccess -Identity "sitecore\adam"

Account AccessRight PermissionType PropagationType SecurityPermission


------- ----------- -------------- --------------- ------------------
sitecore\admin item:delete Access Any AllowAccess

EXAMPLE 2

Allows the "sitecore\adam" user to delete the Home item and all of its children. Denies the "sitecore\mikey" user reading the
descendants of the Home item. ;P The security info is created prior to adding it to the item. The item is delivered to the
Add-ItemAcl from the pipeline and returned to the pipeline after processing due to the -PassThru parameter. The security
information is added to the previously existing security qualifiers.

New-ItemAcl 264
Sitecore PowerShell Extensions

$acl1 = New-ItemAcl -AccessRight item:delete -PropagationType Any -SecurityPermission AllowAccess -Identity "sitecore\adam"
$acl2 = New-ItemAcl -AccessRight item:read -PropagationType Descendants -SecurityPermission DenyAccess -Identity "sitecore\mikey"
Get-Item -Path master:\content\home | Add-ItemAcl -AccessRules $acl1, $acl2 -PassThru

Name Children Languages Id TemplateName


---- -------- --------- -- ------------
Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item

EXAMPLE 3

Allows the "sitecore\adam" user to delete the Home item and all of its children. Denies the "sitecore\mikey" user reading the
descendants of the Home item. ;P The security info is created prior to setting it to the item. The item is delivered to the Set-
ItemAcl from the pipeline and returned to the pipeline after processing due to the -PassThru parameter. Any previuous
security information on the item is removed.

$acl1 = New-ItemAcl -AccessRight item:delete -PropagationType Any -SecurityPermission AllowAccess -Identity "sitecore\adam"
$acl2 = New-ItemAcl -AccessRight item:read -PropagationType Descendants -SecurityPermission DenyAccess -Identity "sitecore\mikey"
Get-Item -Path master:\content\home | Set-ItemAcl -AccessRules $acl1, $acl2 -PassThru

Name Children Languages Id TemplateName


---- -------- --------- -- ------------
Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item

Related Topics
https://github.com/SitecorePowerShell/Console/
Add-ItemAcl
Clear-ItemAcl
Get-ItemAcl
Set-ItemAcl
Test-ItemAcl
https://sdn.sitecore.net/upload/sitecore6/security_administrators_cookbook_a4.pdf
https://sdn.sitecore.net/upload/sitecore6/61/security_reference-a4.pdf
https://sdn.sitecore.net/upload/sitecore6/64/content_api_cookbook_sc64_and_later-a4.pdf
http://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2013/01/sitecore-security-access-
rights.aspx
https://briancaos.wordpress.com/2009/10/02/assigning-security-to-items-in-sitecore-6-programatically/

New-ItemAcl 265
Sitecore PowerShell Extensions

New-ItemClone
Creates a new item clone based on the item provided.

Syntax
New-ItemClone [-Item] -Destination [-Name ] [-Recursive]

New-ItemClone [-Path] -Destination [-Name ] [-Recursive]

New-ItemClone -Id [-Database ] -Destination [-Name ] [-Recursive]

Detailed Description
Creates a new item clone based on the item provided.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Destination <Item>

Parent item under which the clone should be created.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Name <String>

Name of the item clone.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Recursive <SwitchParameter>

New-ItemClone 266
Sitecore PowerShell Extensions

Add the parameter to clone thw whole branch rather than a single item.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

The item to be cloned.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be cloned.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the item to be cloned

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

New-ItemClone 267
Sitecore PowerShell Extensions

Database of the item to be cloned if item is specified through its ID.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Data.Items.Item

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

Clone /sitecore/content/home/ under /sitecore/content/new-target/ with the "New Home" name.

PS master:\> $newTarget = Get-Item master:\content\new-target\


PS master:\> New-ItemClone -Path master:\content\home -Destination $newTarget -Name "New Home"

Related Topics
Get-ItemClone
ConvertFrom-ItemClone
New-Item
https://github.com/SitecorePowerShell/Console/
https://github.com/SitecorePowerShell/Console/issues/218

New-ItemClone 268
Sitecore PowerShell Extensions

New-ItemSource
Creates new Item source that can be added to a Sitecore package.

Syntax
New-ItemSource [-Item ] [-Name] [[-SkipVersions]] [[-Database] ] [[-Root] ] [-InstallMode ] [-MergeMode ]

Detailed Description
Creates new Item source that can be added to a Sitecore package. Item provided to it is added as well as its subitems.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Item <Item>

The item to be added as the root of the source.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Name <String>

Name of the item source.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-SkipVersions <SwitchParameter>

Add this parameter if you want to skip versions of the item from being included in the source and only include the version
provided.

Aliases

New-ItemSource 269
Sitecore PowerShell Extensions

Required? false

Position? 2

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be added - can work with Language parameter to narrow the publication scope.

Aliases

Required? false

Position? 3

Default Value

Accept Pipeline Input? true (ByPropertyName)

Accept Wildcard Characters? false

-Root <String>

You can provide the Root as sitecore native path instead of specifying it through. Do not include Item in such case as Item
will take priority over Root.

Aliases

Required? false

Position? 4

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-InstallMode <InstallMode>

Specifies what installer should do if the item already exists. Possible values:

- Undefined - User will have to choose one of the below. But they probably don't really know what should be done so not a preferable
- Overwrite - All versions of the old item are removed and replaced with all versions of the new item. This option basically replace
- Merge - merge with existing item. How the item will be merged is defined with MergeMode parameter

Skip - All versions remains unchanged. Other languages remains unchanged. All children remains unchanged.

- SideBySide - all new item will be created.

Aliases

Required? false

Position? named

New-ItemSource 270
Sitecore PowerShell Extensions

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-MergeMode <MergeMode>

Specifies what installer should do if the item already exists and InstallMode is specified as Merge. Possible values:

- Undefined - User will have to choose one of the below. But they probably don't really know what should be done so not a preferable
- Clear - All versions of the old item are removed and replaced with all versions of the new item. This option basically replaces th
- Append - All versions of the new item are added on top of versions of the previous item. This option allows for further manual mer
- Merge - All versions with the same number in both packages are replaced with versions from installed package. All versions which a

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Install.Items.ItemSource

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

Following example creates a new package, adds content/home item to it and saves it in the Sitecore Package folder+ gives
you an option to download the saved package.

# Create package

New-ItemSource 271
Sitecore PowerShell Extensions

$package = new-package "Sitecore PowerShell Extensions";

# Set package metadata


$package.Sources.Clear();

$package.Metadata.Author = "Adam Najmanowicz - Cognifide, Michael West";


$package.Metadata.Publisher = "Cognifide Limited";
$package.Metadata.Version = "2.7";
$package.Metadata.Readme = 'This text will be visible to people installing your package'

# Add contnet/home to the package


$source = Get-Item 'master:\content\home' | New-ItemSource -Name 'Home Page' -InstallMode Overwrite
$package.Sources.Add($source);

# Save package
Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip

# Offer the user to download the package


Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip"

Related Topics
Export-Package
Get-Package
Import-Package
Install-UpdatePackage
New-ExplicitFileSource
New-ExplicitItemSource
New-FileSource
New-Package
https://github.com/SitecorePowerShell/Console/
http://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/
https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae
https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=7

New-ItemSource 272
Sitecore PowerShell Extensions

New-ItemWorkflowEvent
Creates new entry in the history store notifying of workflow state change.

Syntax
New-ItemWorkflowEvent [-Language ] [-Path] [-OldState ] [-NewState ] [-Text ]

New-ItemWorkflowEvent [-Language ] -Id [-Database ] [-OldState ] [-NewState ] [-Text ]

New-ItemWorkflowEvent [-Language ] [-Item] [-OldState ] [-NewState ] [-Text ]

Detailed Description
Creates new entry in the history store notifying of workflow state change.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-OldState <String>

Id of the old state. If not provided - current item workflow state will be used.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-NewState <String>

Id of the old state. If not provided - current item workflow state will be used.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Text <String>

New-ItemWorkflowEvent 273
Sitecore PowerShell Extensions

Action comment.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Language <String[]>

Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard
supported.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

The item to have the history event attached.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to have the history event attached - additionally specify Language parameter to fetch different item
language than the current user language.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

New-ItemWorkflowEvent 274
Sitecore PowerShell Extensions

-Id <String>

Id of the the item to have the history event attached - additionally specify Language parameter to fetch different item
language than the current user language.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to have the history event attached - can work with Language parameter to narrow the
publication scope.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> New-ItemWorkflowEvent -Path master:\content\home -lanuage "en" -Text "Just leaving a note"

Related Topics
Get-ItemWorkflowEvent

New-ItemWorkflowEvent 275
Sitecore PowerShell Extensions

Execute-Workflow
https://github.com/SitecorePowerShell/Console/

New-ItemWorkflowEvent 276
Sitecore PowerShell Extensions

New-Package
Creates a new Sitecore install package object.

Syntax
New-Package [-Name]

Detailed Description
Creates a new Sitecore install package object that allows for further addition of items and files & further export to file.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Name <String>

Package name

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Install.PackageProject

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

Following example creates a new package, adds content/home item to it and saves it in the Sitecore Package folder+ gives
you an option to download the saved package.

New-Package 277
Sitecore PowerShell Extensions

# Create package
$package = new-package "Sitecore PowerShell Extensions";

# Set package metadata


$package.Sources.Clear();

$package.Metadata.Author = "Adam Najmanowicz - Cognifide, Michael West";


$package.Metadata.Publisher = "Cognifide Limited";
$package.Metadata.Version = "2.7";
$package.Metadata.Readme = 'This text will be visible to people installing your package'

# Add contnet/home to the package


$source = Get-Item 'master:\content\home' | New-ItemSource -Name 'Home Page' -InstallMode Overwrite
$package.Sources.Add($source);

# Save package
Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip

# Offer the user to download the package


Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip"

Related Topics
Export-Package
Get-Package
Import-Package
New-ExplicitFileSource
New-ExplicitItemSource
New-FileSource
New-ItemSource
Install-UpdatePackage
https://github.com/SitecorePowerShell/Console/
http://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/
https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae
https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=7

New-Package 278
Sitecore PowerShell Extensions

New-Rendering
Creates new rendering definition that can later be added to an item.

Syntax
New-Rendering [-Item] [-Parameter ] [-PlaceHolder ] [-DataSource ] [-Cacheable] [-VaryByData] [-VaryByDevice] [-
VaryByLogin] [-VaryByParameters] [-VaryByQueryString] [-VaryByUser]

New-Rendering [-Path] [-Parameter ] [-PlaceHolder ] [-DataSource ] [-Cacheable] [-VaryByData] [-VaryByDevice] [-


VaryByLogin] [-VaryByParameters] [-VaryByQueryString] [-VaryByUser]

New-Rendering -Id [-Database ] [-Parameter ] [-PlaceHolder ] [-DataSource ] [-Cacheable] [-VaryByData] [-VaryByDevice] [-


VaryByLogin] [-VaryByParameters] [-VaryByQueryString] [-VaryByUser]

Detailed Description
Creates new rendering definition that can later be added to an item. Most parameters can later be overriden when calling
Add-Rendering.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Parameter <Hashtable>

Rendering parameters as hashtable

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-PlaceHolder <String>

Placeholder for the rendering to be placed into.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

New-Rendering 279
Sitecore PowerShell Extensions

Accept Wildcard Characters? false

-DataSource <Item>

Datasource for the rendering.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Cacheable <SwitchParameter>

Defined whether the rendering is cacheable.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-VaryByData <SwitchParameter>

Defines whether a data-specific cache version of the rendering should be kept.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-VaryByDevice <SwitchParameter>

Defines whether a device-specific cache version of the rendering should be kept.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

New-Rendering 280
Sitecore PowerShell Extensions

Accept Wildcard Characters? false

-VaryByLogin <SwitchParameter>

Defines whether a login - specific cache version of the rendering should be kept.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-VaryByParameters <SwitchParameter>

Defines whether paremeter - specific cache version of the rendering should be kept.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-VaryByQueryString <SwitchParameter>

Defines whether query string - specific cache version of the rendering should be kept.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-VaryByUser <SwitchParameter>

Defines whether a user - specific cache version of the rendering should be kept.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

New-Rendering 281
Sitecore PowerShell Extensions

Accept Wildcard Characters? false

-Item <Item>

The item to be processed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? false

Position? named

Default Value

New-Rendering 282
Sitecore PowerShell Extensions

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Layouts.RenderingDefinitio

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

find item defining rendering and create rendering definitio

PS master:\> $renderingItem = gi master:\layout\Sublayouts\ZenGarden\Basic\Content | New-Rendering -Placeholder "main"


# find item you want the rendering added to
PS master:\> $item = gi master:\content\Demo\Int\Home
# Add the rendering to the item
PS master:\> Add-Rendering -Item $item -PlaceHolder "main" -Rendering $renderingItem -Parameter @{ FieldName = "Content"

Related Topics
https://github.com/SitecorePowerShell/Console/
Add-Rendering
Set-Rendering
Get-Rendering
Get-LayoutDevice
Remove-Rendering
Get-Layout
Set-Layout

New-Rendering 283
Sitecore PowerShell Extensions

New-Role
Creates a new Sitecore role.

Syntax
New-Role [-Identity] <AccountIdentity> [-PassThru]

Detailed Description
The New-Role command creates a new Sitecore role.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

Role name including domain. If no domain is specified - 'sitecore' will be used as the default value

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByPropertyName)

Accept Wildcard Characters? false

-PassThru <SwitchParameter>

Passes the processed object back into the pipeline.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

System.String

New-Role 284
Sitecore PowerShell Extensions

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Security.Accounts.Role

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> New-Role -Identity Michael

Related Topics
https://github.com/SitecorePowerShell/Console/

New-Role 285
Sitecore PowerShell Extensions

New-SecuritySource
Creates new User & Role source that can be added to a Sitecore package.

Syntax
New-SecuritySource [-Account] [-Name]

New-SecuritySource [-Identity] [[-AccountType] ] [-Name]

New-SecuritySource [-Filter] [[-AccountType] ] [-Name]

Detailed Description
Creates new User & Role source that can be added to a Sitecore package.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Account <Account>

User or Role provided from e.g. Get-Role or Get-User Cmdlet.

Aliases

Required? true

Position? 2

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Identity <AccountIdentity>

User or role name including domain for which the access rule is being created. If no domain is specified - 'sitecore' will be
used as the default domain.

Specifies the Sitecore user by providing one of the following values.

Local Name
Example: adam
Fully Qualified Name
Example: sitecore\adam

if -AccountType parameter is specified as Role - only roles will be taken into consideration. if -AccountType parameter is
specified as User - only users will be taken into consideration.

Aliases

New-SecuritySource 286
Sitecore PowerShell Extensions

Required? true

Position? 2

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Filter <String[]>

Specifies a simple pattern to match Sitecore roles & users.

Examples: The following examples show how to use the filter syntax.

To get security for all roles, use the asterisk wildcard: Get-ItemAcl -Filter *

To security got all roles in a domain use the following command: Get-ItemAcl -Filter "sitecore*"

if -AccountType parameter is specified as Role - only roles will be taken into consideration. if -AccountType parameter is
specified as User - only users will be taken into consideration.

Aliases

Required? true

Position? 2

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-AccountType <AccountType>

Unknown - Both Roles and users will be taken into consideration when looking for accounts through either -Identity or -
Filter parameters
Role - Only Roles will be taken into consideration when looking for accounts through either -Identity or -Filter
parameters
User - Only Users will be taken into consideration when looking for accounts through either -Identity or -Filter
parameters

Aliases

Required? false

Position? 3

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Name <String>

Name of the security source.

New-SecuritySource 287
Sitecore PowerShell Extensions

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Security.Accounts.Account

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Install.Security.SecuritySource

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Following example creates a new package, adds sitecore\admin user to it and saves it in the Sitecore Package folder+
gives you an option to download the saved package.

# Create package
$package = new-package "Sitecore PowerShell Extensions";

# Set package metadata


$package.Sources.Clear();

$package.Metadata.Author = "Adam Najmanowicz - Cognifide, Michael West";


$package.Metadata.Publisher = "Cognifide Limited";
$package.Metadata.Version = "2.7";
$package.Metadata.Readme = 'This text will be visible to people installing your package'

# Create security source with Sitecore Administrator only


$source = New-SecuritySource -Identity sitecore\admin -Name "Sitecore Admin"
$package.Sources.Add($source);

# Save package
Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip

# Offer the user to download the package


Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip"

EXAMPLE 2
New-SecuritySource 288
Sitecore PowerShell Extensions

Following example creates a new package, adds all roles within the "sitecore" domain to it and saves it in the Sitecore
Package folder+ gives you an option to download the saved package.

# Create package
$package = new-package "Sitecore PowerShell Extensions";

# Set package metadata


$package.Sources.Clear();

$package.Metadata.Author = "Adam Najmanowicz - Cognifide, Michael West";


$package.Metadata.Publisher = "Cognifide Limited";
$package.Metadata.Version = "2.7";
$package.Metadata.Readme = 'This text will be visible to people installing your package'

# Create security source with all roles within the sitecore domain
$source = New-SecuritySource -Filter sitecore\* -Name "Sitecore Roles" -AccountType Role
$package.Sources.Add($source);

# Save package
Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip

# Offer the user to download the package


Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip"

Related Topics
https://github.com/SitecorePowerShell/Console/

New-SecuritySource 289
Sitecore PowerShell Extensions

New-User
Creates a new Sitecore user.

Syntax
New-User [-Identity] [-Password ] [-Email ] [-FullName ] [-Comment ] [-Portrait ] [-Enabled] [-PassThru]

Detailed Description
The New-User command creates a new user in Sitecore.

The Identity parameter specifies the Sitecore user to create. You can specify a user by its local name or fully qualified
name.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

Specifies the Sitecore user by providing one of the following values.

Local Name
Example: developer
Fully Qualified Name
Example: sitecore\developer

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByPropertyName)

Accept Wildcard Characters? false

-Password <String>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? true (ByPropertyName)

Accept Wildcard Characters? false

New-User 290
Sitecore PowerShell Extensions

-Email <String>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? true (ByPropertyName)

Accept Wildcard Characters? false

-FullName <String>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? true (ByPropertyName)

Accept Wildcard Characters? false

-Comment <String>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? true (ByPropertyName)

Accept Wildcard Characters? false

-Portrait <String>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? true (ByPropertyName)

Accept Wildcard Characters? false

-Enabled <SwitchParameter>

Specifies that the account should be enabled. When enabled, the Password parameter is required.

Aliases

Required? false

New-User 291
Sitecore PowerShell Extensions

Position? named

Default Value

Accept Pipeline Input? true (ByPropertyName)

Accept Wildcard Characters? false

-PassThru <SwitchParameter>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

System.String Represents the identity of a role.

Outputs
The output type is the type of the objects that the cmdlet emits.

None.

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\> New-User -Identity michael

EXAMPLE 2

PS master:\> New-User -Identity michael -Enabled -Password b -Email michaellwest@gmail.com -FullName "Michael West"

EXAMPLE 3

New-User 292
Sitecore PowerShell Extensions

PS master:\> New-User -Identity michael -PassThru

Name Domain IsAdministrator IsAuthenticated


---- ------ --------------- ---------------
sitecore\michael2 sitecore False False

Related Topics
https://github.com/SitecorePowerShell/Console/
Get-User
Set-User
Remove-User
Unlock-User

New-User 293
Sitecore PowerShell Extensions

Protect-Item
Protects the Sitecore item.

Syntax
Protect-Item [-Item] [-PassThru]

Protect-Item [-Path] [-PassThru]

Protect-Item -Id [-Database ] [-PassThru]

Detailed Description
The Protect-Item command protects the item by making it read-only.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-PassThru <SwitchParameter>

Passes the processed item back into the pipeline.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

The item to be processed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Protect-Item 294
Sitecore PowerShell Extensions

Path to the item to be processed - can work with Language parameter to specify the language other than current session
language.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the item to be processed.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be fetched with Id parameter.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

can be piped from another cmdlet* Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Only if -PassThru is used* Sitecore.Data.Items.Item

Protect-Item 295
Sitecore PowerShell Extensions

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\> Protect-Item -Path master:\content\home

EXAMPLE 2

PS master:\> Get-Item -Path master:\content\home | Protect-Item -PassThru

Name Children Languages Id TemplateName


---- -------- --------- -- ------------
Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item

Related Topics
https://github.com/SitecorePowerShell/Console/
Unprotect-Item
Get-Item

Protect-Item 296
Sitecore PowerShell Extensions

Publish-Item
Publishes a Sitecore item.

Syntax
Publish-Item [-Language ] [-Path] [-Recurse] [-Target ] [-PublishMode ]

Publish-Item [-Language ] -Id [-Database ] [-Recurse] [-Target ] [-PublishMode ]

Publish-Item [-Language ] [-Item] [-Recurse] [-Target ] [-PublishMode ]

Detailed Description
The Publish-Item command publishes the Sitecore item and optionally subitems. Allowing for granular control over
languages and modes of publishing.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Recurse <SwitchParameter>

Specifies that subitems should also get published with the root item.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Target <String[]>

Specifies the publishing targets. The default target database is "web".

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-PublishMode <PublishMode>

Publish-Item 297
Sitecore PowerShell Extensions

Specified the Publish mode. Valid values are:

Full
Incremental
SingleItem
Smart

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Language <String[]>

Language of the item that should be published. Supports globbing/wildcards. Allows for more than one language to be
provided at once. e.g. "en*", "pl-pl"

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item that should be published - can work with Language parameter to narrow the publication scope.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Publish-Item 298
Sitecore PowerShell Extensions

Accept Wildcard Characters? false

-Id <String>

Id of the item that should be published - can work with Language parameter to narrow the publication scope.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

None.

Notes
Help Author: Michael West, Adam Najmanowicz

Examples

EXAMPLE 1

PS master:\> Publish-Item -Path master:\content\home -Target Internet

Publish-Item 299
Sitecore PowerShell Extensions

EXAMPLE 2

PS master:\> Get-Item -Path master:\content\home | Publish-Item -Recurse -PublishMode Incremental

EXAMPLE 3

PS master:\> Get-Item -Path master:\content\home | Publish-Item -Recurse -Language "en*"

Related Topics
https://github.com/SitecorePowerShell/Console/

Publish-Item 300
Sitecore PowerShell Extensions

Read-Variable
Prompts user to provide values for variables required by the script to perform its operation.

Syntax
Read-Variable [-Parameters ] [-Description ] [-CancelButtonName ] [-OkButtonName ] [-ShowHints] [-Title ] [-Width ] [-
Height ]

Detailed Description
Prompts user to provide values for variables required by the script to perform its operation. If user selects the "OK" button
the command will return 'ok' as its value. If user selects the "Cancel" button or closes the window with the "x" button at the
top-right corner of the dialog the command will return 'cancel' as its value.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Parameters <Object[]>

Specifies the variables that value should be provided by the user. Each variable definition can have the following structure:

Name - the name of the PowerShell variable - without the $ sign


Value - the initial value of the variable - if the variable have not been created prior to launching the dialog - this will be
its value unless the user changes it. if Value is not specified - the existing variable name will be used.
Title - The title for the variable shown above the variable editor.
Tooltip - The hint describing the parameter further - if the -ShowHints parameter is provided this value will show
between the Variable Title and the variable editor.
Editor - If the default editor selected does not provide the functionality expected - you can specify this value to
customize it (see examples)
Tab - if this parameter is specified on any Variable the multi-tab dialog will be used instead of a simple one. Provide the
tab name on which the variable editor should appear.

Variable type specific:

Root - for some Item selecting editors you can provide this to limit the selection to only part of the tree
Source - for some Item selecting editors you can provide this to parametrize the item selection editor. (Refer to
examples for some sample usages)
Lines - for String variable you can select this parameter if you want to present the user with the multiline editor. The for
this parameter is the number of lines that the editor will be configured with.
Domain - for user and role selectors you can limit the users & roles presented to only the domain - specified)

Aliases

Required? false

Position? named

Default Value

Read-Variable 301
Sitecore PowerShell Extensions

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Description <String>

Dialog description displayed below the dialog title.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-CancelButtonName <String>

Text shown on the cancel button.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-OkButtonName <String>

Text shown on the OK button.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-ShowHints <SwitchParameter>

Specifies whether the variable hints should be displayed. Hints are shown below each the variable title but above the
variable editing control.

Aliases

Required? false

Position? named

Read-Variable 302
Sitecore PowerShell Extensions

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Title <String>

Dialog title - shown at the top of the dialog.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Width <Int32>

Dialog width.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Height <Int32>

Dialog width.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
Read-Variable 303
Sitecore PowerShell Extensions

The output type is the type of the objects that the cmdlet emits.

System.String

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

For a good understanding of all the Property types the Read-Variable command accepts open the script located in the
following item: /Examples/User Interaction/Read-Variable - Sample the script is located in the Script Library in the Master
database.

EXAMPLE 2

Following is an example of a simple dialog asking user for various variable types.

The type of some of the controls displayed to the user are iferred from the variable type (like the $item variable or
DateTime) The editors for some other are set by providing the "editor" value

$item = Get-Item master:\content\home


$result = Read-Variable -Parameters `
@{ Name = "someText"; Value="Some Text"; Title="Single Line Text"; Tooltip="Tooltip for singleline"},
@{ Name = "multiText"; Value="Multiline Text"; Title="Multi Line Text"; lines=3; Tooltip="Tooltip for multiline"},
@{ Name = "from"; Value=[System.DateTime]::Now.AddDays(-5); Title="Start Date"; Tooltip="Date since when you want the report to run
@{ Name = "user"; Value=$me; Title="Select User"; Tooltip="Tooltip for user"; Editor="user multiple"},
@{ Name = "item"; Title="Start Item"; Root="/sitecore/content/"} `
-Description "This Dialog shows less editors, it doesn't need tabs as there is less of the edited variables" `
-Title "Initialise various variable types (without tabs)" -Width 500 -Height 480 -OkButtonName "Proceed" -CancelButtonName

EXAMPLE 3

Following is an example of a multi tabbed dialog asking user for various variable types.

The type of some of the controls displayed to the user are iferred from the variable type (like the $item variable or
DateTime) The editors for some other are set by providing the "editor" value

$item = Get-Item master:\content\home


$result = Read-Variable -Parameters `
@{ Name = "silent"; Value=$true; Title="Proceed Silently"; Tooltip="Check this if you don't want to be interrupted"
@{ Name = "someText"; Value="Some Text"; Title="Text"; Tooltip="Just a single line of Text"; Tab="Simple"},
@{ Name = "multiText"; Value="Multiline Text"; Title="Longer Text"; lines=3; Tooltip="You can put multi line text here"
@{ Name = "number"; Value=110; Title="Integer"; Tooltip="I need this number too"; Tab="Simple"},
@{ Name = "fraction"; Value=1.1; Title="Float"; Tooltip="I'm just a bit over 1"; Tab="Simple"},
@{ Name = "from"; Value=[System.DateTime]::Now.AddDays(-5); Title="Start Date"; Tooltip="Date since when you want the report to run

Read-Variable 304
Sitecore PowerShell Extensions

@{ Name = "fromDate"; Value=[System.DateTime]::Now.AddDays(-5); Title="Start Date"; Tooltip="Date since when you want the report to
@{ Name = "item"; Title="Start Item"; Root="/sitecore/content/"; Tab="Items"},
@{ Name = "items"; Title="Bunch of Templates";
Source="DataSource=/sitecore/templates&DatabaseName=master&IncludeTemplatesForDisplay=Node,Folder,Template,Template Folder&Incl
editor="treelist"; Tab="Items"},
@{ Name = "items2"; Title="Bunch of Templates";
Source="DataSource=/sitecore/templates&DatabaseName=master&IncludeTemplatesForDisplay=Node,Folder,Template,Template Folder&Incl
editor="multilist"; Tab="More Items"},
@{ Name = "items3"; Title="Pick One Template";
Source="DataSource=/sitecore/templates&DatabaseName=master&IncludeTemplatesForDisplay=Node,Folder,Template,Template Folder&Incl
editor="droplist"; Tab="More Items"},
@{ Name = "user"; Value=$me; Title="Select User"; Tooltip="Tooltip for user"; Editor="user multiple"; Tab="Rights"},
@{ Name = "role"; Title="Select Role"; Tooltip="Tooltip for role"; Editor="role multiple"; Domain="sitecore"; Tab="Rights"
@{ Name = "userOrRole"; Title="Select User or Role"; Tooltip="Tooltip for role"; Editor="user role multiple"; Domain=
-Description "This Dialog shows all available editors in some configurations, the properties are groupped into tabs"
-Title "Initialise various variable types (with tabs)" -Width 600 -Height 640 -OkButtonName "Proceed" -CancelButtonName
if($result -ne "ok")
{
Exit
}

Related Topics
Show-Alert
Show-Application
Show-Confirm
Show-FieldEditor
Show-Input
Show-ListView
Show-ModalDialog
Show-YesNoCancel
https://github.com/SitecorePowerShell/Console/

Read-Variable 305
Sitecore PowerShell Extensions

Receive-File
Shows a dialog to users allowing to upload files to either server file system or items in media library.

Syntax
Receive-File [-Description ] [-ParentItem] [-Title ] [-CancelButtonName ] [-OkButtonName ] [-Versioned] [-Language ] [-
Overwrite] [-Unpack] [-Width ] [-Height ]

Receive-File [-Description ] [-Path] [-Title ] [-CancelButtonName ] [-OkButtonName ] [-Overwrite] [-Unpack] [-Width ] [-


Height ]

Receive-File [-ParentItem] -AdvancedDialog [-Width ] [-Height ]

Detailed Description
Executing this command with file path on the server (provided as -Path parameter) provides script users with means to
upload a file from their computer. Executing it for an Item located in Sitecore Media library (provided as -ParentItem) allows
the user to upload the file as a child to that item. If the file has been uploaded the dialog returns path to the file (in case of
file system storage) or Item that has been created if the file was uplaoded to media library.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Description <String>

Dialog description displayed below the dialog title.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-ParentItem <Item>

The item under which the uploaded media items should be stored.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Receive-File 306
Sitecore PowerShell Extensions

Accept Wildcard Characters? false

-Path <String>

Path to the folder where uploaded file should be stored.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Title <String>

Dialog title - shown at the top of the dialog.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-CancelButtonName <String>

Text shown on the cancel button.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-OkButtonName <String>

Text shown on the OK button.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Receive-File 307
Sitecore PowerShell Extensions

Accept Wildcard Characters? false

-Versioned <SwitchParameter>

Indicates that the Media item should be created as a Versioned media item.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Language <String>

Specifies the language in which the media item should be created. if not specified - context language is selected.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Overwrite <SwitchParameter>

indicates that the upload should overwrite a file or a media item if that one exists. Otherwise a file with a non-confilicting
name or a sibling media item is created.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Unpack <SwitchParameter>

Indicates that the uplaod is expected to be a ZIP file which should be unpacked when it's received.

Aliases

Required? false

Position? named

Default Value

Receive-File 308
Sitecore PowerShell Extensions

Accept Pipeline Input? false

Accept Wildcard Characters? false

-AdvancedDialog <SwitchParameter>

Shows advanced dialog where user can upload multiple media items and select if the uploaded items are versioned,
overwritten and unpacked.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Width <Int32>

Dialog width.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Height <Int32>

Dialog width.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item System.String

Outputs
Receive-File 309
Sitecore PowerShell Extensions

The output type is the type of the objects that the cmdlet emits.

Sitecore.Data.Items.Item System.String

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Upload text.txt file to server disk drive. A new file is created with a non-conflicting name and the path to it is returned

PS master:\> Receive-File -Folder "C:\temp\upload"


C:\temp\upload\text_029.txt

EXAMPLE 2

Upload text.txt file to media library under the 'master:\media library\Files' item A new media item is created and returned

PS master:\> Receive-File -ParentItem (get-item "master:\media library\Files")


Name Children Languages Id TemplateName
---- -------- --------- -- ------------
text False {en} {7B11CE12-C0FC-4650-916C-2FC76F3DCAAF} File

EXAMPLE 3

Upload text.txt file to media library under the 'master:\media library\Files' item using advanced dialog. A new media item is
created but "undetermined" is returned as the dialog does not return the results.

PS master:\> Receive-File (get-item "master:\media library\Files") -AdvancedDialog


undetermined

EXAMPLE 4

Upload text.txt file to media library under the 'master:\media library\Files' item. A new versioned media item in Danish
language is created and returned. If the media item existed - it will be overwritten.

PS master:\> Receive-File -ParentItem (get-item "master:\media library\Files") -Overwrite -Language "da" -Versioned
Name Children Languages Id TemplateName
---- -------- --------- -- ------------
text False {en, da} {307BCF7D-27FD-46FC-BE83-D9ED640CB09F} File

Related Topics
Receive-File 310
Sitecore PowerShell Extensions

https://github.com/SitecorePowerShell/Console/

Receive-File 311
Sitecore PowerShell Extensions

Receive-ScriptSession
Gets the results of a script session execution.

Syntax
Receive-ScriptSession -Id <String[]> [-KeepResult] [-KeepSession] [-HostOutput]

Receive-ScriptSession -Session <ScriptSession[]> [-KeepResult] [-KeepSession] [-HostOutput]

Detailed Description
The Receive-ScriptSession cmdlet gets the results of Windows PowerShell script sessions, such as those started by using
the Start-ScriptSession. You can get the results of all script sessions by their ID or by submitting a script session objects.
When you start a new script session, the session starts, but the results do not appear immediately. Instead, the command
returns an object that represents the script session. The script session object contains useful information about the script
session, but it does not contain the results. This method allows you to continue working in the current session while the
script session runs. For more information about script sessions in Windows PowerShell, see about_script sessions. The
Receive-ScriptSession cmdlet gets the results that have been generated by the time that the Receive-ScriptSession
command is submitted. If the session is not yet complete an error is raised. You can run additional Receive-ScriptSession
commands to get the execution results. By default, script session results and the session itself (unless it is a persistent
session) are deleted from the system when you receive them, but you can use the KeepResult and KeepSession
parameters to save the results so that you can receive them again. To delete the script session results, run the Receive-
ScriptSession command again (without the KeepResult parameter), close the session, or use the Remove-ScriptSession
cmdlet to delete the script session from the server.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-KeepResult <SwitchParameter>

Saves the script session results in the system, even after you have received them. By default, the script session results and
the session itself are deleted when they are retrieved. -KeepResult parameter has the -KeepSession parameter implied in
its usage.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-KeepSession <SwitchParameter>

Causes the receiving of the session results to not destroy the session after the cmdlet has executed.

Receive-ScriptSession 312
Sitecore PowerShell Extensions

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-HostOutput <SwitchParameter>

Add this parameter to receive the host output content. The result of the command execution will basically be what the
session would print if it was interactive.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String[]>

Gets the results of script session with the specified IDs. The ID is a string that uniquely identifies the script session within
the server. You can type one or more IDs (separated by commas). To find the ID of a script session, type "Get-
ScriptSession" without parameters.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Session <ScriptSession[]>

Specifies the script session for which results are being retrieved. Enter a variable that contains the script session or a
command that gets the script session. You can also pipe a script session object to Receive-ScriptSession.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

Receive-ScriptSession 313
Sitecore PowerShell Extensions

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

None or System.Object

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

The following will return the output from all available script sessions.

PS master:\> Get-ScriptSession | Receive-ScriptSession

Related Topics
https://git.io/spe

Receive-ScriptSession 314
Sitecore PowerShell Extensions

Remove-Domain
Removes the specified domain.

Syntax
Remove-Domain [-Name] [-Force]

Detailed Description
The Remove-Domain command removes the specified domain.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Name <String>

The name of the domain.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Force <SwitchParameter>

Indicates that the domain should be removed although it contains users in that domain.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

System.String Represents the name of a domain.

Remove-Domain 315
Sitecore PowerShell Extensions

Outputs
The output type is the type of the objects that the cmdlet emits.

None.

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Remove-Domain -Name "domainName"

Related Topics
https://github.com/SitecorePowerShell/Console/

Remove-Domain 316
Sitecore PowerShell Extensions

Remove-ItemLanguage
Removes Language from a single item or a branch of items

Syntax
Remove-ItemLanguage -Language [-ExcludeLanguage ] [-Path] [-Recurse]

Remove-ItemLanguage -Language [-ExcludeLanguage ] -Id [-Database ] [-Recurse]

Remove-ItemLanguage -Language [-ExcludeLanguage ] [-Item] [-Recurse]

Detailed Description
Removes Language version from a an Item either sent from pipeline or defined with Path or ID. A single language or a list
of languages can be defined using the Language parameter. Language parameter supports globbing so you can delete
whole language groups using wildcards.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Recurse <SwitchParameter>

Deleted language versions from the item and all of its children.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Language <String[]>

Language(s) that should be deleted form the provided item(s). A single language or a list of languages can be defined using
the parameter. Language parameter supports globbing so you can delete whole language groups using wildcards.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Remove-ItemLanguage 317
Sitecore PowerShell Extensions

-ExcludeLanguage <String[]>

Language(s) that should NOT be deleted form the provided item(s). A single language or a list of languages can be defined
using the parameter. Language parameter supports globbing so you can delete whole language groups using wildcards.

If Language parameter is not is not specified but ExcludeLanguage is provided, the default value of "*" is assumed for
Language parameter.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

The item to be processed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? true

Position? named

Default Value

Remove-ItemLanguage 318
Sitecore PowerShell Extensions

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Remove Polish and Spanish language from /sitecore/content/home item in the master database

PS master:\> Remove-ItemLanguage -Path master:\content\home -Language "pl-pl", "es-es"

EXAMPLE 2

Remove all english based languages defined in /sitecore/content/home item and all of its children in the master database

PS master:\> Remove-ItemLanguage -Path master:\content\home -Language "en-*" -Recurse

EXAMPLE 3

Remove all languages except those that are "en" based defined in /sitecore/content/home item and all of its children in the
master database

Remove-ItemLanguage 319
Sitecore PowerShell Extensions

PS master:\> Remove-ItemLanguage -Path master:\content\home -ExcludeLanguage "en*" -Recurse

Related Topics
https://github.com/SitecorePowerShell/Console/
Add-ItemLanguage
Remove-Item

Remove-ItemLanguage 320
Sitecore PowerShell Extensions

Remove-Rendering
Removes renderings from an item.

Syntax
Remove-Rendering -Item [-DataSource ] [-Rendering ] [-Index ] [-PlaceHolder ] [-Parameter ] [-Device ]

Remove-Rendering -Item -Instance [-Device ]

Remove-Rendering -Item -UniqueId [-Device ]

Remove-Rendering -Path [-DataSource ] [-Rendering ] [-Index ] [-PlaceHolder ] [-Parameter ] [-Device ]

Remove-Rendering -Path -Instance [-Device ]

Remove-Rendering -Path -UniqueId [-Device ]

Remove-Rendering [-Id ] [-Database ] [-DataSource ] [-Rendering ] [-Index ] [-PlaceHolder ] [-Parameter ] [-Device ]

Remove-Rendering [-Id ] [-Database ] -Instance [-Device ]

Remove-Rendering [-Id ] [-Database ] -UniqueId [-Device ]

Detailed Description
Removes renderings from an item based on a number of qualifying criteria. The search criteria are cumulatice and
narrowing the search in an "AND" manner.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Item <Item>

The item to be processed.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be processed - can work with Language parameter to narrow the publication scope.

Remove-Rendering 321
Sitecore PowerShell Extensions

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-DataSource <String>

Data source filter - supports wildcards.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Rendering <Item>

Item representing the sublayout/rendering. If matching the rendering will be removed.

Remove-Rendering 322
Sitecore PowerShell Extensions

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Index <Int32>

Index at which the rendering exists in the layout. The rendering at that index will be removed.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-PlaceHolder <String>

Place holder at which the rendering exists in the layout. Rendering at that placeholder will be removed.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Parameter <Hashtable>

Additional rendering parameter values. If both name and value match - the rendering will be removed. Values support
wildcards.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Instance <RenderingDefinition>

Remove-Rendering 323
Sitecore PowerShell Extensions

Specific instance of rendering that should be removed. The instance coule earlier be obtained through e.g. use of Get-
Rendering.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-UniqueId <String>

UniqueID of the rendering to be removed. The instance coule earlier be obtained through e.g. use of OD of rendering
retrieved with Get-Rendering.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Device <DeviceItem>

Device for which the rendering should be removed.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

System.Void

Remove-Rendering 324
Sitecore PowerShell Extensions

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

remove all renderings for "Default" device

PS master:\> Remove-Rendering -Path master:\content\home -Device (Get-LayoutDevice "Default")

EXAMPLE 2

remove all renderings from the "main" placeholder and all of its embedded placeholders.

PS master:\> Remove-Rendering -Path master:\content\home -PlaceHolder "main*"

EXAMPLE 3

remove all renderings from the "main" placeholder and all of its embedded placeholders, but only in the "Default" device

PS master:\> Remove-Rendering -Path master:\content\home -PlaceHolder "main*" -Device (Get-LayoutDevice "Default")

Related Topics
https://github.com/SitecorePowerShell/Console/
Add-Rendering
New-Rendering
Set-Rendering
Get-Rendering
Get-LayoutDevice
Get-Layout
Set-Layout

Remove-Rendering 325
Sitecore PowerShell Extensions

Remove-Role
Removes a Sitecore role.

Syntax
Remove-Role [-Identity] <AccountIdentity>

Remove-Role -Instance <Role>

Detailed Description
The Remove-Role command removes a Sitecore role.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

Role name including domain. If no domain is specified - 'sitecore' will be used as the default value

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Instance <Role>

Role instance like that returned by the Get-Role command.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Remove-Role 326
Sitecore PowerShell Extensions

Sitecore.Security.Accounts.Role

Outputs
The output type is the type of the objects that the cmdlet emits.

None

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Remove-Role -Identity Michael

Related Topics
https://github.com/SitecorePowerShell/Console/

Remove-Role 327
Sitecore PowerShell Extensions

Remove-RoleMember
Removes one or more Sitecore users from the specified role.

Syntax
Remove-RoleMember [-Identity] -Members

Detailed Description
The Remove-RoleMember command gets a role and removes members of the Sitecore role.

The Identity parameter specifies the Sitecore role to get. You can specify a role by its local name or fully qualified name.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

Specifies the Sitecore role by providing one of the following values.

Local Name
Example: developer
Fully Qualified Name
Example: sitecore\developer

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Members <AccountIdentity[]>

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Remove-RoleMember 328
Sitecore PowerShell Extensions

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

System.String Represents the identity of a role.

Outputs
The output type is the type of the objects that the cmdlet emits.

None.

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Remove-RoleMember -Identity developer -Members "michael","adam","mike"

Related Topics
https://github.com/SitecorePowerShell/Console/
Add-RoleMember
Get-RoleMember

Remove-RoleMember 329
Sitecore PowerShell Extensions

Remove-ScriptSession
Removes a persistent Script Session from memory.

Syntax
Remove-ScriptSession -Id

Remove-ScriptSession -Session

Detailed Description
Removes a persistent Script Session from memory.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Id <String[]>

Id of the PowerShell session to be removed from memory.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Session <ScriptSession[]>

Session to be removed.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Remove-ScriptSession 330
Sitecore PowerShell Extensions

Resident Script Session obtained through Get-ScriptSessio Id of a resident Script Sessio


Cognifide.PowerShell.Core.Host.ScriptSessio* System.String

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

The following removes the script session using the specified Id.

PS master:\> Remove-ScriptSession -Id "Long running script"

Related Topics
Get-ScriptSession
Receive-ScriptSession
Start-ScriptSession
Stop-ScriptSession
Wait-ScriptSession
https://git.io/spe
http://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/

Remove-ScriptSession 331
Sitecore PowerShell Extensions

Remove-Session
Removes one or more Sitecore user sessions.

Syntax
Remove-Session -InstanceId

Remove-Session [-Instance]

Detailed Description
The Remove-Session command removes user sessions in Sitecore.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-InstanceId <String[]>

Specifies the Sitecore SessionID.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Instance <Session>

Specifies the Sitecore user sessions.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Remove-Session 332
Sitecore PowerShell Extensions

Accepts a user session.* Sitecore.Web.Authentication.DomainAccessGuard.Sessio

Outputs
The output type is the type of the objects that the cmdlet emits.

None.

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\> Remove-Session -InstanceId tekipna1lk0ccr2z1bdjsua2,wq4bfivfm2tbgkgdccpyzczp

EXAMPLE 2

PS master:\> Get-Session -Identity michael | Remove-Session

Related Topics
https://github.com/SitecorePowerShell/Console/
Get-Session

Remove-Session 333
Sitecore PowerShell Extensions

Remove-User
Removes the Sitecore user.

Syntax
Remove-User [-Identity]

Remove-User -Instance

Detailed Description
The Remove-User command removes a user from Sitecore.

The Identity parameter specifies the Sitecore user to remove. You can specify a user by its local name or fully qualified
name.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

Specifies the Sitecore user by providing one of the following values.

Local Name
Example: admin
Fully Qualified Name
Example: sitecore\admi

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Instance <User>

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Remove-User 334
Sitecore PowerShell Extensions

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

System.String Represents the identity of a user.

Sitecore.Security.Accounts.User Represents the instance of a user.

Outputs
The output type is the type of the objects that the cmdlet emits.

None.

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\> Remove-User -Identity michael

EXAMPLE 2

PS master:\> "michael","adam","mike" | Remove-User

EXAMPLE 3

PS master:\> Get-User -Filter sitecore\m* | Remove-User

Related Topics
https://github.com/SitecorePowerShell/Console/
Get-User
New-User
Set-User
Unlock-User

Remove-User 335
Sitecore PowerShell Extensions

Reset-ItemField
Resets item fields, specified as either names, fields or template fields.

Syntax
Reset-ItemField [-Language <String[]>] [-Path] <String> [-IncludeStandardFields] [-Name <String[]>]

Reset-ItemField [-Language <String[]>] -Id <String> [-Database <String>] [-IncludeStandardFields] [-Name <String[]>]

Reset-ItemField [-Language <String[]>] [-Item] <Item> [-IncludeStandardFields] [-Name <String[]>]

Detailed Description
Resets item fields, specified as either names, fields or template fields.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-IncludeStandardFields <SwitchParameter>

Includes fields that are defined on "Standard template"

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Name <String[]>

Array of field names to include - supports wildcards.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Language <String[]>

Reset-ItemField 336
Sitecore PowerShell Extensions

Language that will be reset. If not specified the current user language will be used. Globbing/wildcard supported.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

The item to be analysed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be analysed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the item to be analysed.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Reset-ItemField 337
Sitecore PowerShell Extensions

Database containing the item to be reset - can work with Language parameter to narrow the publication scope.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

None

Notes
Help Author: Adam Najmanowicz, Michael West, Alex Washtell

Examples

EXAMPLE 1

Reset all item fields, excluding standard fields.

PS master:\> Reset-ItemField -Path master:\content\home

EXAMPLE 2

Reset all item fields, including standard fields.

PS master:\> Reset-ItemField -Path master:\content\home -IncludeStandardFields

EXAMPLE 3

Reset all item fields with names beginning with "a", excluding standard fields.

Reset-ItemField 338
Sitecore PowerShell Extensions

PS master:\> Get-Item master:\content\home | Reset-ItemField -Name "a*"

Related Topics
Get-ItemTemplate
Get-ItemField
https://github.com/SitecorePowerShell/Console/

Reset-ItemField 339
Sitecore PowerShell Extensions

Reset-Layout
Resets the layout for the specified item.

Syntax
Reset-Layout [-Item] <Item>

Reset-Layout [-Path] <String>

Reset-Layout -Id <String> [-Database <String>]

Detailed Description
The Reset-Layout command resets the layout for the specified item.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Item <Item>

The item to be processed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be processed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Reset-Layout 340
Sitecore PowerShell Extensions

Id of the item to be processed.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be processed.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

None.

Notes
Help Author: Adam Najmanowicz, Michael West, Alex Washtell

Examples

EXAMPLE

PS master:\> Reset-Layout -Path master:\content\home

Related Topics
Reset-Layout 341
Sitecore PowerShell Extensions

https://github.com/SitecorePowerShell/Console/
Add-Rendering
New-Rendering
Set-Rendering
Get-Rendering
Get-LayoutDevice
Remove-Rendering
Set-Layout
Get-Layout

Reset-Layout 342
Sitecore PowerShell Extensions

Restart-Application
Restarts the Sitecore Application pool.

Syntax

Detailed Description
Restarts the Sitecore Application pool.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Restart-Application

Related Topics
https://github.com/SitecorePowerShell/Console/

Restart-Application 343
Sitecore PowerShell Extensions

Resume-SearchIndex
Resumes the suspended (paused) Sitecore index.

Syntax
Resume-SearchIndex [[-Name] <String>]

Detailed Description
The Resume-SearchIndex command resumes the suspended (paused) Sitecore index.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Name <String>

The name of the index to resume.

Aliases

Required? false

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.ContentSearch.ISearchIndex or System.String

Outputs
The output type is the type of the objects that the cmdlet emits.

None

Notes
Help Author: Adam Najmanowicz, Michael West

Examples
Resume-SearchIndex 344
Sitecore PowerShell Extensions

EXAMPLE 1

The following stops the indexing process from running.

PS master:\> Resume-SearchIndex -Name sitecore_master_index

EXAMPLE 2

The following stops the indexing process from running.

PS master:\> Get-SearchIndex -Name sitecore_master_index | Resume-SearchIndex

Related Topics
Initialize-SearchIndex
Suspend-SearchIndex
Stop-SearchIndex
Get-SearchIndex
https://github.com/SitecorePowerShell/Console/

Resume-SearchIndex 345
Sitecore PowerShell Extensions

Send-File
Allows users to download files from server and file items from media library.

Syntax
Send-File [-Path] [-Message ] [-NoDialog] [-Title ] [-Width ] [-Height ]

Send-File [-Message ] [-Item] [-NoDialog] [-Title ] [-Width ] [-Height ]

Detailed Description
Executing this command with file path on the server provides script users with means to download a file to their computer.
Executing it for an Item located in Sitecore Media library allows the user to download the blob stored in that item. If the file
has been downloaded the dialog returns "downloaded" string, otherwise "cancelled" is returned.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions##
Aliases

The following abbreviations are aliases for this cmdlet:

Download-File

Parameters

-Path <String>

Path to the file to be downloaded. The file has to exist in the Data folder. Files from outside the Data folder are not
downloadable.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Message <String>

Message to show the user in the download dialog.

Aliases

Required? false

Position? named

Default Value

Send-File 346
Sitecore PowerShell Extensions

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

The item to be downloaded.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-NoDialog <SwitchParameter>

If this parameter is used the Dialog will not be shown but instead the file download will begin immediately.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Title <String>

Download dialog title.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Width <Int32>

Download dialog width.

Aliases

Required? false

Position? named

Default Value

Send-File 347
Sitecore PowerShell Extensions

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Height <Int32>

Download dialog height.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

System.String

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Download File from server disk drive

PS master:\> Send-File -Path "C:\Projects\ZenGarden\Data\packages\Sitecore PowerShell Extensions-2.6.zip"

EXAMPLE 2

Download item from media library

PS master:\> Get-Item "master:/media library/Showcase/cognifide_logo" | Send-File -Message "Cognifide Logo"

Send-File 348
Sitecore PowerShell Extensions

Related Topics
https://github.com/SitecorePowerShell/Console/

Send-File 349
Sitecore PowerShell Extensions

Send-SheerMessage
Sends a sheer message to the app in which context the script is executing.

Syntax
Send-SheerMessage [-Name] [-GetResult] [-Parameters ]

Detailed Description
Sends a sheer message to the app in which context the script is executing.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Name <String>

Name of the Sheer message to execute.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-GetResult <SwitchParameter>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Parameters <Hashtable>

Aliases

Required? false

Position? named

Default Value

Send-SheerMessage 350
Sitecore PowerShell Extensions

Accept Pipeline Input? false

Accept Wildcard Characters? false

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

If you execute the following script in the PowerShell ISE the Save dialog will popup

Send-SheerMessage -Name 'ise:save'

Related Topics
https://github.com/SitecorePowerShell/Console/

Send-SheerMessage 351
Sitecore PowerShell Extensions

Set-HostProperty
Sets the current host property.

Syntax
Set-HostProperty [-ForegroundColor ] [-BackgroundColor ] [-HostWidth ] [-Persist]

Detailed Description
Sets the current host property and perssits them for the future if used with -Persist parameter.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-ForegroundColor <ConsoleColor>

Color of the console text.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-BackgroundColor <ConsoleColor>

Color of the console background.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-HostWidth <Int32>

Width of the text buffer (texts longer than the number provided will wrap to the next line.

Aliases

Set-HostProperty 352
Sitecore PowerShell Extensions

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Persist <SwitchParameter>

Persist the console setting provided

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Set width of the console buffer to 80 and persist it for the future instances

PS master:\> Set-HostProperty -HostWidth 80 -Persist

EXAMPLE 2

Set color of the console text to cyan. Next instance of the console will revert to default (white).

PS master:\> Set-HostProperty -ForegroundColor Cyan

Related Topics
https://github.com/SitecorePowerShell/Console/

Set-HostProperty 353
Sitecore PowerShell Extensions

Set-ItemAcl
Sets new security information on an item overwriting the previous settings.

Syntax
Set-ItemAcl -AccessRules [-Path] [-PassThru]

Set-ItemAcl -AccessRules -Id [-Database ] [-PassThru]

Set-ItemAcl -AccessRules [-Item] [-PassThru]

Detailed Description
Sets new security information on an item. The new rules will overwrite the existing security descriptors on the item.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-AccessRules <AccessRuleCollection>

A single or multiple access rules created e.g. through the New-ItemAcl or obtained from other item using the Get-ItemAcl
cmdlet. This information will overwrite the existing security descriptors on the item.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-PassThru <SwitchParameter>

Passes the processed object back into the pipeline.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

Set-ItemAcl 354
Sitecore PowerShell Extensions

The item to be processed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be processed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the item to be processed. Requires the Database parameter to be specified.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be fetched with Id parameter.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
Set-ItemAcl 355
Sitecore PowerShell Extensions

The input type is the type of the objects that you can pipe to the cmdlet.

can be piped from another cmdlet* Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Only if -PassThru is used* Sitecore.Data.Items.Item

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Take the security information from the Home item and apply it to the Settings item

$acl = Get-ItemAcl -Path master:\content\home


Set-ItemAcl -Path master:\content\Settings -AccessRules $acl -PassThru

EXAMPLE 2

Allows the "sitecore\adam" user to delete the Home item and all of its children. Denies the "sitecore\mikey" user reading the
descendants of the Home item. ;P The security info is created prior to setting it to the item. The item is delivered to the Set-
ItemAcl from the pipeline and returned to the pipeline after processing due to the -PassThru parameter. Any previuous
security information on the item is removed.

$acl1 = New-ItemAcl -AccessRight item:delete -PropagationType Any -SecurityPermission AllowAccess -Identity "sitecore\adam"
$acl2 = New-ItemAcl -AccessRight item:read -PropagationType Descendants -SecurityPermission DenyAccess -Identity "sitecore\mikey"
Get-Item -Path master:\content\home | Set-ItemAcl -AccessRules $acl1, $acl2 -PassThru

Name Children Languages Id TemplateName


---- -------- --------- -- ------------
Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item

Related Topics
https://github.com/SitecorePowerShell/Console/
Add-ItemAcl
Clear-ItemAcl
Get-ItemAcl
New-ItemAcl
Test-ItemAcl
https://sdn.sitecore.net/upload/sitecore6/security_administrators_cookbook_a4.pdf

Set-ItemAcl 356
Sitecore PowerShell Extensions

https://sdn.sitecore.net/upload/sitecore6/61/security_reference-a4.pdf
https://sdn.sitecore.net/upload/sitecore6/64/content_api_cookbook_sc64_and_later-a4.pdf
http://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2013/01/sitecore-security-access-
rights.aspx
https://briancaos.wordpress.com/2009/10/02/assigning-security-to-items-in-sitecore-6-programatically/

Set-ItemAcl 357
Sitecore PowerShell Extensions

Set-Layout
Sets item layout for a device.

Syntax
Set-Layout [-Item] -Device [-Layout ]

Set-Layout [-Path] -Device [-Layout ]

Set-Layout -Id [-Database ] -Device [-Layout ]

Detailed Description
Sets item layout for a specific device provided

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Device <DeviceItem>

Device for which to set layout.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Layout <Item>

Sitecore item defining the layout.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

Set-Layout 358
Sitecore PowerShell Extensions

The item to be processed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
Set-Layout 359
Sitecore PowerShell Extensions

The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Set-Layout -Path master:\content\home

Related Topics
https://github.com/SitecorePowerShell/Console/
Add-Rendering
New-Rendering
Set-Rendering
Get-Rendering
Get-LayoutDevice
Remove-Rendering
Get-Layout
Reset-Layout

Set-Layout 360
Sitecore PowerShell Extensions

Set-Rendering
Updates rendering with new values.

Syntax
Set-Rendering [-Item] -Instance [-Parameter ] [-PlaceHolder ] [-DataSource ] [-Index ]

Set-Rendering [-Path] -Instance [-Parameter ] [-PlaceHolder ] [-DataSource ] [-Index ]

Set-Rendering -Id [-Database ] -Instance [-Parameter ] [-PlaceHolder ] [-DataSource ] [-Index ]

Detailed Description
Updates rendering instance with new values. The instance should be earlier obtained using Get-Rendering.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Instance <RenderingDefinition>

Instance of the Rendering to be updated.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Parameter <Hashtable>

Rendering Parameters to be overriden on the Rendering that is being updated - if not specified the value provided in
rendering definition specified in the Instance parameter will be used.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-PlaceHolder <String>

Set-Rendering 361
Sitecore PowerShell Extensions

Placeholder path the Rendering should be added to - if not specified the value provided in rendering definition specified in
the Instance parameter will be used.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-DataSource <String>

Data source of the Rendering - if not specified the value provided in rendering definition specified in the Instance parameter
will be used.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Index <Int32>

If provided the rendering will be moved to the specified index.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

The item to be processed.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

Set-Rendering 362
Sitecore PowerShell Extensions

-Path <String>

Path to the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be processed - can work with Language parameter to narrow the publication scope.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Notes
Help Author: Adam Najmanowicz, Michael West

Examples
Set-Rendering 363
Sitecore PowerShell Extensions

EXAMPLE

change all rendering's placeholder from main to footer

PS master:\> $item = Get-Item -Path master:\content\home


PS master:\> Get-Rendering -Item $item -PlaceHolder "main" | Foreach-Object { $_.Placeholder = "footer"; Set-Rendering -Item

Related Topics
https://github.com/SitecorePowerShell/Console/
Add-Rendering
New-Rendering
Get-Rendering
Get-LayoutDevice
Remove-Rendering
Get-Layout
Set-Layout

Set-Rendering 364
Sitecore PowerShell Extensions

Set-User
Sets the Sitecore user properties.

Syntax
Set-User [-Identity] [-IsAdministrator ] [-Portrait ] [-Email ] [-FullName ] [-Comment ] [-ProfileItemId ] [-StartUrl ] [-Enabled] [-
CustomProperties ]

Set-User -Instance [-IsAdministrator ] [-Portrait ] [-Email ] [-FullName ] [-Comment ] [-ProfileItemId ] [-StartUrl ] [-Enabled] [-
CustomProperties ]

Detailed Description
The Set-User command sets a user profile properties in Sitecore.

The Identity parameter specifies the Sitecore user to set. You can specify a user by its local name or fully qualified name.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-IsAdministrator <Boolean>

Specifies whether the Sitecore user should be classified as an Administrator.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Portrait <String>

Specifies the Sitecore user portrait image.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Set-User 365
Sitecore PowerShell Extensions

-Identity <AccountIdentity>

Specifies the Sitecore user by providing one of the following values.

Local Name
Example: admin

Fully Qualified Name


Example: sitecore\admi

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Instance <User>

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Email <String>

Specifies the Sitecore user email address. The value is validated for a properly formatted address.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-FullName <String>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Set-User 366
Sitecore PowerShell Extensions

Accept Wildcard Characters? false

-Comment <String>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-ProfileItemId <ID>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-StartUrl <String>

Specifies the url to navigate to once the user is logged in. The values are validated with a pretermined set.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Enabled <SwitchParameter>

Specifies whether the Sitecore user should be enabled.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Set-User 367
Sitecore PowerShell Extensions

-CustomProperties <Hashtable>

Specifies a hashtable of custom properties to assign to the Sitecore user profile.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

System.String Represents the identity of a user.

Sitecore.Security.Accounts.User Represents the instance of a user.

Outputs
The output type is the type of the objects that the cmdlet emits.

None.

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\> Set-User -Identity michael -Email michaellwest@gmail.com

EXAMPLE 2

PS master:\> "michael","adam","mike" | Set-User -Enable $false

EXAMPLE 3

PS master:\> Get-User -Filter * | Set-User -Comment "Sitecore user"

Set-User 368
Sitecore PowerShell Extensions

EXAMPLE 4

PS master:\> Set-User -Identity michael -CustomProperties @{"Date"=(Get-Date)}


PS master:\>(Get-User michael).Profile.GetCustomProperty("Date")

7/3/2014 4:40:02 PM

EXAMPLE 5

PS master:\> Set-User -Identity michael -IsAdministrator $true -CustomProperties @{"HireDate"="03/17/2010"}


PS master:\>$user = Get-User -Identity michael
PS master:\>$user.Profile.GetCustomProperty("HireDate")

03/17/2010

Related Topics
https://github.com/SitecorePowerShell/Console/
Get-User
New-User
Remove-User
Unlock-User

Set-User 369
Sitecore PowerShell Extensions

Set-UserPassword
Sets the Sitecore user password.

Syntax
Set-UserPassword [-Identity] -OldPassword [-NewPassword ]

Set-UserPassword [-Identity] -Reset [-NewPassword ]

Detailed Description
The Set-UserPassword command resets or changes a user password.

The Identity parameter specifies the Sitecore user to remove. You can specify a user by its local name or fully qualified
name.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

Specifies the Sitecore user by providing one of the following values.

Local Name
Example: admin
Fully Qualified Name
Example: sitecore\admi

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-NewPassword <String>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? true (ByPropertyName)

Set-UserPassword 370
Sitecore PowerShell Extensions

Accept Wildcard Characters? false

-OldPassword <String>

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Reset <SwitchParameter>

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

System.String Represents the identity of a user.

Sitecore.Security.Accounts.User Represents the instance of a user.

Outputs
The output type is the type of the objects that the cmdlet emits.

None.

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\> Set-UserPassword -Identity michael -NewPassword pass123 -OldPassword b

Set-UserPassword 371
Sitecore PowerShell Extensions

EXAMPLE 2

PS master:\> "michael","adam","mike" | Set-UserPassword -NewPassword b -Reset

Related Topics
https://github.com/SitecorePowerShell/Console/
Get-User
Set-User

Set-UserPassword 372
Sitecore PowerShell Extensions

Show-Alert
Pauses the script and shows an alert to the user.

Syntax
Show-Alert [-Title]

Detailed Description
Pauses the script and shows an alert specified in the -Title to the user. Once user clicks the OK button - script execution
resumes.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Title <String>

Text to show the user in the alert dialog.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Show-Alert "Hello world."

Related Topics
Read-Variable
Show-Application

Show-Alert 373
Sitecore PowerShell Extensions

Show-Confirm
Show-FieldEditor
Show-Input
Show-ListView
Show-ModalDialog
Show-Result
Show-YesNoCancel
https://github.com/SitecorePowerShell/Console/

Show-Alert 374
Sitecore PowerShell Extensions

Show-Application
Executes Sitecore Sheer application.

Syntax
Show-Application [-Application] [[-Parameter] ] [-Icon ] [-Modal] [-Title ] [-Width ] [-Height ]

Detailed Description
Executes Sitecore Sheer application, allows for passing additional parameters, launching it on desktop in cooperative or in
Modal mode.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Application <String>

Name of the Application to be executed. Application must be defined in the Core databse.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Parameter <Hashtable>

Additional parameters passed to the application.

Aliases

Required? false

Position? 2

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Icon <String>

Icon of the executed application (used for titlebar and in the Sitecore taskbar on the desktop)

Aliases

Show-Application 375
Sitecore PowerShell Extensions

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Modal <SwitchParameter>

Causes the application to show in new browser modal window or modal overlay if used in Sitecore 7.2 or later.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Title <String>

Title of the window the app opens in.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Width <Int32>

Width of the modal window.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Height <Int32>

Height of the modal window.

Aliases

Show-Application 376
Sitecore PowerShell Extensions

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Show Content Editor in new window (or as an overlay in modal mode in Sitecore 7.2+) with "/sitecore/templates" item
selected.

$item = gi master:\templates

Show-Application `
-Application "Content Editor" `
-Parameter @{id ="$($item.ID)"; fo="$($item.ID)";la="$($item.Language.Name)"; vs="$($item.Version.Number)";sc_content=
-Modal -Width 1600 -Height 800

EXAMPLE 2

Show Content Editor as a new application on desktop with "/sitecore/content/home" item selected.

$item = gi master:\content\home

Show-Application `
-Application "Content Editor" `
-Parameter @{id ="$($item.ID)"; fo="$($item.ID)";la="$($item.Language.Name)"; vs="$($item.Version.Number)";sc_content=

Related Topics
Read-Variable
Show-Alert
Show-Confirm

Show-Application 377
Sitecore PowerShell Extensions

Show-FieldEditor
Show-Input
Show-ListView
Show-ModalDialog
Show-Result
Show-YesNoCancel
https://github.com/SitecorePowerShell/Console/

Show-Application 378
Sitecore PowerShell Extensions

Show-Confirm
Shows a user a confirmation request message box.

Syntax
Show-Confirm [-Title]

Detailed Description
Shows a user a confirmation request message box. Returns "yes" or "no" based on user's response. The buttons that are
shown to the user are "OK" and "Cancel".

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Title <String>

Text to show the user in the dialog.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

Outputs
The output type is the type of the objects that the cmdlet emits.

System.String

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Show-Confirm -Title "Do you like Sitecore PowerShell Extensions?"

Show-Confirm 379
Sitecore PowerShell Extensions

yes

Related Topics
Read-Variable
Show-Alert
Show-Application
Show-FieldEditor
Show-Input
Show-ListView
Show-ModalDialog
Show-Result
Show-YesNoCancel
https://github.com/SitecorePowerShell/Console/

Show-Confirm 380
Sitecore PowerShell Extensions

Show-FieldEditor
Shows Field editor for a provided item.

Syntax
Show-FieldEditor -Item -PreserveSections [-Name ] [-Title ] [-Width ] [-Height ] [-IncludeStandardFields]

Show-FieldEditor -Item [-SectionTitle ] [-SectionIcon ] [-Name ] [-Title ] [-Width ] [-Height ] [-IncludeStandardFields]

Show-FieldEditor -Path [-Language ] -PreserveSections [-Name ] [-Title ] [-Width ] [-Height ] [-IncludeStandardFields]

Show-FieldEditor -Path [-Language ] [-SectionTitle ] [-SectionIcon ] [-Name ] [-Title ] [-Width ] [-Height ] [-


IncludeStandardFields]

Show-FieldEditor -Id [-Database ] [-Language ] -PreserveSections [-Name ] [-Title ] [-Width ] [-Height ] [-


IncludeStandardFields]

Show-FieldEditor -Id [-Database ] [-Language ] [-SectionTitle ] [-SectionIcon ] [-Name ] [-Title ] [-Width ] [-Height ] [-
IncludeStandardFields]

Detailed Description
Shows Field editor for a provided item allows for editing all or selected list of fields. If user closes the dialog by pressing the
"OK" button "ok" string will be returned. Otherwise "cancel" will be returned.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Name <String[]>

Array of names of the fields to be edited.

This parameter supports globbing so you can simply use "" to allow editing of all fields. If a field is prefixed with a dash - this
field will be excluded from the list of fields. e.g. the following will display all fields except title from Show-FieldEditor -Path
"master:\content\home" -Name "", "-Title"

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Title <String>

Show-FieldEditor 381
Sitecore PowerShell Extensions

Title of the dialog containing the field editor.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Width <Int32>

Width of the dialog containing the field editor.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Height <Int32>

Height of the dialog containing the field editor.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-IncludeStandardFields <SwitchParameter>

Add this parameter to add standard fields to the list that is being considered to be displayed

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

Show-FieldEditor 382
Sitecore PowerShell Extensions

The item to be edited.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be edited - additionally specify Language parameter to fetch different item language than the current
user language.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the the item to be edited - additionally specify Language parameter to fetch different item language than the current
user language.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be edited - can work with Language parameter to narrow the publication scope.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Show-FieldEditor 383
Sitecore PowerShell Extensions

-Language <String[]>

Language that will be edited. If not specified the current user language will be used. Globbing/wildcard supported.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-PreserveSections <SwitchParameter>

If added this parameter tells editor to preserve the original item field sections, otherwise all fields are placed in a single
section Named by SectionTitle parameter and having the SectionIcon icon.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-SectionTitle <String>

If PreserveSections is not added to parameters - this parameter provides a title for the global section all fields are placed
under.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-SectionIcon <String>

If PreserveSections is not added to parameters - this parameter provides a iconfor the global section all fields are placed
under.

Aliases

Required? false

Position? named

Default Value

Show-FieldEditor 384
Sitecore PowerShell Extensions

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

System.String

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Show field editor that shows all non-standard fields on sitecore/content/home item except for field "title" The dialog will be
titled "My Home Item" all fields inside will be in single section.

PS master:\> Show-FieldEditor -Path master:\content\home -Name "*" , "-Title" -Title "My Home Item"

EXAMPLE 2

Show field editor that shows all fields including standard fields on sitecore/content/home The dialog will preserve the item
sections.

PS master:\> Get-Item "master:\content\home" | Show-FieldEditor -Name "*" -IncludeStandardFields -PreserveSections

Related Topics
Read-Variable
Show-Alert
Show-Application
Show-Confirm
Show-Input
Show-ListView
Show-ModalDialog
Show-Result

Show-FieldEditor 385
Sitecore PowerShell Extensions

Show-YesNoCancel
https://github.com/SitecorePowerShell/Console/

Show-FieldEditor 386
Sitecore PowerShell Extensions

Show-Input
Shows prompt message box asking user to provide a text string.

Syntax
Show-Input [-Prompt] [-DefaultValue ] [-Validation ] [-ErrorMessage ] [-MaxLength ]

Detailed Description
Shows prompt message box asking user to provide a text string.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Prompt <String>

Prompt message to show in the message box shown to a user.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-DefaultValue <String>

Default value to be provided for the text box.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Validation <String>

Regex for value validation. If user enters a value that does not validate - en error message defined with the "ErrorMessage"
parameter will be shown and user will be asked to enter the value again.

Aliases

Show-Input 387
Sitecore PowerShell Extensions

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-ErrorMessage <String>

Error message to show when regex validation fails.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-MaxLength <Int32>

Maximum length of the string returned. If user enters a longer value - en error message will be shown and user will be
asked to enter the value again.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Outputs
The output type is the type of the objects that the cmdlet emits.

System.String

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Requests that the user provides an email, validates it against a regular expression snd whows an allert if the format is not

Show-Input 388
Sitecore PowerShell Extensions

valid

PS master:\> Show-Input "Please provide your email" -DefaultValue "my@email.com" -Validation "^[a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)*@(?:

EXAMPLE 2

Uses Show-Input command to request user a new name for the content item validating the proper characters are used and
assigns the result to $newName variable (nothing gets changed)

PS master:\> $contentItem = get-item master:\content


PS master:\> $newName = Show-Input "Please provide the new name for the '$($contentItem.Name)' Item" -DefaultValue $contentItem

#print new name


PS master:\> Write-Host "The new name you've chosen is '$($newName)'"

EXAMPLE 3

Requests that the user provides a string of at most 5 characters

Show-Input "Please provide 5 characters at most" -MaxLength 5

Related Topics
Read-Variable
Show-Alert
Show-Application
Show-Confirm
Show-FieldEditor
Show-ListView
Show-ModalDialog
Show-Result
Show-YesNoCancel
https://github.com/SitecorePowerShell/Console/

Show-Input 389
Sitecore PowerShell Extensions

Show-ListView
Sends output to an interactive table in a separate window.

Syntax
Show-ListView [-PageSize ] [-Icon ] [-InfoTitle ] [-InfoDescription ] [-Modal] [-ActionData ] [-ViewName ] [-
MissingDataMessage ] [-ActionsInSession] -Data [-Property ] [-Title ] [-Width ] [-Height ]

Detailed Description
The Show-ListView command sends the output from a command to a grid view window where the output is displayed in an
interactive table. Because this command requires a user interface, it does not work in a non-interactive scenarios like within
web service calls. You can use the following features of the table to examine your data: -- Sort. To sort the data, click a
column header. Click again to toggle from ascending to descending order. -- Quick Filter. Use the "Filter" box at the top of
the window to search the text in the table. You can search for text in a particular column, search for literals, and search for
multiple words. -- Execute actions on selected items. To execute action on the data from Show-ListView, Ctrl+click the
items you want to be included in the action and press the desired action in the "Actions" chunk in the ribbon. -- Export
contents of the view in XML, CSV, Json, HTML or Excel file and download that onto the user's computer. The downloaded
results will take into account current filter and order of the items.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-PageSize <Int32>

Number of results shown per page.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Icon <String>

Icon of the result window. (Shows in the top/left corner and on the Sitecore taskbar).

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Show-ListView 390
Sitecore PowerShell Extensions

Accept Wildcard Characters? false

-InfoTitle <String>

Title on the panel that appears below the ribbon in the results window.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-InfoDescription <String>

Description that appears on the panel below the ribbon in the results window.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Modal <SwitchParameter>

If this parameter is provided Results will show in a new window (in Sitecore 6.x up till Sitecore 7.1) or in a modal overlay
(Sitecore 7.2+)

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-ActionData <Object>

Additional data what will be passed to the view. All actions that are executed from that view window will have that data
accessible to them as $actionData variable.

Aliases

Required? false

Position? named

Show-ListView 391
Sitecore PowerShell Extensions

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-ViewName <String>

View signature name - this can be used by action commands to determine whether to show an action or not using the
Show/Enable rules.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-MissingDataMessage <String>

If no Items were provided for -Data parameter the message provided in this parameter will be shown in the middle of the
List View dialog to notify users of the lack of items to display.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-ActionsInSession <SwitchParameter>

If this parameter is specified actions will be executed in the same session as the one in which the command is executed.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Data <Object>

Data to be displayed in the view.

Aliases

Show-ListView 392
Sitecore PowerShell Extensions

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Property <Object[]>

Specifies the object properties that appear in the display and the order in which they appear. Type one or more property
names (separated by commas), or use a hash table to display a calculated property.

The value of the Property parameter can be a new calculated property. To create a calculated, property, use a hash table.
Valid keys are: -- Name (or Label) <string> -- Expression <string> or <script block>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Title <String>

Title of the results window.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Width <Int32>

Width of the results window.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Height <Int32>

Show-ListView 393
Sitecore PowerShell Extensions

Height of the results window.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

System.Management.Automation.PSObject

Outputs
The output type is the type of the objects that the cmdlet emits.

System.String

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

This command formats information about Sitecore items in a table. The Get-ChildItem command gets objects representing
the items. The pipeline operator (|) passes the object to the Show-ListView command. Show-ListView displays the objects
in a table.

PS master:\> Get-Item -path master:\* | Show-ListView -Property Name, DisplayName, ProviderPath, TemplateName, Language

EXAMPLE 2

This command formats information about Sitecore items in a table. The Get-ItemReferrer command gets all references of
the "Sample Item" template. The pipeline operator (|) passes the object to the Show-ListView command. Show-ListView
displays the objects in a table. The Properties are not displaying straight properties but use the Name/Expression scheme
to provide a nicely named values that like in the case of languages which are aggregarde form the "Languages" property.

PS master:\> Get-ItemReferrer -path 'master:\templates\Sample\Sample Item' |


Show-ListView -Property `

Show-ListView 394
Sitecore PowerShell Extensions

@{Label="Name"; Expression={$_.DisplayName} },
@{Label="Path"; Expression={$_.Paths.Path} },
@{Label="Languages"; Expression={$_.Languages | % { $_.Name + ", "} } }

Related Topics
Update-ListView
Out-GridView
Format-Table
Read-Variable
Show-Alert
Show-Application
Show-Confirm
Show-FieldEditor
Show-Input
Show-ModalDialog
Show-Result
Show-YesNoCancel
http://blog.najmanowicz.com/2014/10/25/creating-beautiful-sitecore-reports-easily-with-powershell-extensions/
http://michaellwest.blogspot.com/2014/04/reports-with-sitecore-powershell.html
http://sitecorejunkie.com/2014/05/28/create-a-custom-report-in-sitecore-powershell-extensions/
https://github.com/SitecorePowerShell/Console/

Show-ListView 395
Sitecore PowerShell Extensions

Show-ModalDialog
Shows Sitecore Sheer control as a modal dialog.

Syntax
Show-ModalDialog -Control [-Parameters ] [-HandleParameters ] [-Title ] [-Width ] [-Height ]

Show-ModalDialog -Url [-HandleParameters ] [-Title ] [-Width ] [-Height ]

Detailed Description
Shows Sitecore Sheer control as a modal dialog. If control returns a value - the value will be passed back as the result of
the command execution.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Control <String>

Name of the Sitecore Sheer control to show

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Url <String>

A fully formed URL that constitutes a control execution request.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Parameters <Hashtable>

Hashtable of parameters to pass to the control in the url.

Show-ModalDialog 396
Sitecore PowerShell Extensions

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-HandleParameters <Hashtable>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Title <String>

Title of the control dialog.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Width <Int32>

Width of the control dialog.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Height <Int32>

Height of the control dialog.

Aliases

Show-ModalDialog 397
Sitecore PowerShell Extensions

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

System.String

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Show-ModalDialog -Control "ConfirmChoice" -Parameters @{btn_0="Yes (returns btn_0)"; btn_1="No (returns btn_1)"

Related Topics
Read-Variable
Show-Alert
Show-Application
Show-Confirm
Show-FieldEditor
Show-Input
Show-ListView
Show-Result
Show-YesNoCancel
https://github.com/SitecorePowerShell/Console/

Show-ModalDialog 398
Sitecore PowerShell Extensions

Show-Result
Shows a Sheer dialog with text results showing the output of the script or another control selected by the user based on
either control name or Url to the control.

Syntax
Show-Result -Control [-Parameters ] [-Title ] [-Width ] [-Height ]

Show-Result -Url [-Title ] [-Width ] [-Height ]

Show-Result [-Text] [-Title ] [-Width ] [-Height ]

Detailed Description
Shows a Sheer dialog with text results showing the output of the script or another control selected by the user based on
either control name or Url to the control.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Control <String>

Name of the Sheer control to execute.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Url <String>

Url to the Sheer control to execute.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Show-Result 399
Sitecore PowerShell Extensions

-Parameters <String[]>

Parameters to be passed to the executed control when executing with the -Control parameter specified.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Text <SwitchParameter>

Shows the default text dialog.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Title <String>

Title of the window containing the control.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Width <Int32>

Width of the window containing the control.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Show-Result 400
Sitecore PowerShell Extensions

-Height <Int32>

Height of the window containing the control.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

System.String

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Show results of script executio

PS master:\> Show-Result -Text

EXAMPLE 2

Show the Control Panel control in a Window of specified size.

PS master:\> Show-Result -Control "ControlPanel" -Width 1024 -Height 640

EXAMPLE 3

Show-Result 401
Sitecore PowerShell Extensions

Shows a new instance of ISE


Show-Result -Url "/sitecore/shell/Applications/PowerShell/PowerShellIse"

EXAMPLE 4

Related Topics
Read-Variable
Show-Alert
Show-Application
Show-Confirm
Show-FieldEditor
Show-Input
Show-ListView
Show-ModalDialog
Show-YesNoCancel
https://github.com/SitecorePowerShell/Console/

Show-Result 402
Sitecore PowerShell Extensions

Show-YesNoCancel
Shows Yes/No/Cancel dialog to the user and returns user choice.

Syntax
Show-YesNoCancel [-Title ] [-Width ] [-Height ]

Detailed Description
Shows Yes/No/Cancel dialog to the user and returns user choice as a string value.

Depending on the user response one of the 2 strings is returned:

yes
no
cancel

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Title <String>

Question to ask the user in the dialog

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Width <Int32>

Width of the dialog.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Show-YesNoCancel 403
Sitecore PowerShell Extensions

-Height <Int32>

Height of the dialog.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Outputs
The output type is the type of the objects that the cmdlet emits.

System.String

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Show-YesNoCancel "Should we delete those 2 items?"

cancel

Related Topics
Read-Variable
Show-Alert
Show-Application
Show-Confirm
Show-FieldEditor
Show-Input
Show-ListView
Show-ModalDialog
Show-Result
Show-YesNoCancel
https://github.com/SitecorePowerShell/Console/

Show-YesNoCancel 404
Sitecore PowerShell Extensions

Start-ScriptSession
Starts a new Script Session and executes a script provided in it.

Syntax
Start-ScriptSession -Id <String[]> -Item <Item> [-JobName <String>] [-ArgumentList <Hashtable>] [-Identity
<AccountIdentity>] [-DisableSecurity] [-AutoDispose] [-Interactive] [-ContextItem <Item>]

Start-ScriptSession -Id <String[]> -ScriptBlock <ScriptBlock> [-JobName <String>] [-ArgumentList <Hashtable>] [-Identity
<AccountIdentity>] [-DisableSecurity] [-AutoDispose] [-Interactive] [-ContextItem <Item>]

Start-ScriptSession -Id <String[]> -Path <String> [-JobName <String>] [-ArgumentList <Hashtable>] [-Identity
<AccountIdentity>] [-DisableSecurity] [-AutoDispose] [-Interactive] [-ContextItem <Item>]

Start-ScriptSession -Session <ScriptSession[]> -Item <Item> [-JobName <String>] [-ArgumentList <Hashtable>] [-Identity
<AccountIdentity>] [-DisableSecurity] [-AutoDispose] [-Interactive] [-ContextItem <Item>]

Start-ScriptSession -Session <ScriptSession[]> -ScriptBlock <ScriptBlock> [-JobName <String>] [-ArgumentList


<Hashtable>] [-Identity <AccountIdentity>] [-DisableSecurity] [-AutoDispose] [-Interactive] [-ContextItem <Item>]

Start-ScriptSession -Session <ScriptSession[]> -Path <String> [-JobName <String>] [-ArgumentList <Hashtable>] [-Identity
<AccountIdentity>] [-DisableSecurity] [-AutoDispose] [-Interactive] [-ContextItem <Item>]

Start-ScriptSession -Item <Item> [-JobName <String>] [-ArgumentList <Hashtable>] [-Identity <AccountIdentity>] [-


DisableSecurity] [-AutoDispose] [-Interactive] [-ContextItem <Item>]

Start-ScriptSession -Path <String> [-JobName <String>] [-ArgumentList <Hashtable>] [-Identity <AccountIdentity>] [-


DisableSecurity] [-AutoDispose] [-Interactive] [-ContextItem <Item>]

Start-ScriptSession -ScriptBlock <ScriptBlock> [-JobName <String>] [-ArgumentList <Hashtable>] [-Identity


<AccountIdentity>] [-DisableSecurity] [-AutoDispose] [-Interactive] [-ContextItem <Item>]

Detailed Description
Starts a new Script Session and executes a script provided in it. The session can be a background session or if the caller
session is interactive providint the -Interactive switch can open a Windowd for the new sessio

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Id <String[]>

Id of the session to be created or retrieved. If the session with the same ID exists - it will be used, unless it's busy - in which
case an error will be raised. If a session with the Id provided does not exist - it will be created. The Id is a string that
uniquely identifies the script session within the server. You can type one or more IDs (separated by commas). To find the ID
of a script session, type "Get-ScriptSession" without parameters.

Aliases

Start-ScriptSession 405
Sitecore PowerShell Extensions

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Session <ScriptSession[]>

Specifies the script session in context of which the script should be executed. Enter a variable that contains the script
session or a command that gets the script session. You can also pipe a script session object to Start-ScriptSession. If the
session is busy at the moment of the call - an error will be raised instead of running the script.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

Script item containing the code to be executed.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Path <String>

Path to the script item containing the code to be executed.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-ScriptBlock <ScriptBlock>

Script to be executed.

Start-ScriptSession 406
Sitecore PowerShell Extensions

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-JobName <String>

Name of the Sitecore job that will run the script session. This can be used to monitor the session progress.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-ArgumentList <Hashtable>

Hashtable with the additional parameters required by the invoked script. The parameters will be instantiated in the session
as variables.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Identity <AccountIdentity>

User name including domain in context of which the script will be executed. If no domain is specified - 'sitecore' will be used
as the default value. If user is not specified the current user will be the impersonation context.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-DisableSecurity <SwitchParameter>

Start-ScriptSession 407
Sitecore PowerShell Extensions

Add this parameter to disable security in the Job running the script session.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-AutoDispose <SwitchParameter>

Providing this parameter will cause the session to be automatically destroyed after it has executed. Use this parameter if
you're not in need of the results of the script execution.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Interactive <SwitchParameter>

If the new session is run from an interactive session (e.g. from desktop, menu item, console or ISE) using this parameter
will cause dialog to be shown to the user to monitor the script progress.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-ContextItem <Item>

Context item for the script session. The script will start in the location of the item.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Start-ScriptSession 408
Sitecore PowerShell Extensions

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Cognifide.PowerShell.Core.Host.ScriptSessio

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

The following starts the progress demo script in interactive mode (showing dialogs for each script) in 3 different ways.

In the first case script path is used, second case shows the script item beign retrieved and provided to the cmdlet.
The last case shows the script to be provided as a script block (script content)
Script finishes before the sessions that were launched from it end.
The sessions will be disposed when user presses the "Close" button in their dialogs as the -AutoDispose parameter was provided.

$scriptPath = "master:\system\Modules\PowerShell\Script Library\Getting Started\Script Testing\Long Running Script with Progress Demo"
$scriptItem = Get-Item $scriptPath
$script = [scriptblock]::Create($scriptItem.Script)
Start-ScriptSession -Path $scriptPath -Interactive -AutoDispose
Start-ScriptSession -Item $scriptItem -Interactive -AutoDispose
Start-ScriptSession -ScriptBlock $script -Interactive -AutoDispose

EXAMPLE 2

The following starts a script that changes its path to "master:\" and sleeps for 4 seconds. The session will persist in

Start-ScriptSession -ScriptBlock { cd master:\; Start-Sleep -Seconds 4 } -Id "Background Task"

Related Topics
Get-ScriptSession
Receive-ScriptSession
Remove-ScriptSession
Stop-ScriptSession
Wait-ScriptSession
http://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/

Start-ScriptSession 409
Sitecore PowerShell Extensions

https://git.io/spe

Start-ScriptSession 410
Sitecore PowerShell Extensions

Start-TaskSchedule
Executes a task schedule.

Syntax
Start-TaskSchedule -Schedule

Start-TaskSchedule [-Item]

Start-TaskSchedule [-Path]

Start-TaskSchedule -Id [-Database ]

Detailed Description
Executes a task schedule either passed from Get-Schedule, based on Item or Schedule path.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Schedule <ScheduleItem>

ScheduleItem most conveniently obtained from Get-Schedule command.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Item <Item>

Schedule item - if Item is of wrong template - an appropriate error will be written to teh host.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

Start-TaskSchedule 411
Sitecore PowerShell Extensions

-Path <String>

Path to the schedule item - if item is of wrong template - an appropriate error will be written to teh host.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Tasks.ScheduleItem Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Sitecore.Tasks.ScheduleItem

Notes

Start-TaskSchedule 412
Sitecore PowerShell Extensions

Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\> Start-TaskSchedule -Path "master:/system/Tasks/Schedules/Email Campaign/Clean Message History"

Name Database Active Auto Remove Is Due Expired Completed Last Run Next Run
---- -------- ------ ----------- ------ ------- --------- -------- --------
Clean Message History master True False False False False 2014-07-29 16:22:

EXAMPLE 2

PS master:\> Get-TaskSchedule -Name "Check Bounced Messages" -Database "master" | Start-TaskSchedule

Name Database Active Auto Remove Is Due Expired Completed Last Run Next Run
---- -------- ------ ----------- ------ ------- --------- -------- --------
Check Bounced Messages master True False False False False 2014-07-29 16:21:

Related Topics
Get-TaskSchedule
https://github.com/SitecorePowerShell/Console/
https://www.youtube.com/watch?v=N3xgZcU9FqQ&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=9

Start-TaskSchedule 413
Sitecore PowerShell Extensions

Stop-ScriptSession
Stops executing script session.

Syntax
Stop-ScriptSession -Id <String[]>

Stop-ScriptSession -Session <ScriptSession[]>

Detailed Description
Aborts the pipeline of a session that is executing. This will stop the session immediately in its next PowerShell command.
Caution! If your script is running a long operation in the .net code rather than in PowerShell - the session will abort after the
code has finished and the control was returned to the script.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Id <String[]>

Stops the script session with the specified IDs. The ID is a string that uniquely identifies the script session within the server.
You can type one or more IDs (separated by commas). To find the ID of a script session, type "Get-ScriptSession" without
parameters.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Session <ScriptSession[]>

Specifies the script session to be stopped. Enter a variable that contains the script session or a command that gets the
script session. You can also pipe a script session object to Receive-ScriptSession.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

Stop-ScriptSession 414
Sitecore PowerShell Extensions

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

System.String or Cognifide.PowerShell.Core.Host.ScriptSessio

Outputs
The output type is the type of the objects that the cmdlet emits.

Cognifide.PowerShell.Core.Host.ScriptSessio

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

The following stops the script session with the specified Id.

PS master:\> Stop-ScriptSession -Id "My Background Script Session"

Related Topics
Get-ScriptSession
Receive-ScriptSession
Remove-ScriptSession
Start-ScriptSession
Wait-ScriptSession
http://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/
https://git.io/spe

Stop-ScriptSession 415
Sitecore PowerShell Extensions

Stop-SearchIndex
Stops the Sitecore index.

Syntax
Stop-SearchIndex [[-Name] <String>]

Detailed Description
The Stop-SearchIndex command stops the Sitecore index.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Name <String>

The name of the index to stop.

Aliases

Required? false

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.ContentSearch.ISearchIndex or System.String

Outputs
The output type is the type of the objects that the cmdlet emits.

None

Notes
Help Author: Adam Najmanowicz, Michael West

Examples
Stop-SearchIndex 416
Sitecore PowerShell Extensions

EXAMPLE 1

The following stops the indexing process from running.

PS master:\> Stop-SearchIndex -Name sitecore_master_index

EXAMPLE 2

The following stops the indexing process from running.

PS master:\> Get-SearchIndex -Name sitecore_master_index | Stop-SearchIndex

Related Topics
Initialize-SearchIndex
Suspend-SearchIndex
Resume-SearchIndex
Get-SearchIndex
https://github.com/SitecorePowerShell/Console/

Stop-SearchIndex 417
Sitecore PowerShell Extensions

Suspend-SearchIndex
Suspends (pauses) the Sitecore index.

Syntax
Suspend-SearchIndex [[-Name] <String>]

Detailed Description
The Suspend-SearchIndex command suspends (pauses) the Sitecore index.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Name <String>

The name of the index to suspend (pause).

Aliases

Required? false

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.ContentSearch.ISearchIndex or System.String

Outputs
The output type is the type of the objects that the cmdlet emits.

None

Notes
Help Author: Adam Najmanowicz, Michael West

Examples
Suspend-SearchIndex 418
Sitecore PowerShell Extensions

EXAMPLE 1

The following suspends (pauses) the indexing process from running.

PS master:\> Suspend-SearchIndex -Name sitecore_master_index

EXAMPLE 2

The following suspends (pauses) the indexing process from running.

PS master:\> Get-SearchIndex -Name sitecore_master_index | Suspend-SearchIndex

Related Topics
Initialize-SearchIndex
Stop-SearchIndex
Resume-SearchIndex
Get-SearchIndex
https://github.com/SitecorePowerShell/Console/

Suspend-SearchIndex 419
Sitecore PowerShell Extensions

Test-Account
Determines if the Sitecore role or user account exists.

Syntax
Test-Account [-Identity] <AccountIdentity> [-AccountType <String>]

Detailed Description
The Test-Account command determines if a Sitecore role or user account exists.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

Role or User name including domain. If no domain is specified - 'sitecore' will be used as the default value

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-AccountType <String>

Specifies which account to check existence.

All
Role
User

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs

Test-Account 420
Sitecore PowerShell Extensions

The input type is the type of the objects that you can pipe to the cmdlet.

System.String

Outputs
The output type is the type of the objects that the cmdlet emits.

True or False

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Test-Account -Identity Michael

True

Related Topics
https://github.com/SitecorePowerShell/Console/

Test-Account 421
Sitecore PowerShell Extensions

Test-ItemAcl
Tests a specific access right for a specified user against the provided item

Syntax
Test-ItemAcl -Item

Test-ItemAcl -Item -AccessRight -Identity

Test-ItemAcl -Path

Test-ItemAcl -Path -AccessRight -Identity

Test-ItemAcl -Id

Test-ItemAcl -Id [-Database ] -AccessRight -Identity

Detailed Description
Checks if a user can perform an operation on an item.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Item <Item>

The item to be tested against.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Path <String>

Path to the item to be tested against.

Aliases

Required? true

Position? named

Default Value

Test-ItemAcl 422
Sitecore PowerShell Extensions

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the item to be tested against. Requires the Database parameter to be specified.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be fetched with Id parameter.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-AccessRight <String>

The access right to grand or deny. Well known rights are:

field:read - "Field Read" - controls whether an account can read a specific field on an item..
field:write - "Field Write" - controls whether an account can update a specific field on an item.

item:read - "Read" - controls whether an account can see an item in the content tree and/or on the published Web site,
including all of its properties and field values.

item:write - "Write" - controls whether an account can update field values. The write access right requires the read
access right and field read and field write access rights for individual fields (field read and field write are allowed by
default).
item:rename - "Rename" - controls whether an account can change the name of an item. The rename access right
requires the read access right.
item:create - "Create" - controls whether an account can create child items. The create access right requires the read
access right.
item:delete - "Delete" - Delete right for items. controls whether an account can delete an item. The delete access right
requires the read access right Important! The Delete command also deletes all child items, even if the account has
been denied Delete rights for one or more of the subitems.
item:admin - "Administer" - controls whether an account can configure access rights on an item. The administer access
right requires the read and write access rights.
language:read - "Language Read" - controls whether a user can read a specific language version of items.

Test-ItemAcl 423
Sitecore PowerShell Extensions

language:write - "Language Write" - controls whether a user can update a specific language version of items.
site:enter - controls whether a user can access a specific site.
insert:show - "Show in Insert" - Determines if the user can see the insert option
workflowState:delete - "Workflow State Delete" - controls whether a user can delete items which are currently
associated with a specific workflow state.
workflowState:write - "Workflow State Write" - controls whether a user can update items which are currently associated
with a specific workflow state.
workflowCommand:execute - "Workflow Command Execute" - controls whether a user is shown specific workflow
commands.
profile:customize - "Customize Profile Key Values" - The right to input out of range values of profile keys, that belong to
this profile.
bucket:makebucket - "Create Bucket" - convert item to bucket.
bucket:unmake - "Revert Bucket" - convert item back from bucket.
remote:fieldread - "Field Remote Read" - Field Read right for remoted clients.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Identity <AccountIdentity>

User name including domain for which the access rule is being created. If no domain is specified - 'sitecore' will be used as
the default domain.

Specifies the Sitecore user by providing one of the following values.

Local Name
Example: adam
Fully Qualified Name
Example: sitecore\adam

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Test-ItemAcl 424
Sitecore PowerShell Extensions

Outputs
The output type is the type of the objects that the cmdlet emits.

System.Boolea

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

Denies the "sitecore\author2" user renaming the descendants of the Home item. The security info is created prior to adding
it to the item. The item is delivered to the Add-ItemAcl from the pipeline and returned to the pipeline after processing due to
the -PassThru parameter.

PS master:\> $acl = New-ItemAcl -AccessRight item:rename -PropagationType Descendants -SecurityPermission AllowAccess -Identity
PS master:\> Get-Item -Path master:\content\home | Set-ItemAcl -AccessRules $acl

# Assuming the Home item has one child and author2 does not have rename rights granted above in the tree and is not an administrator
PS master:\> Get-Item master:\content\home | Test-ItemAcl -Identity "sitecore\author2" -AccessRight item:rename
False

PS master:\> Get-ChildItem master:\content\home | Test-ItemAcl -Identity "sitecore\author2" -AccessRight item:rename


True

Related Topics
https://github.com/SitecorePowerShell/Console/
Add-ItemAcl
Clear-ItemAcl
Get-ItemAcl
New-ItemAcl
Set-ItemAcl
https://sdn.sitecore.net/upload/sitecore6/security_administrators_cookbook_a4.pdf
https://sdn.sitecore.net/upload/sitecore6/61/security_reference-a4.pdf
https://sdn.sitecore.net/upload/sitecore6/64/content_api_cookbook_sc64_and_later-a4.pdf
http://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2013/01/sitecore-security-access-
rights.aspx
https://briancaos.wordpress.com/2009/10/02/assigning-security-to-items-in-sitecore-6-programatically/

Test-ItemAcl 425
Sitecore PowerShell Extensions

Test-Rule
Tests item against a sitecore serialized rules engine rule set.

Syntax
Test-Rule [-Rule ] [-InputObject ] [-RuleDatabase ]

Detailed Description
Tests item or a stream of items against a sitecore serialized rules engine rule set.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Rule <String>

Serialized sitecore rules engine rule. Such rules can be read from rule fields or created by user with the Read-Variable
cmdlet.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-InputObject <PSObject>

Item to be tested

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-RuleDatabase <String>

Name of the database from which rules are pulled.

Aliases

Test-Rule 426
Sitecore PowerShell Extensions

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

System.Boolea

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Specifies a rule as "items that have layout" and runs the rule againste all items under the ome Item

$rule = '<ruleset>
<rule uid="{9CF02118-F189-49C4-9F2B-6698D64ACF23}">
<conditions>
<condition id="{A45DBBAE-F74F-4EFE-BBD5-24395E0AF945}" uid="ED10990E15EB4E1E8FCFD33F441588A1" />
</conditions>
</rule>
</ruleset>'

Get-ChildItem master:\content\Home -Recurse | ? { Test-Rule -InputObject $_ -Rule $rule -RuleDatabase master}

EXAMPLE 2

Asks user for the rule and root under which items should be filtered, and lists all items fulfilling the rule under the selected
path

$rule = '<ruleset></ruleset>'
$root = Get-Item master:\content\home\

$result = Read-Variable -Parameters `


@{Name="root"; title="Items under"; Tooltip="Items under the selected item will be considered for evaluation"}, `
@{Name="rule"; Editor="rule"; title="Filter rules"; Tooltip="Only items conforming to this rule will be displayed."} `

Test-Rule 427
Sitecore PowerShell Extensions

-Description "This dialog shows editor how a rule can be taken from an item and edited using the Read-Variable cmdlet."
-Title "Sample rule editing" -Width 600 -Height 600 -ShowHints

if($result -eq "cancel"){


exit;
}

Get-ChildItem $root.ProviderPath | ? { Test-Rule -InputObject $_ -Rule $rule -RuleDatabase master}

Related Topics
https://github.com/SitecorePowerShell/Console/

Test-Rule 428
Sitecore PowerShell Extensions

Unlock-Item
Unlocks the specified Sitecore item.

Syntax
Unlock-Item [-Item] [-PassThru]

Unlock-Item [-Path] [-PassThru]

Unlock-Item -Id [-Database ] [-PassThru]

Detailed Description
The Unlock-Item command unlocks the item specified with parameters.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-PassThru <SwitchParameter>

Passes the unlocked item back into the pipeline.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

The item to be unlocked.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Unlock-Item 429
Sitecore PowerShell Extensions

Path to the item to be unlocked - can work with Language parameter to specify the language other than current session
language.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the item to be unlocked.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be fetched with Id parameter.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

can be piped from another cmdlet* Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Only if -PassThru is used* Sitecore.Data.Items.Item

Unlock-Item 430
Sitecore PowerShell Extensions

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Unlock the Home item providing its path

PS master:\> Unlock-Item -Path master:\content\home

EXAMPLE 2

Unlock the Home item providing it from the pipeline and passing it back to the pipeline

PS master:\> Get-Item -Path master:\content\home | Unlock-Item -PassThru

Name Children Languages Id TemplateName


---- -------- --------- -- ------------
Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item

Related Topics
https://github.com/SitecorePowerShell/Console/
Lock-Item
Get-Item

Unlock-Item 431
Sitecore PowerShell Extensions

Unlock-User
Unlocks a Sitecore user using the specified criteria.

Syntax
Unlock-User [-Identity]

Unlock-User -Instance

Detailed Description
The Unlock-User command gets a user and unlocks the account in Sitecore.

The Identity parameter specifies the Sitecore user to get. You can specify a user by its local name or fully qualified name.
You can also specify user object variable, such as $<user>.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Identity <AccountIdentity>

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Instance <User>

Specifies the Sitecore user by providing an instance of a user.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

Inputs

Unlock-User 432
Sitecore PowerShell Extensions

The input type is the type of the objects that you can pipe to the cmdlet.

System.String Represents the identity of a user.

Sitecore.Security.Accounts.User One or more user instances.

Outputs
The output type is the type of the objects that the cmdlet emits.

None.

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

PS master:\> Unlock-User -Identity michael

EXAMPLE 2

PS master:\> Get-User -Filter * | Unlock-User

Related Topics
https://github.com/SitecorePowerShell/Console/
Get-User
New-User
Remove-User
Set-User

Unlock-User 433
Sitecore PowerShell Extensions

Unprotect-Item
Unprotects the specified Sitecore item.

Syntax
Unprotect-Item [-Item] [-PassThru]

Unprotect-Item [-Path] [-PassThru]

Unprotect-Item -Id [-Database ] [-PassThru]

Detailed Description
The Unprotect-Item command removes protection from the item provided to it.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-PassThru <SwitchParameter>

Passes the unprotected item back into the pipeline.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Item <Item>

The item to be unprotected.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? true (ByValue, ByPropertyName)

Accept Wildcard Characters? false

-Path <String>

Unprotect-Item 434
Sitecore PowerShell Extensions

Path to the item to be unprotected - can work with Language parameter to specify the language other than current session
language.

Aliases

Required? true

Position? 1

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Id <String>

Id of the item to be unprotected.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Database <String>

Database containing the item to be fetched with Id parameter.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

can be piped from another cmdlet* Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

Only if -PassThru is used* Sitecore.Data.Items.Item

Unprotect-Item 435
Sitecore PowerShell Extensions

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Unprotect the Home item providing its path

PS master:\> Unprotect-Item -Path master:\content\home

EXAMPLE 2

Unprotect the Home item providing it from the pipeline and passing it back to the pipeline

PS master:\> Get-Item -Path master:\content\home | Unprotect-Item -PassThru

Name Children Languages Id TemplateName


---- -------- --------- -- ------------
Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item

Related Topics
https://github.com/SitecorePowerShell/Console/
Protect-Item
Get-Item

Unprotect-Item 436
Sitecore PowerShell Extensions

Update-ListView
Updates List View (created by Show-ListView) data.

Syntax
Update-ListView -Data [-Property ]

Detailed Description
This command updates the data displayed by List View that called the script the command is part of. Calling this command
makes sense only when it's being used in script exposed as Action on the Show-ListView window. For example the main
script might be listing all logged in users. And than the "Kick" action might be closing sessions for selected rows and
refreshing the List view to take into account that the sessions are no longer connected. Another example is Task Manager
script you can find in Toolbox. The List View shown by it shows tasks and when they were last run. If you choose to execute
a task the Update-ListView command will later be called to update the data to account for the fact that the task's "Last Run"
date has been updated.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Data <Object>

Data that you want to be sent to the list view for display.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Property <Object[]>

If this parameter is specified - it allows for modifying the columns shown in the list view, otherwise the columns stay the
same as in the original view.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Update-ListView 437
Sitecore PowerShell Extensions

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

Sitecore.Data.Items.Item

Outputs
The output type is the type of the objects that the cmdlet emits.

System.String

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

This example consists of 2 scripts - a report that shows a list view and the second one that updates the list view from an
action.

# THE INITIAL SCRIPT showing the list of tasks in a list view


# This script does not yet make use of Update-ListView but tests the state for actions to be performed

Import-Function "Edit-TaskSchedule"

# Get all the items recursively where the TemplateName equals "Schedule".
Get-ChildItem -Path master:\system\Tasks\Schedules -Recurse | Where-Object { $_.TemplateName -eq "Schedule" } |
Show-ListView -Property @{Label="Name"; Expression={ $_.DisplayName } },
@{Label="Last Run"; Expression={ $_."Last Run" } },
@{Label="Command"; Expression={ $_.Database.GetItem($_.Command).Name } },
@{Label="From"; Expression={ Parse-TaskSchedule $_ "from"} },
@{Label="To"; Expression={ Parse-TaskSchedule $_ "to"} },
@{Label="On Week Days"; Expression={ Parse-TaskSchedule $_ "strWeekdays" } },
@{Label="Run Every"; Expression={ Parse-TaskSchedule $_ "interval" } } `
-Title "Task Manager"
Close-Window

# NOW THE PROPER ACTION SCRIPT

# The Execute task action that (at the very end) updates the list with the latest tasks data
foreach($sheduleItem in $resultSet)
{
$shedule = New-Object -TypeName "Sitecore.Tasks.ScheduleItem" -ArgumentList $sheduleItem
$shedule.Execute();
}
Import-Function "Edit-TaskSchedule"
Get-ChildItem -Path master:\system\Tasks\Schedules -Recurse | Where-Object { $_.TemplateName -eq "Schedule" } | Update-ListView

Related Topics
Show-ListView

Update-ListView 438
Sitecore PowerShell Extensions

https://github.com/SitecorePowerShell/Console/

Update-ListView 439
Sitecore PowerShell Extensions

Wait-ScriptSession
Suppresses script execution command prompt until one or all of the script sessions provided are complete.

Syntax
Wait-ScriptSession -Id <String[]> [-Timeout <Int32>] [-Any]

Wait-ScriptSession -Session <ScriptSession[]> [-Timeout <Int32>] [-Any]

Detailed Description
The Wait-ScriptSession cmdlet waits for script session to complete before it displays the command prompt or allows the
script to continue. You can wait until any script session is complete, or until all script sessions are complete, and you can
set a maximum wait time for the script session. When the commands in the script session are complete, Wait-ScriptSession
displays the command prompt and returns a script session object so that you can pipe it to another command. You can use
Wait-ScriptSession cmdlet to wait for script sessions, such as those that were started by using the Start-ScriptSession
cmdlet.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Timeout <Int32>

The maximum time to wait for all the other running script sessions to complete.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Any <SwitchParameter>

Returns control to the script or displays the command prompt (and returns the ScriptSession object) when any script
session completes. By default, Wait-ScriptSession waits until all of the specified jobs are complete before displaying the
prompt.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Wait-ScriptSession 440
Sitecore PowerShell Extensions

Accept Wildcard Characters? false

-Id <String[]>

Id(s) of the session to be stopped.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Session <ScriptSession[]>

Session(s) to be stopped.

Aliases

Required? true

Position? named

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

System.String or Cognifide.PowerShell.Core.Host.ScriptSessio

Outputs
The output type is the type of the objects that the cmdlet emits.

Cognifide.PowerShell.Core.Host.ScriptSessio

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

Wait-ScriptSession 441
Sitecore PowerShell Extensions

PS master:\> Wait-ScriptSession -Id "My Background Script Session"

Related Topics
Get-ScriptSession
Receive-ScriptSession
Remove-ScriptSession
Start-ScriptSession
Stop-ScriptSession
http://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/
https://git.io/spe

Wait-ScriptSession 442
Sitecore PowerShell Extensions

Write-Log
Writes text to the Sitecore event log.

Syntax
Write-Log [[-Object] ] [-Separator ] [-Log ]

Detailed Description
The Write-Log command writes text to the Sitecore event log with the specified logging level.

2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Object <Object>

Specifies the object to write to the log.

Aliases

Required? false

Position? 1

Default Value

Accept Pipeline Input? true (ByValue)

Accept Wildcard Characters? false

-Separator <Object>

Strings the output together with the specified text.

Aliases

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

-Log <LogNotificationLevel>

Specifies the Sitecore logging level.

Aliases

Write-Log 443
Sitecore PowerShell Extensions

Required? false

Position? named

Default Value

Accept Pipeline Input? false

Accept Wildcard Characters? false

Inputs
The input type is the type of the objects that you can pipe to the cmdlet.

System.String Represents the identity of a role.

Outputs
The output type is the type of the objects that the cmdlet emits.

None.

Notes
Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE

PS master:\> Write-Log "Information."

Related Topics
https://github.com/SitecorePowerShell/Console/

Write-Log 444
Sitecore PowerShell Extensions

Glossary

Add-ItemAcl
SPE Cmdlet - Adds new access rule to an item allowing for the item to have the access granted or denied for a provided
role or user.

12.1. Add-ItemAcl 12.5. Clear-ItemAcl 12.23. Get-ItemAcl 12.64. New-ItemAcl 12.93. Set-ItemAcl
12.113. Test-ItemAcl

Add-ItemLanguage
SPE Cmdlet - Creates a version of the item in a new language based on an existing language version.

12.2. Add-ItemLanguage 12.79. Remove-ItemLanguage

Add-Rendering
SPE Cmdlet - Adds a rendering to a chosen device for the presentation of an item.

12.3. Add-Rendering 12.30. Get-Layout 12.31. Get-LayoutDevice 12.34. Get-Rendering


12.69. New-Rendering 12.80. Remove-Rendering 12.87. Reset-Layout 12.94. Set-Layout
12.95. Set-Rendering

Add-RoleMember
SPE Cmdlet - Adds one or more Sitecore users to the specified role.

12.4. Add-RoleMember 12.36. Get-RoleMember 12.82. Remove-RoleMember

Clear-Item
Windows Cmdlet - Deletes the contents of an item, but does not delete the item.

Clear-ItemAcl
SPE Cmdlet - Removes all security information from the item specified.

12.1. Add-ItemAcl 12.5. Clear-ItemAcl 12.23. Get-ItemAcl 12.64. New-ItemAcl 12.93. Set-ItemAcl
12.113. Test-ItemAcl

Glossary 445
Sitecore PowerShell Extensions

CLI
Command-line interface

2.1. Command Line Console 0. Introduction

Close-Window
SPE Cmdlet - Closes the runner job window after the script completes.

12.6. Close-Window

ConvertFrom-CliXml
SPE Cmdlet - Imports a CliXml string with data that represents Microsoft .NET objects and creates the objects within
PowerShell.

12.7. ConvertFrom-CliXml 12.9. ConvertTo-CliXml

ConvertFrom-ItemClone
SPE Cmdlet - Converts an item from a clone to a fully independent item.

12.8. ConvertFrom-ItemClone 12.24. Get-ItemClone 12.65. New-ItemClone

ConvertTo-Bucket
SPE Cmdlet - ConvertTo-Bucket [-Item] []

ConvertTo-CliXml
SPE Cmdlet - Exports Microsoft .NET objects froms PowerShell to a CliXml string.

12.7. ConvertFrom-CliXml 12.9. ConvertTo-CliXml

Copy-Item
Windows Cmdlet - Copies an item from one location to another.

3. Working with Items

Glossary 446
Sitecore PowerShell Extensions

Disable-User
SPE Cmdlet - Disables the specified Sitecore user.

12.10. Disable-User

Enable-User
SPE Cmdlet - Enables the specified Sitecore user.

12.11. Enable-User

Expand-Token
SPE Cmdlet - Expands tokens in fields for items.

12.12. Expand-Token

Export-Item
SPE Cmdlet - Exports (serializes) the Sitecore item to the filesystem.

12.13. Export-Item 12.15. Export-Role 12.17. Export-User 12.33. Get-Preset 12.47. Import-Item

Export-Package
SPE Cmdlet - Exports a Sitecore installation package and project.

12.14. Export-Package 12.32. Get-Package 12.52. Install-Package 12.61. New-ExplicitFileSource


12.62. New-ExplicitItemSource 12.63. New-FileSource 12.66. New-ItemSource 12.68. New-Package

Export-Role
SPE Cmdlet - Exports (serializes) Sitecore roles to the filesystem on the server.

12.15. Export-Role 12.17. Export-User

Export-UpdatePackage
SPE Cmdlet - Exports a Sitecore update package containing a serialization diff list.

12.16. Export-UpdatePackage 12.43. Get-UpdatePackageDiff 12.53. Install-UpdatePackage

Glossary 447
Sitecore PowerShell Extensions

Export-User
SPE Cmdlet - Export (serialize) a Sitecore user to the filesystem on the server.

12.15. Export-Role 12.17. Export-User

Find-Item
SPE Cmdlet - Finds items using the Sitecore Content Search API.

12.18. Find-Item 12.50. Initialize-Item

Get-Archive
SPE Cmdlet - Returns Sitecore database archives.

12.19. Get-Archive

Get-Cache
SPE Cmdlet - Retrieves a Sitecore cache.

12.20. Get-Cache

Get-Database
SPE Cmdlet - Retrieves a Sitecore Database.

12.21. Get-Database

Get-Domain
SPE Cmdlet - Gets all available domains or the specified domain.

12.60. New-Domain 12.22. Get-Domain

Get-Index
SPE Cmdlet - Returns Sitecore database indices.

Get-Item

Glossary 448
Sitecore PowerShell Extensions

Windows Cmdlet - Gets the item at the specified location.

12.1. Add-ItemAcl 12.5. Clear-ItemAcl 12.7. ConvertFrom-CliXml 12.9. ConvertTo-CliXml


12.12. Expand-Token 12.13. Export-Item 12.14. Export-Package 12.18. Find-Item 12.21. Get-Database
12.24. Get-ItemClone 12.25. Get-ItemField 12.26. Get-ItemReference 12.27. Get-ItemReferrer
12.28. Get-ItemTemplate 12.34. Get-Rendering 12.40. Get-SpeModule 12.50. Initialize-Item
12.55. Invoke-ShellCommand 12.56. Invoke-Workflow 12.57. Lock-Item 12.62. New-ExplicitItemSource
12.64. New-ItemAcl 12.65. New-ItemClone 12.66. New-ItemSource 12.68. New-Package
12.73. Protect-Item 12.74. Publish-Item 12.75. Read-Variable 12.76. Receive-File 12.86. Reset-ItemField
12.90. Send-File 12.93. Set-ItemAcl 12.95. Set-Rendering 12.101. Show-FieldEditor 12.102. Show-Input
12.103. Show-ListView 12.107. Start-ScriptSession 12.113. Test-ItemAcl 12.114. Test-Rule
12.115. Unlock-Item 12.117. Unprotect-Item 2.3. Interactive Dialogs 7. Remoting 3. Working with Items

Get-ItemAcl
SPE Cmdlet - Retrieves security access rules from an item.

12.1. Add-ItemAcl 12.5. Clear-ItemAcl 12.23. Get-ItemAcl 12.64. New-ItemAcl 12.71. New-SecuritySource
12.93. Set-ItemAcl 12.113. Test-ItemAcl

Get-ItemByUri
SPE Cmdlet - This command has been obsoleted - use "Get-Item -Uri" instead.

Get-ItemClone
SPE Cmdlet - Returns all the clones for the specified item.

12.8. ConvertFrom-ItemClone 12.24. Get-ItemClone 12.65. New-ItemClone

Get-ItemField
SPE Cmdlet - Retrieves item fields as either names or fields or template fields.

12.25. Get-ItemField 12.28. Get-ItemTemplate 12.86. Reset-ItemField

Get-ItemReference
SPE Cmdlet - Returns all the items linked to the specified item..

12.26. Get-ItemReference 12.27. Get-ItemReferrer

Get-ItemReferrer

Glossary 449
Sitecore PowerShell Extensions

SPE Cmdlet - Returns all the items referring to the specified item.

12.26. Get-ItemReference 12.27. Get-ItemReferrer 12.103. Show-ListView

Get-ItemTemplate
SPE Cmdlet - Returns the item template and its base templates.

12.25. Get-ItemField 12.28. Get-ItemTemplate 12.86. Reset-ItemField

Get-ItemWorkflowEvent
SPE Cmdlet - Returns entries from the history store notifying of workflow state change for the specified item.

12.29. Get-ItemWorkflowEvent 12.67. New-ItemWorkflowEvent

Get-Layout
SPE Cmdlet - Returns the layout for the specified item.

12.3. Add-Rendering 12.30. Get-Layout 12.31. Get-LayoutDevice 12.34. Get-Rendering


12.69. New-Rendering 12.80. Remove-Rendering 12.87. Reset-Layout 12.94. Set-Layout
12.95. Set-Rendering

Get-LayoutDevice
SPE Cmdlet - Returns the layout for the specified device.

12.3. Add-Rendering 12.30. Get-Layout 12.31. Get-LayoutDevice 12.34. Get-Rendering


12.69. New-Rendering 12.80. Remove-Rendering 12.87. Reset-Layout 12.94. Set-Layout
12.95. Set-Rendering

Get-Package
SPE Cmdlet - Loads the package definition (xml) from the specified path.

12.14. Export-Package 12.32. Get-Package 12.52. Install-Package 12.61. New-ExplicitFileSource


12.62. New-ExplicitItemSource 12.63. New-FileSource 12.66. New-ItemSource 12.68. New-Package

Get-Preset
SPE Cmdlet - Returns a serialization preset for use with Export-Item.

12.13. Export-Item 12.33. Get-Preset 12.47. Import-Item

Glossary 450
Sitecore PowerShell Extensions

Get-Rendering
SPE Cmdlet - Returns a RenderingDefinition for an item using the filtering parameters.

12.3. Add-Rendering 12.30. Get-Layout 12.31. Get-LayoutDevice 12.34. Get-Rendering


12.69. New-Rendering 12.80. Remove-Rendering 12.87. Reset-Layout 12.94. Set-Layout
12.95. Set-Rendering

Get-Role
SPE Cmdlet - Returns one or more Sitecore roles using the specified criteria.

12.35. Get-Role 12.36. Get-RoleMember 12.71. New-SecuritySource 12.81. Remove-Role

Get-RoleMember
SPE Cmdlet - Returns the Sitecore users in the specified role.

12.4. Add-RoleMember 12.35. Get-Role 12.36. Get-RoleMember 12.82. Remove-RoleMember

Get-ScriptSession
SPE Cmdlet - Returns the list of PowerShell Extension Sessions running in the background.

12.37. Get-ScriptSession 12.77. Receive-ScriptSession 12.83. Remove-ScriptSession


12.107. Start-ScriptSession 12.109. Stop-ScriptSession 12.119. Wait-ScriptSession

Get-SearchIndex
SPE Cmdlet - Returns sitecore Search indices.

12.38. Get-SearchIndex 12.51. Initialize-SearchIndex 12.89. Resume-SearchIndex 12.110. Stop-SearchIndex


12.111. Suspend-SearchIndex

Get-Session
SPE Cmdlet - Returns one or more Sitecore user sessions using the specified criteria.

12.39. Get-Session 12.84. Remove-Session

Get-SpeModule
SPE Cmdlet - Returns the object that describes a Sitecore PowerShell Extensions Module

Glossary 451
Sitecore PowerShell Extensions

12.40. Get-SpeModule 12.41. Get-SpeModuleFeatureRoot

Get-SpeModuleFeatureRoot
SPE Cmdlet - Returns the library item or path to the library where scripts for a particular integration point should be located
for a specific module.

12.40. Get-SpeModule 12.41. Get-SpeModuleFeatureRoot

Get-TaskSchedule
SPE Cmdlet - Returns one or more task schedule items using the specified criteria.

12.42. Get-TaskSchedule 12.108. Start-TaskSchedule

Get-UpdatePackageDiff
SPE Cmdlet - Performs a diff operation between the Source and taget path akin to Sitecore Courier. The diff is the
difference that takes the content of Source folder and transforms it to Target. IMPORTANT! This fun ctionality requires
changes to web.config file on your sitecore server to work. Please consult the first Example.

12.16. Export-UpdatePackage 12.43. Get-UpdatePackageDiff 12.53. Install-UpdatePackage

Get-User
SPE Cmdlet - Returns one or more Sitecore users using the specified criteria.

12.17. Export-User 12.44. Get-User 12.49. Import-User 12.71. New-SecuritySource 12.72. New-User
12.85. Remove-User 12.96. Set-User 12.97. Set-UserPassword 12.116. Unlock-User

Get-UserAgent
SPE Cmdlet - Returns the current user's browser user agent.

12.45. Get-UserAgent

IIS
Internet Information Services

9. Security

Glossary 452
Sitecore PowerShell Extensions

Import-Function
SPE Cmdlet - Imports a function script from the script library's "Functions" folder.

12.46. Import-Function 12.54. Invoke-Script

Import-Item
SPE Cmdlet - Imports (deserializes) the specified path from the filesystem on the server as a Sitecore item.

12.13. Export-Item 12.15. Export-Role 12.17. Export-User 12.47. Import-Item

Import-Role
SPE Cmdlet - Imports (deserializes) Sitecore roles from the Sitecore server filesystem.

12.15. Export-Role 12.17. Export-User 12.48. Import-Role

Import-User
SPE Cmdlet - Imports (deserializes) Sitecore users from the Sitecore server filesystem.

12.15. Export-Role 12.17. Export-User 12.49. Import-User

Initialize-Item
SPE Cmdlet - Initializes items with the PowerShell automatic properties for each field.

12.18. Find-Item 12.50. Initialize-Item

Install-Package
SPE Cmdlet - Installs a Sitecore package from the specified path.

12.52. Install-Package

Install-UpdatePackage
SPE Cmdlet - Installs a Sitecore update package from the specified path.

12.14. Export-Package 12.16. Export-UpdatePackage 12.32. Get-Package 12.43. Get-UpdatePackageDiff


12.52. Install-Package 12.53. Install-UpdatePackage 12.61. New-ExplicitFileSource
12.62. New-ExplicitItemSource 12.63. New-FileSource 12.66. New-ItemSource 12.68. New-Package

Glossary 453
Sitecore PowerShell Extensions

Invoke-Item
Windows Cmdlet - Performs the default action on the specified item.

Invoke-Script
SPE Cmdlet - Executes a script from Sitecore PowerShell Extensions Script Library. This command used to be named
Execute-Script - a matching alias added for compatibility with older scripts.

12.46. Import-Function 12.54. Invoke-Script

Invoke-ShellCommand
SPE Cmdlet - Executes Sitecore Shell command for an item. This command used to be named Execute-ShellCommand - a
matching alias added for compatibility with older scripts.

12.55. Invoke-ShellCommand

Invoke-Workflow
SPE Cmdlet - Executes Workflow action for an item. This command used to be named Execute-Workflow - a matching alias
added for compatibility with older scripts.

12.56. Invoke-Workflow

ISE
Integrated Scripting Environment

2. Interfaces 12.45. Get-UserAgent 12.91. Send-SheerMessage 12.107. Start-ScriptSession 0. Introduction


5. Modules 10. Releases 7. Remoting 2.2. Integrated Scripting Environment 9. Security 4. Toolbox
11. Troubleshooting 3. Working with Items

Lock-Item
SPE Cmdlet - Locks the Sitecore item by the current or specified user.

12.57. Lock-Item 12.115. Unlock-Item 10. Releases

Login-User
SPE Cmdlet - Logs a user in and performs further script instructions in the context of the user.

Glossary 454
Sitecore PowerShell Extensions

12.58. Login-User

Logout-User
SPE Cmdlet - Logs the current user out.

12.59. Logout-User

Move-Item
Windows Cmdlet - Moves an item from one location to another.

3. Working with Items

New-Domain
SPE Cmdlet - Creates a new domain with the specified name.

12.60. New-Domain 12.22. Get-Domain

New-ExplicitFileSource
SPE Cmdlet - Creates new File source that can be added to a Sitecore package.

12.14. Export-Package 12.32. Get-Package 12.52. Install-Package 12.61. New-ExplicitFileSource


12.62. New-ExplicitItemSource 12.63. New-FileSource 12.66. New-ItemSource 12.68. New-Package

New-ExplicitItemSource
SPE Cmdlet - Creates new Explicit Item Source that can be added to a Sitecore package.

12.14. Export-Package 12.32. Get-Package 12.52. Install-Package 12.61. New-ExplicitFileSource


12.62. New-ExplicitItemSource 12.63. New-FileSource 12.66. New-ItemSource 12.68. New-Package

New-FileSource
SPE Cmdlet - Creates new File source that can be added to a Sitecore package.

12.14. Export-Package 12.32. Get-Package 12.52. Install-Package 12.61. New-ExplicitFileSource


12.62. New-ExplicitItemSource 12.63. New-FileSource 12.66. New-ItemSource 12.68. New-Package

New-Item
Glossary 455
Sitecore PowerShell Extensions

Windows Cmdlet - Creates a new item.

12.2. Add-ItemLanguage 12.65. New-ItemClone 3. Working with Items

New-ItemAcl
SPE Cmdlet - Creates a new access rule for use with Set-ItemAcl and Add-ItemAcl cmdlets.

12.1. Add-ItemAcl 12.5. Clear-ItemAcl 12.23. Get-ItemAcl 12.64. New-ItemAcl 12.93. Set-ItemAcl
12.113. Test-ItemAcl

New-ItemClone
SPE Cmdlet - Creates a new item clone based on the item provided.

12.8. ConvertFrom-ItemClone 12.24. Get-ItemClone 12.65. New-ItemClone

New-ItemSource
SPE Cmdlet - Creates new Item source that can be added to a Sitecore package.

12.14. Export-Package 12.32. Get-Package 12.52. Install-Package 12.61. New-ExplicitFileSource


12.62. New-ExplicitItemSource 12.63. New-FileSource 12.66. New-ItemSource 12.68. New-Package

New-ItemWorkflowEvent
SPE Cmdlet - Creates new entry in the history store notifying of workflow state change.

12.29. Get-ItemWorkflowEvent 12.67. New-ItemWorkflowEvent

New-Package
SPE Cmdlet - Creates a new Sitecore install package object.

12.14. Export-Package 12.32. Get-Package 12.52. Install-Package 12.61. New-ExplicitFileSource


12.62. New-ExplicitItemSource 12.63. New-FileSource 12.66. New-ItemSource 12.68. New-Package

New-Rendering
SPE Cmdlet - Creates new rendering definition that can later be added to an item.

12.3. Add-Rendering 12.30. Get-Layout 12.31. Get-LayoutDevice 12.34. Get-Rendering


12.69. New-Rendering 12.80. Remove-Rendering 12.87. Reset-Layout 12.94. Set-Layout
12.95. Set-Rendering

Glossary 456
Sitecore PowerShell Extensions

New-SecuritySource
SPE Cmdlet - Creates new User & Role source that can be added to a Sitecore package.

12.71. New-SecuritySource

New-User
SPE Cmdlet - Creates a new Sitecore user.

12.44. Get-User 12.72. New-User 12.85. Remove-User 12.96. Set-User 12.116. Unlock-User

Protect-Item
SPE Cmdlet - Protects the Sitecore item.

12.73. Protect-Item 12.117. Unprotect-Item

Publish-Item
SPE Cmdlet - Publishes a Sitecore item.

12.74. Publish-Item

Read-Variable
SPE Cmdlet - Prompts user to provide values for variables required by the script to perform its operation.

12.75. Read-Variable 12.98. Show-Alert 12.99. Show-Application 12.100. Show-Confirm


12.101. Show-FieldEditor 12.102. Show-Input 12.103. Show-ListView 12.104. Show-ModalDialog
12.105. Show-Result 12.106. Show-YesNoCancel 12.114. Test-Rule

Receive-File
SPE Cmdlet - Shows a dialog to users allowing to upload files to either server file system or items in media library.

12.76. Receive-File

Remove-Domain
SPE Cmdlet - Removes the specified domain.

12.60. New-Domain 12.22. Get-Domain 12.78. Remove-Domain

Glossary 457
Sitecore PowerShell Extensions

Remove-Item
Windows Cmdlet - Deletes the specified items.

12.79. Remove-ItemLanguage 3. Working with Items

Remove-ItemLanguage
SPE Cmdlet - Removes Language from a single item or a branch of items

12.2. Add-ItemLanguage 12.79. Remove-ItemLanguage

Remove-Rendering
SPE Cmdlet - Removes renderings from an item.

12.3. Add-Rendering 12.30. Get-Layout 12.31. Get-LayoutDevice 12.34. Get-Rendering


12.69. New-Rendering 12.80. Remove-Rendering 12.87. Reset-Layout 12.94. Set-Layout
12.95. Set-Rendering

Remove-RoleMember
SPE Cmdlet - Removes one or more Sitecore users from the specified role.

12.4. Add-RoleMember 12.36. Get-RoleMember 12.82. Remove-RoleMember

Remove-ScriptSession
SPE Cmdlet - Removes a persistent Script Session from memory.

12.37. Get-ScriptSession 12.77. Receive-ScriptSession 12.83. Remove-ScriptSession


12.107. Start-ScriptSession 12.109. Stop-ScriptSession 12.119. Wait-ScriptSession

Remove-Session
SPE Cmdlet - Removes one or more Sitecore user sessions.

12.39. Get-Session 12.84. Remove-Session

Remove-User
SPE Cmdlet - Removes the Sitecore user.

Glossary 458
Sitecore PowerShell Extensions

12.44. Get-User 12.72. New-User 12.85. Remove-User 12.96. Set-User 12.116. Unlock-User

Rename-Item
Windows Cmdlet - Renames an item in a Windows PowerShell provider namespace.

11. Troubleshooting

Restart-Application
SPE Cmdlet - Restarts the Sitecore Application pool.

12.88. Restart-Application

Send-File
SPE Cmdlet - Allows users to download files from server and file items from media library.

12.90. Send-File

Send-SheerMessage
SPE Cmdlet - Sends a sheer message to the app in which context the script is executing.

12.91. Send-SheerMessage

Set-HostProperty
SPE Cmdlet - Sets the current host property.

12.92. Set-HostProperty

Set-Item
Windows Cmdlet - Changes the value of an item to the value specified in the command.

Set-ItemAcl
SPE Cmdlet - Sets new security information on an item overwriting the previous settings.

12.1. Add-ItemAcl 12.5. Clear-ItemAcl 12.23. Get-ItemAcl 12.64. New-ItemAcl 12.93. Set-ItemAcl
12.113. Test-ItemAcl

Glossary 459
Sitecore PowerShell Extensions

Set-Layout
SPE Cmdlet - Sets item layout for a device.

12.3. Add-Rendering 12.30. Get-Layout 12.31. Get-LayoutDevice 12.34. Get-Rendering


12.69. New-Rendering 12.80. Remove-Rendering 12.87. Reset-Layout 12.94. Set-Layout
12.95. Set-Rendering

Set-Rendering
SPE Cmdlet - Updates rendering with new values.

12.3. Add-Rendering 12.30. Get-Layout 12.31. Get-LayoutDevice 12.34. Get-Rendering


12.69. New-Rendering 12.80. Remove-Rendering 12.87. Reset-Layout 12.94. Set-Layout
12.95. Set-Rendering

Set-User
SPE Cmdlet - Sets the Sitecore user properties.

12.44. Get-User 12.72. New-User 12.85. Remove-User 12.96. Set-User 12.97. Set-UserPassword
12.116. Unlock-User

Set-UserPassword
SPE Cmdlet - Sets the Sitecore user password.

12.97. Set-UserPassword

Show-Alert
SPE Cmdlet - Pauses the script and shows an alert to the user.

12.75. Read-Variable 12.98. Show-Alert 12.99. Show-Application 12.100. Show-Confirm


12.101. Show-FieldEditor 12.102. Show-Input 12.103. Show-ListView 12.104. Show-ModalDialog
12.105. Show-Result 12.106. Show-YesNoCancel

Show-Application
SPE Cmdlet - Executes Sitecore Sheer application.

12.75. Read-Variable 12.98. Show-Alert 12.99. Show-Application 12.100. Show-Confirm


12.101. Show-FieldEditor 12.102. Show-Input 12.103. Show-ListView 12.104. Show-ModalDialog
12.105. Show-Result 12.106. Show-YesNoCancel

Glossary 460
Sitecore PowerShell Extensions

Show-Confirm
SPE Cmdlet - Shows a user a confirmation request message box.

12.75. Read-Variable 12.98. Show-Alert 12.99. Show-Application 12.100. Show-Confirm


12.101. Show-FieldEditor 12.102. Show-Input 12.103. Show-ListView 12.104. Show-ModalDialog
12.105. Show-Result 12.106. Show-YesNoCancel

Show-FieldEditor
SPE Cmdlet - Shows Field editor for a provided item.

12.75. Read-Variable 12.98. Show-Alert 12.99. Show-Application 12.100. Show-Confirm


12.101. Show-FieldEditor 12.102. Show-Input 12.103. Show-ListView 12.104. Show-ModalDialog
12.105. Show-Result 12.106. Show-YesNoCancel

Show-Input
SPE Cmdlet - Shows prompt message box asking user to provide a text string.

12.75. Read-Variable 12.98. Show-Alert 12.99. Show-Application 12.100. Show-Confirm


12.101. Show-FieldEditor 12.102. Show-Input 12.103. Show-ListView 12.104. Show-ModalDialog
12.105. Show-Result 12.106. Show-YesNoCancel

Show-ListView
SPE Cmdlet - Sends output to an interactive table in a separate window.

12.75. Read-Variable 12.98. Show-Alert 12.99. Show-Application 12.100. Show-Confirm


12.101. Show-FieldEditor 12.102. Show-Input 12.103. Show-ListView 12.104. Show-ModalDialog
12.105. Show-Result 12.106. Show-YesNoCancel 12.118. Update-ListView

Show-ModalDialog
SPE Cmdlet - Shows Sitecore Sheer control as a modal dialog.

12.75. Read-Variable 12.98. Show-Alert 12.99. Show-Application 12.100. Show-Confirm


12.101. Show-FieldEditor 12.102. Show-Input 12.103. Show-ListView 12.104. Show-ModalDialog
12.105. Show-Result 12.106. Show-YesNoCancel

Show-Result
SPE Cmdlet - Shows a Sheer dialog with text results showing the output of the script or another control selected by the
user based on either control name or Url to the control.

Glossary 461
Sitecore PowerShell Extensions

12.98. Show-Alert 12.99. Show-Application 12.100. Show-Confirm 12.101. Show-FieldEditor


12.102. Show-Input 12.103. Show-ListView 12.104. Show-ModalDialog 12.105. Show-Result
12.106. Show-YesNoCancel 2.3. Interactive Dialogs

Show-YesNoCancel
SPE Cmdlet - Shows Yes/No/Cancel dialog to the user and returns user choice.

12.75. Read-Variable 12.98. Show-Alert 12.99. Show-Application 12.100. Show-Confirm


12.101. Show-FieldEditor 12.102. Show-Input 12.103. Show-ListView 12.104. Show-ModalDialog
12.105. Show-Result 12.106. Show-YesNoCancel

SPE
Sitecore PowerShell Extensions

2. Interfaces 12. Appendix 2.1. Command Line Console 1.1. Contributor Guide 1. Installation
2.3. Interactive Dialogs 0. Introduction 10. Releases 7. Remoting 6. Reports 9. Security 8. Tasks
4. Toolbox 11. Troubleshooting 3. Working with Items

Start-TaskSchedule
SPE Cmdlet - Executes a task schedule.

12.42. Get-TaskSchedule 12.108. Start-TaskSchedule

Test-ItemAcl
SPE Cmdlet - Tests a specific access right for a specified user against the provided item

12.1. Add-ItemAcl 12.5. Clear-ItemAcl 12.23. Get-ItemAcl 12.64. New-ItemAcl 12.93. Set-ItemAcl
12.113. Test-ItemAcl

Test-Rule
SPE Cmdlet - Tests item against a sitecore serialized rules engine rule set.

12.114. Test-Rule

Unlock-Item
SPE Cmdlet - Unlocks the specified Sitecore item.

12.57. Lock-Item 12.115. Unlock-Item

Glossary 462
Sitecore PowerShell Extensions

Unlock-User
SPE Cmdlet - Unlocks a Sitecore user using the specified criteria.

12.44. Get-User 12.72. New-User 12.85. Remove-User 12.96. Set-User 12.116. Unlock-User

Unprotect-Item
SPE Cmdlet - Unprotects the specified Sitecore item.

12.73. Protect-Item 12.117. Unprotect-Item

Update-ListView
SPE Cmdlet - Updates List View (created by Show-ListView) data.

12.103. Show-ListView 12.118. Update-ListView

Write-Log
SPE Cmdlet - Writes text to the Sitecore event log.

12.120. Write-Log

Glossary 463