Documente Academic
Documente Profesional
Documente Cultură
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
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.
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
Introduction 5
Sitecore PowerShell Extensions
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 from the Sitecore Marketplace and install through the Installation Wizard.
Following the installation you'll find these new items added to the Sitecore menu:
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
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.
Single Instance
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
. C:\inetpub\wwwroot\Console\Setup-Folders.ps1
. C:\inetpub\wwwroot\Console\Setup-Module.ps1
Multiple Instance
C:\inetpub\wwwroot\Sitecore75
C:\inetpub\wwwroot\Sitecore70
Contributor Guide 8
Sitecore PowerShell Extensions
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
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
. 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.
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.
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.
The console prompt typically begins with PS master:\> . The present working directory is using the CmsItemProvider and
set to the master database.
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
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
Shortcut Usage
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.
Now let's review each of the different features; take note of the numbered labels:
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
Shortcut Usage
TAB Indent
Ctrl-Space Autocomplete commands. Use the up or down direction keys to cycle through options.
For more commands built into the script editor see here
Interactive Dialogs
We've provided a few commands to interact with the user through dialogs.
Alert
No return value.
Variable Settings
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
OK ok
Interactive Dialogs 16
Sitecore PowerShell Extensions
Cancel cancel
Confirmation
OK yes
Cancel no
Interactive Dialogs 17
Sitecore PowerShell Extensions
Confirmation Choice
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.
Upload
No return value.
Interactive Dialogs 18
Sitecore PowerShell Extensions
Download
Interactive Dialogs 19
Sitecore PowerShell Extensions
Figure - Download
Field Editor
OK ok
Cancel cancel
Interactive Dialogs 20
Sitecore PowerShell Extensions
User Input
Cancel $null
Interactive Dialogs 21
Sitecore PowerShell Extensions
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"
Cancel undetermined
Interactive Dialogs 22
Sitecore PowerShell Extensions
Show-ModalDialog -HandleParameters @{
"h"="FileBrowser";
} -Control "FileBrowser" -Width 500
Cancel undetermined
Interactive Dialogs 23
Sitecore PowerShell Extensions
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
Results
Show-Result
Interactive Dialogs 25
Sitecore PowerShell Extensions
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.
The specified
database will be
Database
used. Requires the ID
to be set.
Unauthorized access
FailSilently errors will be
suppressed
Specifies the
Language
languages to include.
Below we will show how to use each command with the Windows PowerShell syntax followed by some examples of the
common C# equivalent.
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.
Example: The following will retrieve the item based on the Sitecore path.
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.
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
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
Notice that the item with language en-US at its third version.
Example: The following retrieves the item in all languages and versions.
PS master:\> Get-Item master:/content/home -Language * -Version *| Format-Table DisplayName, Language, Id, Version, TemplateName
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
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.
Example: The following retrieves all items beneath the path /sitecore/content/ with the template of Sample Item in all
versions and languages.
Get items by Id
The Uri encodes the language and version within the path.
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:
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 .Editing.BeginEdit and .Editing.EndEdit methods.
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.
Example: The following sets the title property using the semi-native PowerShell property without the use of a variable.
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 assigns a System.DateTime value to the PowerShell automated property.
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.
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.
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.
Let's see how our item looks in the Content editor after all the assignments that we've just performed:
Those little improvements make your scripts much more succinct and understandable. Try it for yourself!
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
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 .
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
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.
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\"
Example: The following creates a new item with the specified template.
Example: The following removes the item permanently. Proceed with caution.
References
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.
View the list of user sessions and "kick" them out as needed.
Create Anti-Package
Task Manager
Toolbox 36
Sitecore PowerShell Extensions
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.
Toolbox 37
Sitecore PowerShell Extensions
Toolbox 38
Sitecore PowerShell Extensions
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.
Toolbox 39
Sitecore PowerShell Extensions
Modules
Sitecore PowerShell Extensions provides a way to organize your scripts into 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.
1. Navigate to the Script Library item and Insert -> PowerShell Script 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.
Modules 40
Sitecore PowerShell Extensions
5. Select the module and enable for use. This is where you would also open the ISE to rebuild integrations.
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
Reports 42
Sitecore PowerShell Extensions
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.
Active Aliases
Aliases
Audit
Item History
Items with security for an account2 Items with Security for an account
Links
Logged errors
My Owned Items
Media items not used by content items3 Orphaned media assets report
Owned items
Reports 43
Sitecore PowerShell Extensions
Renderings
Index Viewer5 -
Report Location: Check the reports in SPE under these sections to see the full list.
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:
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.
We have provided a handy way of executing scripts via web service using the Remoting Automation Service.
Example: The following connects a local instance of SPE to a remote instance and executes the provided script.
$script = {
[Sitecore.Security.Accounts.User]$user = Get-User -Identity admin
$user
$params.date.ToString()
}
$args = @{
"date" = [datetime]::Now
}
Remoting 46
Sitecore PowerShell Extensions
4/26/2015 6:15:41 PM
Example: The following connects Windows PowerShell ISE to a remote Sitecore instance and executes the provided
script.
$savePath = "C:\image-$([datetime]::Now.ToString("yyyyddMM-HHmmss")).png"
Receive-MediaItem -Session $session -Path $libraryPath -Destination $savePath
Directory: C:\
Example: The following downloads all the images in the media library under the specified directory.
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:
Example: The following connects Windows PowerShell ISE to a remote Sitecore instance using Windows credentials and
executes the provided script.
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 }
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.
Example: The following downloads a single media item from the library.
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.
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.
$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
References:
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
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
The Items field contains the path to a script in the Script Library.
Module Script
System Maintenance Archive Sitecore logs, Clean up deleted items older than 30 days
We've added a context menu item to provide you with a shortcut to the Task Scheduler Editor.
Tasks 51
Sitecore PowerShell Extensions
The scheduled task is capable of running 1-to-many scripts. Choose all that apply for the selected task.
The task schedule has an intuitive dialog for working with and changing the frequency.
Tasks 52
Sitecore PowerShell Extensions
Tasks 53
Sitecore PowerShell Extensions
Authoring Tasks
The following article shows how to create a custom scheduled task.
Authoring Tasks 54
Sitecore PowerShell Extensions
Security
Security Policies
There are two main security policies to consider when using the SPE module:
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.
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.
You can disable the web services by overriding the following configuration file
\App_Config\Include\Cognifide.PowerShell.config .
<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 .
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.
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!
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!
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!
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
Releases 58
Sitecore PowerShell Extensions
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.
New Features
Enhancements
Fixes
Releases 59
Sitecore PowerShell Extensions
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.
Figure - Toolbox
Releases 60
Sitecore PowerShell Extensions
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
Choose which custom fields and standard fields you wish to be included in the final report.
Releases 62
Sitecore PowerShell Extensions
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
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.
Releases 64
Sitecore PowerShell Extensions
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.
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.
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
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
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.
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
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
+ ~~~~~~~~~~~~~~~~~~~~~
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.
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!
Release Notes
Release Notes
Release Notes
Release Notes
Release Notes
Release Notes
Release Notes
Release Notes
Release Notes
Release Notes
Release Notes
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")
Troubleshooting 71
Sitecore PowerShell Extensions
Appendix
Compatibility Table
3.0-
3.3
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]
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.
Aliases
Required? true
Position? named
Default Value
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
-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
-PassThru <SwitchParameter>
Aliases
Required? false
Position? named
Default Value
-AccessRight <String>
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
-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.
Local Name
Example: adam
Fully Qualified Name
Example: sitecore\adam
Aliases
Add-ItemAcl 77
Sitecore PowerShell Extensions
Required? true
Position? named
Default Value
-Item <Item>
Aliases
Required? true
Position? named
Default Value
-Path <String>
Aliases
Required? true
Position? named
Default Value
-Id <String>
Aliases
Required? true
Position? named
Default Value
-Database <String>
Add-ItemAcl 78
Sitecore PowerShell Extensions
Aliases
Required? false
Position? named
Default Value
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
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
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 ]
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>
Aliases
Required? false
Position? named
Default Value
-IfExist <ActionIfExists>
Aliases
Required? false
Position? named
Add-ItemLanguage 81
Sitecore PowerShell Extensions
Default Value
-TargetLanguage <String[]>
Aliases
Required? true
Position? named
Default Value
-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
-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.
__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
-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
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-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
-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
-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
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.
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 ]
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>
Aliases
Required? true
Position? named
Default Value
-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
-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
-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
-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
-Device <DeviceItem>
Device the rendering is assigned to. If not specified - default device will be used.
Aliases
Required? false
Position? named
Default Value
Add-Rendering 87
Sitecore PowerShell Extensions
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-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
-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
-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
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
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>
Local Name
Example: developer
Fully Qualified Name
Example: sitecore\developer
Aliases
Required? true
Position? 1
Default Value
-Members <AccountIdentity[]>
Aliases
Required? true
Position? named
Default Value
Add-RoleMember 90
Sitecore PowerShell Extensions
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
None.
Notes
Help Author: Adam Najmanowicz, Michael West
Examples
EXAMPLE
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]
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>
Aliases
Required? false
Position? named
Default Value
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-Path <String>
Clear-ItemAcl 92
Sitecore PowerShell Extensions
Aliases
Required? true
Position? 1
Default Value
-Id <String>
Aliases
Required? true
Position? named
Default Value
-Database <String>
Aliases
Required? false
Position? named
Default Value
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
Notes
Clear-ItemAcl 93
Sitecore PowerShell Extensions
Examples
EXAMPLE 1
Clears the security information from the Home item providing its path
EXAMPLE 2
Clears the security information from the Home item by providing it from the pipeline and passing it back to the pipeline.
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>
Aliases
Required? true
Position? 1
Default Value
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
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]
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>
Aliases
Required? true
Position? 1
Default Value
-Path <String>
Aliases
Required? true
Position? 1
Default Value
-Id <String>
ConvertFrom-ItemClone 98
Sitecore PowerShell Extensions
Aliases
Required? true
Position? named
Default Value
-Database <String>
Aliases
Required? false
Position? named
Default Value
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
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
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
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>
Local Name
Example: michael
Fully Qualified Name
Example: sitecore\michael
Aliases
Required? true
Position? 1
Default Value
-Instance <User>
Aliases
Required? true
Position? named
Default Value
Disable-User 103
Sitecore PowerShell Extensions
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
None.
Notes
Michael West
Examples
EXAMPLE 1
EXAMPLE 2
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>
Local Name
Example: michael
Fully Qualified Name
Example: sitecore\michael
Aliases
Required? true
Position? 1
Default Value
-Instance <User>
Aliases
Required? true
Position? named
Default Value
Enable-User 105
Sitecore PowerShell Extensions
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
None.
Notes
Michael West
Examples
EXAMPLE 1
EXAMPLE 2
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]
Detailed Description
The Expand-Token command expands the tokens in fields for items.
$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
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
Expand-Token 107
Sitecore PowerShell Extensions
-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
-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
-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
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
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 ]
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
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:
2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions##
Aliases
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
Export-Item 110
Sitecore PowerShell Extensions
-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.
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
-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
-Root <String>
Aliases
Required? false
Position? named
Default Value
-Item <Item>
Export-Item 111
Sitecore PowerShell Extensions
Aliases
Required? true
Position? 1
Default Value
-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
-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
-Database <String>
Aliases
Required? false
Position? named
Default Value
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
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>
Aliases
Required? false
Position? 1
Default Value
-Project <PackageProject>
Project object created ealier with the New-Package. or Loaded with Get-Package.
Aliases
Required? false
Position? 2
Default Value
-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
-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
-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
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";
# Save package
Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -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 ]
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>
Local Name
Example: developer
Fully Qualified Name
Example: sitecore\developer
Aliases
Required? true
Position? 1
Default Value
-Filter <String>
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
-Role <Role>
Aliases
Required? true
Position? 1
Default Value
-Path <String>
Aliases
Required? true
Position? named
Default Value
-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
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
EXAMPLE 2
EXAMPLE 3
EXAMPLE 4
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>
Aliases
Required? true
Position? 1
Default Value
-Name <String>
Aliases
Required? false
Position? 2
Default Value
-Path <String>
Aliases
Export-UpdatePackage 121
Sitecore PowerShell Extensions
Required? false
Position? 3
Default Value
-Readme <String>
Aliases
Required? false
Position? named
Default Value
-LicenseFileName <String>
Aliases
Required? false
Position? named
Default Value
-Tag <String>
Package tag.
Aliases
Required? false
Position? named
Default Value
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
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 ]
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.
2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions
Parameters
-Identity <AccountIdentity>
Local Name
Example: admin
Fully Qualified Name
Example: sitecore\admi
Aliases
Required? true
Position? 1
Default Value
Export-User 124
Sitecore PowerShell Extensions
-Filter <String>
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
-User <User>
User object retrieved from the Sitecore API or using the Get-User command.
Aliases
Required? true
Position? 1
Default Value
-Current <SwitchParameter>
Aliases
Required? true
Position? named
Default Value
-Path <String>
Export-User 125
Sitecore PowerShell Extensions
Aliases
Required? true
Position? named
Default Value
-Root <String>
Aliases
Required? false
Position? named
Default Value
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
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>
Aliases
Required? true
Position? 1
Default Value
-Criteria <SearchCriteria[]>
@{ 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/") }
Equals
StartsWith,
Contains,
EndsWith
DescendantOf
Fields by which you can filter can be discovered using the following script:
Find-Item 128
Sitecore PowerShell Extensions
Aliases
Required? false
Position? named
Default Value
-Where <String>
Aliases
Required? false
Position? named
Default Value
-WhereValues <Object[]>
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
-OrderBy <String>
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
-First <Int32>
Aliases
Required? false
Position? named
Default Value
-Last <Int32>
Aliases
Required? false
Position? named
Default Value
-Skip <Int32>
Number of search results to be skipped skip before returning the results commences.
Aliases
Required? false
Position? named
Default Value
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
EXAMPLE 2
Find all children of a specific item including that item - return Sitecore items
EXAMPLE 3
Find-Item `
-Index sitecore_master_index `
-Where 'TemplateName = @0 And Language=@1' `
-WhereValues "Template Field", "en"
EXAMPLE 4
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>
Aliases
Required? false
Position? 1
Default Value
-Database <Database>
Aliases
Required? false
Position? 2
Default Value
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
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>
Aliases
Required? false
Position? 1
Default Value
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
Get-Cache 135
Sitecore PowerShell Extensions
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>
Aliases
Required? false
Position? 1
Default Value
-Item <Item>
Database returned will be taken from the item passed to the command.
Aliases
Required? false
Position? named
Default Value
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
EXAMPLE 3
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>
Aliases
Required? false
Position? named
Default Value
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
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
EXAMPLE 2
PS master:\> Get-Domain
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 -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.
Local Name
Example: adam
Fully Qualified Name
Example: sitecore\adam
Aliases
Required? true
Position? named
Default Value
Get-ItemAcl 141
Sitecore PowerShell Extensions
-Filter <String>
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
-Item <Item>
Aliases
Required? true
Position? named
Default Value
-Path <String>
Path to the item from which the security rules should be taken.
Aliases
Required? true
Position? named
Default Value
-Id <String>
Get-ItemAcl 142
Sitecore PowerShell Extensions
Aliases
Required? true
Position? named
Default Value
-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
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
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
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]
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>
Aliases
Required? true
Position? 1
Default Value
-Path <String>
Aliases
Required? true
Position? 1
Default Value
-Id <String>
Get-ItemClone 145
Sitecore PowerShell Extensions
Aliases
Required? true
Position? named
Default Value
-Database <String>
Database containing the item to be processed - if item is being provided through Id.
Aliases
Required? false
Position? named
Default Value
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
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 ]
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>
Aliases
Required? false
Position? named
Default Value
-ReturnType <ReturnValue>
Aliases
Required? false
Position? named
Default Value
Get-ItemField 148
Sitecore PowerShell Extensions
-Name <String[]>
Aliases
Required? false
Position? named
Default Value
-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
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-Path <String>
Aliases
Required? true
Position? 1
Default Value
Get-ItemField 149
Sitecore PowerShell Extensions
-Id <String>
Aliases
Required? true
Position? named
Default Value
-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
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.
Notes
Help Author: Adam Najmanowicz, Michael West
Examples
EXAMPLE 1
Get-ItemField 150
Sitecore PowerShell Extensions
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
Get-ItemField 151
Sitecore PowerShell Extensions
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
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>
Aliases
Required? true
Position? named
Default Value
-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
-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
-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
-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
-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
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
EXAMPLE 2
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
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>
Aliases
Required? true
Position? named
Default Value
-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
-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
-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
-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
-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
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
EXAMPLE 2
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]
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
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-Path <String>
Get-ItemTemplate 161
Sitecore PowerShell Extensions
Aliases
Required? true
Position? 1
Default Value
-Id <String>
Aliases
Required? true
Position? named
Default Value
-Database <String>
Database containing the item to be analysed - required if item is specified with Id.
Aliases
Required? false
Position? named
Default Value
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
Examples
EXAMPLE 1
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
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 ]
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
-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
Get-ItemWorkflowEvent 164
Sitecore PowerShell Extensions
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-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
-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
-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
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
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 ]
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
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-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
-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
-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
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
Examples
EXAMPLE
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>
Aliases
Required? true
Position? 1
Default Value
-Default <SwitchParameter>
Aliases
Required? true
Position? 1
Default Value
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
EXAMPLE 2
EXAMPLE 3
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
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
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[]>
Aliases
Required? false
Position? 1
Default Value
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
Get-Preset 174
Sitecore PowerShell Extensions
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 ]
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>
Aliases
Required? true
Position? named
Default Value
-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
-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
-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
-DataSource <String>
Aliases
Required? false
Position? named
Default Value
-Rendering <Item>
Get-Rendering 177
Sitecore PowerShell Extensions
Aliases
Required? false
Position? named
Default Value
-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
-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
-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
-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
-UniqueId <String>
Aliases
Required? true
Position? named
Default Value
-Device <DeviceItem>
Aliases
Required? false
Position? named
Default Value
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
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>
Local Name
Example: developer
Fully Qualified Name
Example: sitecore\developer
Aliases
Required? true
Position? 1
Default Value
-Filter <String>
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
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
Notes
Help Author: Adam Najmanowicz, Michael West
Examples
EXAMPLE 1
EXAMPLE 2
EXAMPLE 3
Get-Role 182
Sitecore PowerShell Extensions
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]
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>
Local Name
Example: developer
Fully Qualified Name
Example: sitecore\developer
Aliases
Required? true
Position? 1
Default Value
-Recursive <SwitchParameter>
Aliases
Required? false
Position? named
Default Value
Get-RoleMember 184
Sitecore PowerShell Extensions
-UsersOnly <SwitchParameter>
Aliases
Required? false
Position? named
Default Value
-RolesOnly <SwitchParameter>
Aliases
Required? false
Position? named
Default Value
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
Notes
Help Author: Adam Najmanowicz, Michael West
Examples
EXAMPLE 1
Get-RoleMember 185
Sitecore PowerShell Extensions
EXAMPLE 2
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 ]
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>
Aliases
Required? true
Position? named
Default Value
-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
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
-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
-Session <ScriptSession[]>
Aliases
Required? true
Position? named
Default Value
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
EXAMPLE 2
PS master:\>Get-ScriptSession -Current
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>
Aliases
Required? false
Position? 1
Default Value
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
PS master:\>Get-SearchIndex
EXAMPLE 2
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>
Local Name
Example: admin
Fully Qualified Name
Example: sitecore\admi
Aliases
Required? false
Position? named
Default Value
-InstanceId <String[]>
Aliases
Required? true
Position? named
Default Value
Get-Session 192
Sitecore PowerShell Extensions
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.
Notes
Help Author: Adam Najmanowicz, Michael West
Examples
EXAMPLE 1
PS master:\> Get-Session
EXAMPLE 2
EXAMPLE 3
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 -Database
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>
Aliases
Required? true
Position? named
Default Value
-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
Get-SpeModule 195
Sitecore PowerShell Extensions
-Id <String>
Aliases
Required? true
Position? named
Default Value
-Database <String>
Aliases
Required? true
Position? named
Default Value
-Name <String>
Aliases
Required? true
Position? named
Default Value
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
EXAMPLE 2
Return all modules defined in the master database Matching the "Content*" wildcard
EXAMPLE 3
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
-ReturnPath <SwitchParameter>
Aliases
Required? false
Position? named
Default Value
-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
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
Get-SpeModuleFeatureRoot 199
Sitecore PowerShell Extensions
EXAMPLE 2
Return the Path to where "List View Export" scripts would be located if this feature was defined
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
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>
Aliases
Required? true
Position? named
Default Value
-Path <String>
Aliases
Required? true
Position? named
Default Value
-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
-Name <String>
Task filter - supports wildcards. Works with "Database" parameter to narrow tassk to only single database.
Aliases
Required? false
Position? 1
Default Value
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
EXAMPLE 3
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
-TargetPath <String>
Path containing the desired serialization state that the Source needs to be transformed to.
Aliases
Required? false
Position? 1
Default Value
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
<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>
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
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>
Local Name:
admin
sitecore\admi
Aliases
Required? true
Position? 1
Default Value
-Filter <String>
Get-User 207
Sitecore PowerShell Extensions
Examples: The following examples show how to use the filter syntax.
Get-User -Filter *
Aliases
Required? true
Position? named
Default Value
-Current <SwitchParameter>
Aliases
Required? true
Position? named
Default Value
-Authenticated <SwitchParameter>
Aliases
Required? false
Position? named
Default Value
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Get-User 208
Sitecore PowerShell Extensions
Outputs
The output type is the type of the objects that the cmdlet emits.
Notes
Help Author: Adam Najmanowicz, Michael West
Examples
EXAMPLE 1
EXAMPLE 2
EXAMPLE 3
EXAMPLE 4
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>
Aliases
Required? true
Position? 1
Default Value
-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
-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
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
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]
Detailed Description
The Import-Item command deserializes the specified items.
-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.:
2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions##
Aliases
Deserialize-Item
Parameters
-Database <Database>
Aliases
Required? false
Position? named
Default Value
Import-Item 214
Sitecore PowerShell Extensions
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-Preset <IncludeEntry>
Aliases
Required? true
Position? 1
Default Value
-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
-Recurse <SwitchParameter>
If included in the execution - dederializes both the item and all of its children.
Aliases
Required? false
Position? named
Default Value
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
-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
-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
-ForceUpdate <SwitchParameter>
Aliases
Required? false
Position? named
Import-Item 216
Sitecore PowerShell Extensions
Default Value
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
EXAMPLE 2
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 -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
-Filter <String>
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
-Role <User>
Aliases
Required? true
Position? 1
Default Value
-Path <String>
Aliases
Required? true
Position? named
Default Value
-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
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
EXAMPLE 2
EXAMPLE 3
EXAMPLE 4
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 -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
-Filter <String>
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
-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
-Path <String>
Aliases
Required? true
Position? named
Default Value
-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
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
EXAMPLE 2
EXAMPLE 3
EXAMPLE 4
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
Wrap-Item
Parameters
-Item <Item>
Aliases
Required? true
Position? named
Default Value
-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
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]
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
Rebuild-SearchIndex
Parameters
-Index <ISearchIndex>
Aliases
Required? true
Position? 1
Default Value
-IncludeRemoteIndex <SwitchParameter>
Aliases
Required? false
Position? named
Default Value
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
-Name <String>
Aliases
Required? false
Position? 1
Default Value
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
Initialize-SearchIndex 227
Sitecore PowerShell Extensions
EXAMPLE 2
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
Import-Package
Parameters
-Path <String>
Aliases
Required? false
Position? 1
Default Value
-InstallMode <InstallMode>
Aliases
Required? false
Position? named
Default Value
Install-Package 229
Sitecore PowerShell Extensions
-MergeMode <MergeMode>
Aliases
Required? false
Position? named
Default Value
Notes
Help Author: Adam Najmanowicz, Michael West
Examples
EXAMPLE
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.
2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions
Parameters
-Path <String>
Aliases
Required? true
Position? 1
Default Value
-RollbackPackagePath <String>
Specify Rollback Package Path - for rolling back if the installation was not functioning as expected.
Aliases
Required? false
Position? 1
Default Value
-UpgradeAction <UpgradeAction>
Install-UpdatePackage 231
Sitecore PowerShell Extensions
Preview / Upgrade
Aliases
Required? true
Position? named
Default Value
-InstallMode <InstallMode>
Install / Update
Aliases
Required? true
Position? named
Default Value
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
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 ]
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
Execute-Script
Parameters
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-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:
Aliases
Required? true
Position? 1
Invoke-Script 233
Sitecore PowerShell Extensions
Default Value
-ArgumentList <Object[]>
Aliases
Required? false
Position? named
Default Value
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
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]
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
Execute-ShellCommand
Parameters
-Name <String>
Aliases
Required? true
Position? 1
Default Value
-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
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-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
-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
-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
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
EXAMPLE 2
EXAMPLE 3
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 ]
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
Execute-Workflow
Parameters
-CommandName <String>
Aliases
Required? false
Position? named
Default Value
-Comments <String>
Aliases
Required? false
Position? named
Default Value
Invoke-Workflow 239
Sitecore PowerShell Extensions
-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
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-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
-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
-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
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
EXAMPLE 2
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 ]
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
-PassThru <SwitchParameter>
Aliases
Required? false
Position? named
Default Value
-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.
Local Name
Example: adam
Fully Qualified Name
Example: sitecore\adam
Aliases
Required? false
Position? named
Default Value
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-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
-Id <String>
Aliases
Lock-Item 244
Sitecore PowerShell Extensions
Required? true
Position? named
Default Value
-Database <String>
Aliases
Required? false
Position? named
Default Value
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
Notes
Help Author: Adam Najmanowicz, Michael West
Examples
EXAMPLE 1
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.
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
-Password <String>
Aliases
Required? true
Position? 2
Default Value
Notes
Help Author: Adam Najmanowicz, Michael West
Login-User 247
Sitecore PowerShell Extensions
Examples
EXAMPLE
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>
Aliases
Required? true
Position? 1
Default Value
-LocallyManaged <SwitchParameter>
Aliases
Required? false
Position? named
Default Value
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
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
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>
Aliases
Required? true
Position? 1
Default Value
-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
-InstallMode <String>
Aliases
Required? false
New-ExplicitFileSource 252
Sitecore PowerShell Extensions
Position? named
Default Value
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";
# 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
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
-Name <String>
Aliases
Required? true
Position? 1
Default Value
-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
-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.
Aliases
Required? false
Position? named
Default Value
-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
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";
# Save package
Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -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>
Aliases
Required? true
Position? 1
Default Value
-Root <DirectoryInfo>
Aliases
Required? true
Position? 2
Default Value
-IncludeFilter <String>
Aliases
New-FileSource 259
Sitecore PowerShell Extensions
Required? false
Position? 3
Default Value
-ExcludeFilter <String>
Aliases
Required? false
Position? 4
Default Value
-InstallMode <String>
Aliases
Required? false
Position? named
Default Value
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";
# 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
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.
Local Name
Example: adam
Fully Qualified Name
Example: sitecore\adam
Aliases
Required? true
Position? 1
Default Value
-AccessRight <String>
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
-PropagationType <PropagationType>
The PropagationType enumeration determines which items will be granted the access right.
Aliases
Required? true
Position? 3
Default Value
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
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"
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
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
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]
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>
Aliases
Required? true
Position? named
Default Value
-Name <String>
Aliases
Required? false
Position? named
Default Value
-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
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-Path <String>
Aliases
Required? true
Position? 1
Default Value
-Id <String>
Aliases
Required? true
Position? named
Default Value
-Database <String>
New-ItemClone 267
Sitecore PowerShell Extensions
Aliases
Required? false
Position? named
Default Value
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
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>
Aliases
Required? false
Position? named
Default Value
-Name <String>
Aliases
Required? true
Position? 1
Default Value
-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
-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
-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
-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.
Aliases
Required? false
Position? named
New-ItemSource 270
Sitecore PowerShell Extensions
Default Value
-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
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
# Save package
Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -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 ]
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
-NewState <String>
Id of the old state. If not provided - current item workflow state will be used.
Aliases
Required? false
Position? named
Default Value
-Text <String>
New-ItemWorkflowEvent 273
Sitecore PowerShell Extensions
Action comment.
Aliases
Required? false
Position? named
Default Value
-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
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-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
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
-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
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
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";
# Save package
Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -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]
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>
Aliases
Required? false
Position? named
Default Value
-PlaceHolder <String>
Aliases
Required? false
Position? named
Default Value
New-Rendering 279
Sitecore PowerShell Extensions
-DataSource <Item>
Aliases
Required? false
Position? named
Default Value
-Cacheable <SwitchParameter>
Aliases
Required? false
Position? named
Default Value
-VaryByData <SwitchParameter>
Aliases
Required? false
Position? named
Default Value
-VaryByDevice <SwitchParameter>
Aliases
Required? false
Position? named
Default Value
New-Rendering 280
Sitecore PowerShell Extensions
-VaryByLogin <SwitchParameter>
Defines whether a login - specific cache version of the rendering should be kept.
Aliases
Required? false
Position? named
Default Value
-VaryByParameters <SwitchParameter>
Defines whether paremeter - specific cache version of the rendering should be kept.
Aliases
Required? false
Position? named
Default Value
-VaryByQueryString <SwitchParameter>
Defines whether query string - specific cache version of the rendering should be kept.
Aliases
Required? false
Position? named
Default Value
-VaryByUser <SwitchParameter>
Defines whether a user - specific cache version of the rendering should be kept.
Aliases
Required? false
Position? named
Default Value
New-Rendering 281
Sitecore PowerShell Extensions
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-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
-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
-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
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
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
-PassThru <SwitchParameter>
Aliases
Required? false
Position? named
Default Value
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
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]
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>
Aliases
Required? true
Position? 2
Default Value
-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.
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
-Filter <String[]>
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
-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
-Name <String>
New-SecuritySource 287
Sitecore PowerShell Extensions
Aliases
Required? true
Position? 1
Default Value
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";
# Save package
Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -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";
# 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
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>
Local Name
Example: developer
Fully Qualified Name
Example: sitecore\developer
Aliases
Required? true
Position? 1
Default Value
-Password <String>
Aliases
Required? false
Position? named
Default Value
New-User 290
Sitecore PowerShell Extensions
-Email <String>
Aliases
Required? false
Position? named
Default Value
-FullName <String>
Aliases
Required? false
Position? named
Default Value
-Comment <String>
Aliases
Required? false
Position? named
Default Value
-Portrait <String>
Aliases
Required? false
Position? named
Default Value
-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
-PassThru <SwitchParameter>
Aliases
Required? false
Position? named
Default Value
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
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
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
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]
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>
Aliases
Required? false
Position? named
Default Value
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-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
-Id <String>
Aliases
Required? true
Position? named
Default Value
-Database <String>
Aliases
Required? false
Position? named
Default Value
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
Protect-Item 295
Sitecore PowerShell Extensions
Notes
Help Author: Adam Najmanowicz, Michael West
Examples
EXAMPLE 1
EXAMPLE 2
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 ]
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
-Target <String[]>
Aliases
Required? false
Position? named
Default Value
-PublishMode <PublishMode>
Publish-Item 297
Sitecore PowerShell Extensions
Full
Incremental
SingleItem
Smart
Aliases
Required? false
Position? named
Default Value
-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
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-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
Publish-Item 298
Sitecore PowerShell Extensions
-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
-Database <String>
Aliases
Required? false
Position? named
Default Value
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
Publish-Item 299
Sitecore PowerShell Extensions
EXAMPLE 2
EXAMPLE 3
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:
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
-Description <String>
Aliases
Required? false
Position? named
Default Value
-CancelButtonName <String>
Aliases
Required? false
Position? named
Default Value
-OkButtonName <String>
Aliases
Required? false
Position? named
Default Value
-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
-Title <String>
Aliases
Required? false
Position? named
Default Value
-Width <Int32>
Dialog width.
Aliases
Required? false
Position? named
Default Value
-Height <Int32>
Dialog width.
Aliases
Required? false
Position? named
Default Value
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
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
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 ]
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>
Aliases
Required? false
Position? named
Default Value
-ParentItem <Item>
The item under which the uploaded media items should be stored.
Aliases
Required? true
Position? 1
Default Value
Receive-File 306
Sitecore PowerShell Extensions
-Path <String>
Aliases
Required? true
Position? 1
Default Value
-Title <String>
Aliases
Required? false
Position? named
Default Value
-CancelButtonName <String>
Aliases
Required? false
Position? named
Default Value
-OkButtonName <String>
Aliases
Required? false
Position? named
Default Value
Receive-File 307
Sitecore PowerShell Extensions
-Versioned <SwitchParameter>
Indicates that the Media item should be created as a Versioned media item.
Aliases
Required? false
Position? named
Default Value
-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
-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
-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
-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
-Width <Int32>
Dialog width.
Aliases
Required? false
Position? named
Default Value
-Height <Int32>
Dialog width.
Aliases
Required? false
Position? named
Default Value
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
EXAMPLE 2
Upload text.txt file to media library under the 'master:\media library\Files' item A new media item is created and returned
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.
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]
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
-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
-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
-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
-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
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.
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>
Aliases
Required? true
Position? 1
Default Value
-Force <SwitchParameter>
Indicates that the domain should be removed although it contains users in that domain.
Aliases
Required? false
Position? named
Default Value
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
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
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]
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
-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
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
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-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
-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
-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
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
EXAMPLE 2
Remove all english based languages defined in /sitecore/content/home item and all of its children in the master database
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
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 ]
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>
Aliases
Required? true
Position? named
Default Value
-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
-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
-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
-DataSource <String>
Aliases
Required? false
Position? named
Default Value
-Rendering <Item>
Remove-Rendering 322
Sitecore PowerShell Extensions
Aliases
Required? false
Position? named
Default Value
-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
-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
-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
-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
-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
-Device <DeviceItem>
Aliases
Required? false
Position? named
Default Value
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
EXAMPLE 2
remove all renderings from the "main" placeholder and all of its embedded placeholders.
EXAMPLE 3
remove all renderings from the "main" placeholder and all of its embedded placeholders, but only in the "Default" device
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>
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
-Instance <Role>
Aliases
Required? true
Position? named
Default Value
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
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>
Local Name
Example: developer
Fully Qualified Name
Example: sitecore\developer
Aliases
Required? true
Position? 1
Default Value
-Members <AccountIdentity[]>
Aliases
Required? true
Position? named
Default Value
Remove-RoleMember 328
Sitecore PowerShell Extensions
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
None.
Notes
Help Author: Adam Najmanowicz, Michael West
Examples
EXAMPLE
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[]>
Aliases
Required? true
Position? named
Default Value
-Session <ScriptSession[]>
Session to be removed.
Aliases
Required? true
Position? named
Default Value
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Remove-ScriptSession 330
Sitecore PowerShell Extensions
Notes
Help Author: Adam Najmanowicz, Michael West
Examples
EXAMPLE
The following removes the script session using the specified Id.
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[]>
Aliases
Required? true
Position? named
Default Value
-Instance <Session>
Aliases
Required? true
Position? 1
Default Value
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Remove-Session 332
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 1
EXAMPLE 2
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>
Local Name
Example: admin
Fully Qualified Name
Example: sitecore\admi
Aliases
Required? true
Position? 1
Default Value
-Instance <User>
Aliases
Required? true
Position? named
Default Value
Remove-User 334
Sitecore PowerShell Extensions
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
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
EXAMPLE 2
EXAMPLE 3
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[]>]
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>
Aliases
Required? false
Position? named
Default Value
-Name <String[]>
Aliases
Required? false
Position? named
Default Value
-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
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-Path <String>
Aliases
Required? true
Position? 1
Default Value
-Id <String>
Aliases
Required? true
Position? named
Default Value
-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
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
EXAMPLE 2
EXAMPLE 3
Reset all item fields with names beginning with "a", excluding standard fields.
Reset-ItemField 338
Sitecore PowerShell Extensions
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>
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>
Aliases
Required? true
Position? 1
Default Value
-Path <String>
Aliases
Required? true
Position? 1
Default Value
-Id <String>
Reset-Layout 340
Sitecore PowerShell Extensions
Aliases
Required? true
Position? named
Default Value
-Database <String>
Aliases
Required? false
Position? named
Default Value
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
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>
Aliases
Required? false
Position? 1
Default Value
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
EXAMPLE 2
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 ]
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
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
-Message <String>
Aliases
Required? false
Position? named
Default Value
Send-File 346
Sitecore PowerShell Extensions
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-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
-Title <String>
Aliases
Required? false
Position? named
Default Value
-Width <Int32>
Aliases
Required? false
Position? named
Default Value
Send-File 347
Sitecore PowerShell Extensions
-Height <Int32>
Aliases
Required? false
Position? named
Default Value
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
EXAMPLE 2
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>
Aliases
Required? true
Position? 1
Default Value
-GetResult <SwitchParameter>
Aliases
Required? false
Position? named
Default Value
-Parameters <Hashtable>
Aliases
Required? false
Position? named
Default Value
Send-SheerMessage 350
Sitecore PowerShell Extensions
Notes
Help Author: Adam Najmanowicz, Michael West
Examples
EXAMPLE
If you execute the following script in the PowerShell ISE the Save dialog will popup
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>
Aliases
Required? false
Position? named
Default Value
-BackgroundColor <ConsoleColor>
Aliases
Required? false
Position? named
Default Value
-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
-Persist <SwitchParameter>
Aliases
Required? false
Position? named
Default Value
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
EXAMPLE 2
Set color of the console text to cyan. Next instance of the console will revert to default (white).
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]
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
-PassThru <SwitchParameter>
Aliases
Required? false
Position? named
Default Value
-Item <Item>
Set-ItemAcl 354
Sitecore PowerShell Extensions
Aliases
Required? true
Position? 1
Default Value
-Path <String>
Aliases
Required? true
Position? 1
Default Value
-Id <String>
Aliases
Required? true
Position? named
Default Value
-Database <String>
Aliases
Required? false
Position? named
Default Value
Inputs
Set-ItemAcl 355
Sitecore PowerShell Extensions
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
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
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
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 ]
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>
Aliases
Required? true
Position? named
Default Value
-Layout <Item>
Aliases
Required? false
Position? named
Default Value
-Item <Item>
Set-Layout 358
Sitecore PowerShell Extensions
Aliases
Required? true
Position? 1
Default Value
-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
-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
-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
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
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 ]
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>
Aliases
Required? true
Position? named
Default Value
-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
-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
-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
-Index <Int32>
Aliases
Required? false
Position? named
Default Value
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
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
-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
-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
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
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>
Aliases
Required? false
Position? named
Default Value
-Portrait <String>
Aliases
Required? false
Position? named
Default Value
Set-User 365
Sitecore PowerShell Extensions
-Identity <AccountIdentity>
Local Name
Example: admin
Aliases
Required? true
Position? 1
Default Value
-Instance <User>
Aliases
Required? true
Position? named
Default Value
-Email <String>
Specifies the Sitecore user email address. The value is validated for a properly formatted address.
Aliases
Required? false
Position? named
Default Value
-FullName <String>
Aliases
Required? false
Position? named
Default Value
Set-User 366
Sitecore PowerShell Extensions
-Comment <String>
Aliases
Required? false
Position? named
Default Value
-ProfileItemId <ID>
Aliases
Required? false
Position? named
Default Value
-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
-Enabled <SwitchParameter>
Aliases
Required? false
Position? named
Default Value
Set-User 367
Sitecore PowerShell Extensions
-CustomProperties <Hashtable>
Aliases
Required? false
Position? named
Default Value
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
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
EXAMPLE 2
EXAMPLE 3
Set-User 368
Sitecore PowerShell Extensions
EXAMPLE 4
7/3/2014 4:40:02 PM
EXAMPLE 5
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 ]
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>
Local Name
Example: admin
Fully Qualified Name
Example: sitecore\admi
Aliases
Required? true
Position? 1
Default Value
-NewPassword <String>
Aliases
Required? false
Position? named
Default Value
Set-UserPassword 370
Sitecore PowerShell Extensions
-OldPassword <String>
Aliases
Required? true
Position? named
Default Value
-Reset <SwitchParameter>
Aliases
Required? true
Position? named
Default Value
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
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
Set-UserPassword 371
Sitecore PowerShell Extensions
EXAMPLE 2
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>
Aliases
Required? true
Position? 1
Default Value
Notes
Help Author: Adam Najmanowicz, Michael West
Examples
EXAMPLE
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
-Parameter <Hashtable>
Aliases
Required? false
Position? 2
Default Value
-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
-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
-Title <String>
Aliases
Required? false
Position? named
Default Value
-Width <Int32>
Aliases
Required? false
Position? named
Default Value
-Height <Int32>
Aliases
Show-Application 376
Sitecore PowerShell Extensions
Required? false
Position? named
Default Value
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>
Aliases
Required? true
Position? 1
Default Value
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
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 -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[]>
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
-Title <String>
Show-FieldEditor 381
Sitecore PowerShell Extensions
Aliases
Required? false
Position? named
Default Value
-Width <Int32>
Aliases
Required? false
Position? named
Default Value
-Height <Int32>
Aliases
Required? false
Position? named
Default Value
-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
-Item <Item>
Show-FieldEditor 382
Sitecore PowerShell Extensions
Aliases
Required? true
Position? named
Default Value
-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
-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
-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
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
-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
-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
-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
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.
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>
Aliases
Required? true
Position? 1
Default Value
-DefaultValue <String>
Aliases
Required? false
Position? named
Default Value
-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
-ErrorMessage <String>
Aliases
Required? false
Position? named
Default Value
-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
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)
EXAMPLE 3
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>
Aliases
Required? false
Position? named
Default Value
-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
Show-ListView 390
Sitecore PowerShell Extensions
-InfoTitle <String>
Title on the panel that appears below the ribbon in the results window.
Aliases
Required? false
Position? named
Default Value
-InfoDescription <String>
Description that appears on the panel below the ribbon in the results window.
Aliases
Required? false
Position? named
Default Value
-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
-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
-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
-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
-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
-Data <Object>
Aliases
Show-ListView 392
Sitecore PowerShell Extensions
Required? true
Position? named
Default Value
-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
-Title <String>
Aliases
Required? false
Position? named
Default Value
-Width <Int32>
Aliases
Required? false
Position? named
Default Value
-Height <Int32>
Show-ListView 393
Sitecore PowerShell Extensions
Aliases
Required? false
Position? named
Default Value
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.
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 ]
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>
Aliases
Required? true
Position? named
Default Value
-Url <String>
Aliases
Required? true
Position? named
Default Value
-Parameters <Hashtable>
Show-ModalDialog 396
Sitecore PowerShell Extensions
Aliases
Required? false
Position? named
Default Value
-HandleParameters <Hashtable>
Aliases
Required? false
Position? named
Default Value
-Title <String>
Aliases
Required? false
Position? named
Default Value
-Width <Int32>
Aliases
Required? false
Position? named
Default Value
-Height <Int32>
Aliases
Show-ModalDialog 397
Sitecore PowerShell Extensions
Required? false
Position? named
Default Value
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 ]
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>
Aliases
Required? true
Position? named
Default Value
-Url <String>
Aliases
Required? true
Position? named
Default Value
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
-Text <SwitchParameter>
Aliases
Required? false
Position? named
Default Value
-Title <String>
Aliases
Required? false
Position? named
Default Value
-Width <Int32>
Aliases
Required? false
Position? named
Default Value
Show-Result 400
Sitecore PowerShell Extensions
-Height <Int32>
Aliases
Required? false
Position? named
Default Value
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
EXAMPLE 2
EXAMPLE 3
Show-Result 401
Sitecore PowerShell Extensions
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.
yes
no
cancel
2010-2015 Adam Najmanowicz - Cognifide Limited, Michael West. All rights reserved. Sitecore PowerShell Extensions
Parameters
-Title <String>
Aliases
Required? false
Position? named
Default Value
-Width <Int32>
Aliases
Required? false
Position? named
Default Value
Show-YesNoCancel 403
Sitecore PowerShell Extensions
-Height <Int32>
Aliases
Required? false
Position? named
Default Value
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
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[]> -Path <String> [-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
-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
-Item <Item>
Aliases
Required? true
Position? named
Default Value
-Path <String>
Aliases
Required? true
Position? named
Default Value
-ScriptBlock <ScriptBlock>
Script to be executed.
Start-ScriptSession 406
Sitecore PowerShell Extensions
Aliases
Required? true
Position? named
Default Value
-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
-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
-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
-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
-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
-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
-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
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
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]
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>
Aliases
Required? true
Position? named
Default Value
-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
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
-Id <String>
Aliases
Required? true
Position? named
Default Value
-Database <String>
Aliases
Required? false
Position? named
Default Value
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
Examples
EXAMPLE 1
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
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[]>
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
-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
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.
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>
Aliases
Required? false
Position? 1
Default Value
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
EXAMPLE 2
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>
Aliases
Required? false
Position? 1
Default Value
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
EXAMPLE 2
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
-AccountType <String>
All
Role
User
Aliases
Required? false
Position? named
Default Value
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
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 -Path
Test-ItemAcl -Id
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>
Aliases
Required? true
Position? named
Default Value
-Path <String>
Aliases
Required? true
Position? named
Default Value
Test-ItemAcl 422
Sitecore PowerShell Extensions
-Id <String>
Aliases
Required? true
Position? named
Default Value
-Database <String>
Aliases
Required? false
Position? named
Default Value
-AccessRight <String>
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
-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.
Local Name
Example: adam
Fully Qualified Name
Example: sitecore\adam
Aliases
Required? true
Position? named
Default Value
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
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
-InputObject <PSObject>
Item to be tested
Aliases
Required? false
Position? named
Default Value
-RuleDatabase <String>
Aliases
Test-Rule 426
Sitecore PowerShell Extensions
Required? false
Position? named
Default Value
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>'
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\
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
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]
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>
Aliases
Required? false
Position? named
Default Value
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-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
-Id <String>
Aliases
Required? true
Position? named
Default Value
-Database <String>
Aliases
Required? false
Position? named
Default Value
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
Unlock-Item 430
Sitecore PowerShell Extensions
Notes
Help Author: Adam Najmanowicz, Michael West
Examples
EXAMPLE 1
EXAMPLE 2
Unlock the Home item providing it from the pipeline and passing it back to the pipeline
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
-Instance <User>
Aliases
Required? true
Position? named
Default Value
Inputs
Unlock-User 432
Sitecore PowerShell Extensions
The input type is the type of the objects that you can pipe to the cmdlet.
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
EXAMPLE 2
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]
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>
Aliases
Required? false
Position? named
Default Value
-Item <Item>
Aliases
Required? true
Position? 1
Default Value
-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
-Id <String>
Aliases
Required? true
Position? named
Default Value
-Database <String>
Aliases
Required? false
Position? named
Default Value
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
Unprotect-Item 435
Sitecore PowerShell Extensions
Notes
Help Author: Adam Najmanowicz, Michael West
Examples
EXAMPLE 1
EXAMPLE 2
Unprotect the Home item providing it from the pipeline and passing it back to the pipeline
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
-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
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.
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
# 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]
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
-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
Wait-ScriptSession 440
Sitecore PowerShell Extensions
-Id <String[]>
Aliases
Required? true
Position? named
Default Value
-Session <ScriptSession[]>
Session(s) to be stopped.
Aliases
Required? true
Position? named
Default Value
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
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>
Aliases
Required? false
Position? 1
Default Value
-Separator <Object>
Aliases
Required? false
Position? named
Default Value
-Log <LogNotificationLevel>
Aliases
Write-Log 443
Sitecore PowerShell Extensions
Required? false
Position? named
Default Value
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
None.
Notes
Help Author: Adam Najmanowicz, Michael West
Examples
EXAMPLE
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.
Add-Rendering
SPE Cmdlet - Adds a rendering to a chosen device for the presentation of an item.
Add-RoleMember
SPE Cmdlet - Adds one or more Sitecore users to the specified role.
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
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.
ConvertFrom-ItemClone
SPE Cmdlet - Converts an item from a clone to a fully independent item.
ConvertTo-Bucket
SPE Cmdlet - ConvertTo-Bucket [-Item] []
ConvertTo-CliXml
SPE Cmdlet - Exports Microsoft .NET objects froms PowerShell to a CliXml string.
Copy-Item
Windows Cmdlet - Copies an item from one location to another.
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.
Export-Role
SPE Cmdlet - Exports (serializes) Sitecore roles to the filesystem on the server.
Export-UpdatePackage
SPE Cmdlet - Exports a Sitecore update package containing a serialization diff list.
Glossary 447
Sitecore PowerShell Extensions
Export-User
SPE Cmdlet - Export (serialize) a Sitecore user to the filesystem on the server.
Find-Item
SPE Cmdlet - Finds items using the Sitecore Content Search API.
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.
Get-Index
SPE Cmdlet - Returns Sitecore database indices.
Get-Item
Glossary 448
Sitecore PowerShell Extensions
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.
Get-ItemField
SPE Cmdlet - Retrieves item fields as either names or fields or template fields.
Get-ItemReference
SPE Cmdlet - Returns all the items linked to the specified item..
Get-ItemReferrer
Glossary 449
Sitecore PowerShell Extensions
SPE Cmdlet - Returns all the items referring to the specified item.
Get-ItemTemplate
SPE Cmdlet - Returns the item template and its base templates.
Get-ItemWorkflowEvent
SPE Cmdlet - Returns entries from the history store notifying of workflow state change for the specified item.
Get-Layout
SPE Cmdlet - Returns the layout for the specified item.
Get-LayoutDevice
SPE Cmdlet - Returns the layout for the specified device.
Get-Package
SPE Cmdlet - Loads the package definition (xml) from the specified path.
Get-Preset
SPE Cmdlet - Returns a serialization preset for use with Export-Item.
Glossary 450
Sitecore PowerShell Extensions
Get-Rendering
SPE Cmdlet - Returns a RenderingDefinition for an item using the filtering parameters.
Get-Role
SPE Cmdlet - Returns one or more Sitecore roles using the specified criteria.
Get-RoleMember
SPE Cmdlet - Returns the Sitecore users in the specified role.
Get-ScriptSession
SPE Cmdlet - Returns the list of PowerShell Extension Sessions running in the background.
Get-SearchIndex
SPE Cmdlet - Returns sitecore Search indices.
Get-Session
SPE Cmdlet - Returns one or more Sitecore user sessions using the specified criteria.
Get-SpeModule
SPE Cmdlet - Returns the object that describes a Sitecore PowerShell Extensions Module
Glossary 451
Sitecore PowerShell Extensions
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.
Get-TaskSchedule
SPE Cmdlet - Returns one or more task schedule items using the specified criteria.
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.
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.
Import-Item
SPE Cmdlet - Imports (deserializes) the specified path from the filesystem on the server as a Sitecore item.
Import-Role
SPE Cmdlet - Imports (deserializes) Sitecore roles from the Sitecore server filesystem.
Import-User
SPE Cmdlet - Imports (deserializes) Sitecore users from the Sitecore server filesystem.
Initialize-Item
SPE Cmdlet - Initializes items with the PowerShell automatic properties for each field.
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.
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.
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
Lock-Item
SPE Cmdlet - Locks the Sitecore item by the current or specified user.
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.
New-Domain
SPE Cmdlet - Creates a new domain with the specified name.
New-ExplicitFileSource
SPE Cmdlet - Creates new File source that can be added to a Sitecore package.
New-ExplicitItemSource
SPE Cmdlet - Creates new Explicit Item Source that can be added to a Sitecore package.
New-FileSource
SPE Cmdlet - Creates new File source that can be added to a Sitecore package.
New-Item
Glossary 455
Sitecore PowerShell Extensions
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.
New-ItemSource
SPE Cmdlet - Creates new Item source that can be added to a Sitecore package.
New-ItemWorkflowEvent
SPE Cmdlet - Creates new entry in the history store notifying of workflow state change.
New-Package
SPE Cmdlet - Creates a new Sitecore install package object.
New-Rendering
SPE Cmdlet - Creates new rendering definition that can later be added to an item.
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.
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.
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.
Glossary 457
Sitecore PowerShell Extensions
Remove-Item
Windows Cmdlet - Deletes the specified items.
Remove-ItemLanguage
SPE Cmdlet - Removes Language from a single item or a branch of items
Remove-Rendering
SPE Cmdlet - Removes renderings from an item.
Remove-RoleMember
SPE Cmdlet - Removes one or more Sitecore users from the specified role.
Remove-ScriptSession
SPE Cmdlet - Removes a persistent Script Session from memory.
Remove-Session
SPE Cmdlet - Removes one or more Sitecore user sessions.
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.
Set-Rendering
SPE Cmdlet - Updates rendering with new values.
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.
Show-Application
SPE Cmdlet - Executes Sitecore Sheer application.
Glossary 460
Sitecore PowerShell Extensions
Show-Confirm
SPE Cmdlet - Shows a user a confirmation request message box.
Show-FieldEditor
SPE Cmdlet - Shows Field editor for a provided item.
Show-Input
SPE Cmdlet - Shows prompt message box asking user to provide a text string.
Show-ListView
SPE Cmdlet - Sends output to an interactive table in a separate window.
Show-ModalDialog
SPE Cmdlet - Shows Sitecore Sheer control as a modal dialog.
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
Show-YesNoCancel
SPE Cmdlet - Shows Yes/No/Cancel dialog to the user and returns user choice.
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.
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.
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.
Update-ListView
SPE Cmdlet - Updates List View (created by Show-ListView) data.
Write-Log
SPE Cmdlet - Writes text to the Sitecore event log.
12.120. Write-Log
Glossary 463