diff --git a/.gitbook/assets/cli-empty (1).png b/.gitbook/assets/cli-empty (1).png new file mode 100644 index 00000000..4da87d19 Binary files /dev/null and b/.gitbook/assets/cli-empty (1).png differ diff --git a/.gitbook/assets/cli-empty.png b/.gitbook/assets/cli-empty.png new file mode 100644 index 00000000..4da87d19 Binary files /dev/null and b/.gitbook/assets/cli-empty.png differ diff --git a/.gitbook/assets/context-menu-package-generator.png b/.gitbook/assets/context-menu-package-generator.png new file mode 100644 index 00000000..a3f33758 Binary files /dev/null and b/.gitbook/assets/context-menu-package-generator.png differ diff --git a/.gitbook/assets/context-menu-task-scheduler-edit.png b/.gitbook/assets/context-menu-task-scheduler-edit.png new file mode 100644 index 00000000..9fc3b7ad Binary files /dev/null and b/.gitbook/assets/context-menu-task-scheduler-edit.png differ diff --git a/.gitbook/assets/context-menu-task-scheduler.png b/.gitbook/assets/context-menu-task-scheduler.png new file mode 100644 index 00000000..a3a260af Binary files /dev/null and b/.gitbook/assets/context-menu-task-scheduler.png differ diff --git a/.gitbook/assets/droplist.png b/.gitbook/assets/droplist.png new file mode 100644 index 00000000..a886c80d Binary files /dev/null and b/.gitbook/assets/droplist.png differ diff --git a/.gitbook/assets/event-itemadded.png b/.gitbook/assets/event-itemadded.png new file mode 100644 index 00000000..c7437efc Binary files /dev/null and b/.gitbook/assets/event-itemadded.png differ diff --git a/.gitbook/assets/experience-button-with-tooltip.png b/.gitbook/assets/experience-button-with-tooltip.png new file mode 100644 index 00000000..1bafee3d Binary files /dev/null and b/.gitbook/assets/experience-button-with-tooltip.png differ diff --git a/.gitbook/assets/get-sitecorejobs-listview.png b/.gitbook/assets/get-sitecorejobs-listview.png new file mode 100644 index 00000000..0458d1a0 Binary files /dev/null and b/.gitbook/assets/get-sitecorejobs-listview.png differ diff --git a/.gitbook/assets/gutter-publishing-status.png b/.gitbook/assets/gutter-publishing-status.png new file mode 100644 index 00000000..d7c9e525 Binary files /dev/null and b/.gitbook/assets/gutter-publishing-status.png differ diff --git a/.gitbook/assets/insert-item-powershell-task.png b/.gitbook/assets/insert-item-powershell-task.png new file mode 100644 index 00000000..f3c7ecec Binary files /dev/null and b/.gitbook/assets/insert-item-powershell-task.png differ diff --git a/.gitbook/assets/interact-with-browser-using-js.gif b/.gitbook/assets/interact-with-browser-using-js.gif new file mode 100644 index 00000000..6e50c524 Binary files /dev/null and b/.gitbook/assets/interact-with-browser-using-js.gif differ diff --git a/.gitbook/assets/ise-empty.png b/.gitbook/assets/ise-empty.png new file mode 100644 index 00000000..18aea724 Binary files /dev/null and b/.gitbook/assets/ise-empty.png differ diff --git a/.gitbook/assets/ise-help-dialog.png b/.gitbook/assets/ise-help-dialog.png new file mode 100644 index 00000000..7fd60910 Binary files /dev/null and b/.gitbook/assets/ise-help-dialog.png differ diff --git a/.gitbook/assets/ise-help-select.png b/.gitbook/assets/ise-help-select.png new file mode 100644 index 00000000..6180305c Binary files /dev/null and b/.gitbook/assets/ise-help-select.png differ diff --git a/.gitbook/assets/ise-opendialog.png b/.gitbook/assets/ise-opendialog.png new file mode 100644 index 00000000..c18afa39 Binary files /dev/null and b/.gitbook/assets/ise-opendialog.png differ diff --git a/.gitbook/assets/ise-plugins.png b/.gitbook/assets/ise-plugins.png new file mode 100644 index 00000000..b2acbbbb Binary files /dev/null and b/.gitbook/assets/ise-plugins.png differ diff --git a/.gitbook/assets/ise-settings.png b/.gitbook/assets/ise-settings.png new file mode 100644 index 00000000..c87dab85 Binary files /dev/null and b/.gitbook/assets/ise-settings.png differ diff --git a/.gitbook/assets/ise-settingstab.png b/.gitbook/assets/ise-settingstab.png new file mode 100644 index 00000000..ddc121aa Binary files /dev/null and b/.gitbook/assets/ise-settingstab.png differ diff --git a/.gitbook/assets/library-createnewmodule.png b/.gitbook/assets/library-createnewmodule.png new file mode 100644 index 00000000..37fd82f5 Binary files /dev/null and b/.gitbook/assets/library-createnewmodule.png differ diff --git a/.gitbook/assets/library-createscript.png b/.gitbook/assets/library-createscript.png new file mode 100644 index 00000000..c85215a8 Binary files /dev/null and b/.gitbook/assets/library-createscript.png differ diff --git a/.gitbook/assets/message-input-with-ok-cancel.png b/.gitbook/assets/message-input-with-ok-cancel.png new file mode 100644 index 00000000..a25351ec Binary files /dev/null and b/.gitbook/assets/message-input-with-ok-cancel.png differ diff --git a/.gitbook/assets/modaldialog-download.png b/.gitbook/assets/modaldialog-download.png new file mode 100644 index 00000000..d61d1dc1 Binary files /dev/null and b/.gitbook/assets/modaldialog-download.png differ diff --git a/.gitbook/assets/modaldialog-readvariable.png b/.gitbook/assets/modaldialog-readvariable.png new file mode 100644 index 00000000..e9e3ac90 Binary files /dev/null and b/.gitbook/assets/modaldialog-readvariable.png differ diff --git a/.gitbook/assets/modaldialog-receivefileadvanced.png b/.gitbook/assets/modaldialog-receivefileadvanced.png new file mode 100644 index 00000000..7af5b8ba Binary files /dev/null and b/.gitbook/assets/modaldialog-receivefileadvanced.png differ diff --git a/.gitbook/assets/modaldialog-showalert.png b/.gitbook/assets/modaldialog-showalert.png new file mode 100644 index 00000000..c9270954 Binary files /dev/null and b/.gitbook/assets/modaldialog-showalert.png differ diff --git a/.gitbook/assets/modaldialog-showconfirm.png b/.gitbook/assets/modaldialog-showconfirm.png new file mode 100644 index 00000000..181f53db Binary files /dev/null and b/.gitbook/assets/modaldialog-showconfirm.png differ diff --git a/.gitbook/assets/modaldialog-showconfirmchoice.png b/.gitbook/assets/modaldialog-showconfirmchoice.png new file mode 100644 index 00000000..069050ef Binary files /dev/null and b/.gitbook/assets/modaldialog-showconfirmchoice.png differ diff --git a/.gitbook/assets/modaldialog-showfieldeditor.png b/.gitbook/assets/modaldialog-showfieldeditor.png new file mode 100644 index 00000000..6a734d26 Binary files /dev/null and b/.gitbook/assets/modaldialog-showfieldeditor.png differ diff --git a/.gitbook/assets/modaldialog-showfilebrowser.png b/.gitbook/assets/modaldialog-showfilebrowser.png new file mode 100644 index 00000000..aef41f4d Binary files /dev/null and b/.gitbook/assets/modaldialog-showfilebrowser.png differ diff --git a/.gitbook/assets/modaldialog-showinput-errortext.png b/.gitbook/assets/modaldialog-showinput-errortext.png new file mode 100644 index 00000000..fcd34377 Binary files /dev/null and b/.gitbook/assets/modaldialog-showinput-errortext.png differ diff --git a/.gitbook/assets/modaldialog-showinput.png b/.gitbook/assets/modaldialog-showinput.png new file mode 100644 index 00000000..da72b8bd Binary files /dev/null and b/.gitbook/assets/modaldialog-showinput.png differ diff --git a/.gitbook/assets/modaldialog-showlistview.png b/.gitbook/assets/modaldialog-showlistview.png new file mode 100644 index 00000000..f848a5ab Binary files /dev/null and b/.gitbook/assets/modaldialog-showlistview.png differ diff --git a/.gitbook/assets/modaldialog-showresultcolors.png b/.gitbook/assets/modaldialog-showresultcolors.png new file mode 100644 index 00000000..0e2def4c Binary files /dev/null and b/.gitbook/assets/modaldialog-showresultcolors.png differ diff --git a/.gitbook/assets/modaldialog-showresulttext.png b/.gitbook/assets/modaldialog-showresulttext.png new file mode 100644 index 00000000..36346383 Binary files /dev/null and b/.gitbook/assets/modaldialog-showresulttext.png differ diff --git a/.gitbook/assets/modaldialog-simplefilebrowser.png b/.gitbook/assets/modaldialog-simplefilebrowser.png new file mode 100644 index 00000000..bb437847 Binary files /dev/null and b/.gitbook/assets/modaldialog-simplefilebrowser.png differ diff --git a/.gitbook/assets/module-activationdisabled.png b/.gitbook/assets/module-activationdisabled.png new file mode 100644 index 00000000..cf1b510b Binary files /dev/null and b/.gitbook/assets/module-activationdisabled.png differ diff --git a/.gitbook/assets/module-createlibraries.png b/.gitbook/assets/module-createlibraries.png new file mode 100644 index 00000000..faf3c30c Binary files /dev/null and b/.gitbook/assets/module-createlibraries.png differ diff --git a/.gitbook/assets/module-createtoolboxlibrary.png b/.gitbook/assets/module-createtoolboxlibrary.png new file mode 100644 index 00000000..851480cb Binary files /dev/null and b/.gitbook/assets/module-createtoolboxlibrary.png differ diff --git a/.gitbook/assets/module-sharedfunctions.png b/.gitbook/assets/module-sharedfunctions.png new file mode 100644 index 00000000..88dea2b4 Binary files /dev/null and b/.gitbook/assets/module-sharedfunctions.png differ diff --git a/.gitbook/assets/notification-information.png b/.gitbook/assets/notification-information.png new file mode 100644 index 00000000..9ccecf83 Binary files /dev/null and b/.gitbook/assets/notification-information.png differ diff --git a/.gitbook/assets/papercut-email-response.png b/.gitbook/assets/papercut-email-response.png new file mode 100644 index 00000000..4176a3d4 Binary files /dev/null and b/.gitbook/assets/papercut-email-response.png differ diff --git a/.gitbook/assets/readme-console-ise.png b/.gitbook/assets/readme-console-ise.png new file mode 100644 index 00000000..0d03589d Binary files /dev/null and b/.gitbook/assets/readme-console-ise.png differ diff --git a/.gitbook/assets/reports-action-now-you-dont1.png b/.gitbook/assets/reports-action-now-you-dont1.png new file mode 100644 index 00000000..de1d9e39 Binary files /dev/null and b/.gitbook/assets/reports-action-now-you-dont1.png differ diff --git a/.gitbook/assets/reports-action-now-you-see-me1.png b/.gitbook/assets/reports-action-now-you-see-me1.png new file mode 100644 index 00000000..660950e9 Binary files /dev/null and b/.gitbook/assets/reports-action-now-you-see-me1.png differ diff --git a/.gitbook/assets/reports-action-save.png b/.gitbook/assets/reports-action-save.png new file mode 100644 index 00000000..ce4af126 Binary files /dev/null and b/.gitbook/assets/reports-action-save.png differ diff --git a/.gitbook/assets/reports-action-script1.png b/.gitbook/assets/reports-action-script1.png new file mode 100644 index 00000000..13c7743e Binary files /dev/null and b/.gitbook/assets/reports-action-script1.png differ diff --git a/.gitbook/assets/reports-action-scripts.png b/.gitbook/assets/reports-action-scripts.png new file mode 100644 index 00000000..aba52815 Binary files /dev/null and b/.gitbook/assets/reports-action-scripts.png differ diff --git a/.gitbook/assets/reports-action-update-listview.png b/.gitbook/assets/reports-action-update-listview.png new file mode 100644 index 00000000..fc94aeb8 Binary files /dev/null and b/.gitbook/assets/reports-action-update-listview.png differ diff --git a/.gitbook/assets/reports-action-write-progress.png b/.gitbook/assets/reports-action-write-progress.png new file mode 100644 index 00000000..b7a355c9 Binary files /dev/null and b/.gitbook/assets/reports-action-write-progress.png differ diff --git a/.gitbook/assets/reports-commands-result.png b/.gitbook/assets/reports-commands-result.png new file mode 100644 index 00000000..70076d7f Binary files /dev/null and b/.gitbook/assets/reports-commands-result.png differ diff --git a/.gitbook/assets/reports-commands.png b/.gitbook/assets/reports-commands.png new file mode 100644 index 00000000..30427a2a Binary files /dev/null and b/.gitbook/assets/reports-commands.png differ diff --git a/.gitbook/assets/reports-menuwithaccess.png b/.gitbook/assets/reports-menuwithaccess.png new file mode 100644 index 00000000..e0b32443 Binary files /dev/null and b/.gitbook/assets/reports-menuwithaccess.png differ diff --git a/.gitbook/assets/reports-menuwithoutaccess.png b/.gitbook/assets/reports-menuwithoutaccess.png new file mode 100644 index 00000000..54fb6ed1 Binary files /dev/null and b/.gitbook/assets/reports-menuwithoutaccess.png differ diff --git a/.gitbook/assets/reports-output.png b/.gitbook/assets/reports-output.png new file mode 100644 index 00000000..8c3a4441 Binary files /dev/null and b/.gitbook/assets/reports-output.png differ diff --git a/.gitbook/assets/reports-schedule-action.png b/.gitbook/assets/reports-schedule-action.png new file mode 100644 index 00000000..3f176974 Binary files /dev/null and b/.gitbook/assets/reports-schedule-action.png differ diff --git a/.gitbook/assets/reports-script-rule.png b/.gitbook/assets/reports-script-rule.png new file mode 100644 index 00000000..6e7f1038 Binary files /dev/null and b/.gitbook/assets/reports-script-rule.png differ diff --git a/.gitbook/assets/reports-script-runtime-settings.png b/.gitbook/assets/reports-script-runtime-settings.png new file mode 100644 index 00000000..cc900598 Binary files /dev/null and b/.gitbook/assets/reports-script-runtime-settings.png differ diff --git a/.gitbook/assets/reports-unusedmedia.png b/.gitbook/assets/reports-unusedmedia.png new file mode 100644 index 00000000..6f822e2a Binary files /dev/null and b/.gitbook/assets/reports-unusedmedia.png differ diff --git a/.gitbook/assets/reports-vieweraccess.png b/.gitbook/assets/reports-vieweraccess.png new file mode 100644 index 00000000..dfd41715 Binary files /dev/null and b/.gitbook/assets/reports-vieweraccess.png differ diff --git a/.gitbook/assets/reports.png b/.gitbook/assets/reports.png new file mode 100644 index 00000000..5672c2e8 Binary files /dev/null and b/.gitbook/assets/reports.png differ diff --git a/.gitbook/assets/ribbon-script-button-size.png b/.gitbook/assets/ribbon-script-button-size.png new file mode 100644 index 00000000..28981715 Binary files /dev/null and b/.gitbook/assets/ribbon-script-button-size.png differ diff --git a/.gitbook/assets/ribbon-script-button-size2.png b/.gitbook/assets/ribbon-script-button-size2.png new file mode 100644 index 00000000..8278dc8a Binary files /dev/null and b/.gitbook/assets/ribbon-script-button-size2.png differ diff --git a/.gitbook/assets/ribbon-script-structure.png b/.gitbook/assets/ribbon-script-structure.png new file mode 100644 index 00000000..6d8d1c20 Binary files /dev/null and b/.gitbook/assets/ribbon-script-structure.png differ diff --git a/.gitbook/assets/script-editise.png b/.gitbook/assets/script-editise.png new file mode 100644 index 00000000..70b78fc2 Binary files /dev/null and b/.gitbook/assets/script-editise.png differ diff --git a/.gitbook/assets/script-importfunction.png b/.gitbook/assets/script-importfunction.png new file mode 100644 index 00000000..3f79c963 Binary files /dev/null and b/.gitbook/assets/script-importfunction.png differ diff --git a/.gitbook/assets/scriptlibrary-sharedfunctions.png b/.gitbook/assets/scriptlibrary-sharedfunctions.png new file mode 100644 index 00000000..7bc10eb2 Binary files /dev/null and b/.gitbook/assets/scriptlibrary-sharedfunctions.png differ diff --git a/.gitbook/assets/security-elevatedsessionstate-contenteditor.png b/.gitbook/assets/security-elevatedsessionstate-contenteditor.png new file mode 100644 index 00000000..748a8f7a Binary files /dev/null and b/.gitbook/assets/security-elevatedsessionstate-contenteditor.png differ diff --git a/.gitbook/assets/security-elevatedsessionstate-dropcontenteditor.png b/.gitbook/assets/security-elevatedsessionstate-dropcontenteditor.png new file mode 100644 index 00000000..784efb4d Binary files /dev/null and b/.gitbook/assets/security-elevatedsessionstate-dropcontenteditor.png differ diff --git a/.gitbook/assets/security-elevatedsessionstate-dropise.png b/.gitbook/assets/security-elevatedsessionstate-dropise.png new file mode 100644 index 00000000..108f1098 Binary files /dev/null and b/.gitbook/assets/security-elevatedsessionstate-dropise.png differ diff --git a/.gitbook/assets/security-elevatedsessionstate-ise.png b/.gitbook/assets/security-elevatedsessionstate-ise.png new file mode 100644 index 00000000..cd2653fc Binary files /dev/null and b/.gitbook/assets/security-elevatedsessionstate-ise.png differ diff --git a/.gitbook/assets/security-elevatedsessionstate-password.png b/.gitbook/assets/security-elevatedsessionstate-password.png new file mode 100644 index 00000000..2cbdfba4 Binary files /dev/null and b/.gitbook/assets/security-elevatedsessionstate-password.png differ diff --git a/.gitbook/assets/task-createtaskwithscripts.png b/.gitbook/assets/task-createtaskwithscripts.png new file mode 100644 index 00000000..69aab15a Binary files /dev/null and b/.gitbook/assets/task-createtaskwithscripts.png differ diff --git a/.gitbook/assets/task-edittaskschedule.png b/.gitbook/assets/task-edittaskschedule.png new file mode 100644 index 00000000..1690f269 Binary files /dev/null and b/.gitbook/assets/task-edittaskschedule.png differ diff --git a/.gitbook/assets/task-inserttask.png b/.gitbook/assets/task-inserttask.png new file mode 100644 index 00000000..48fb2ebd Binary files /dev/null and b/.gitbook/assets/task-inserttask.png differ diff --git a/.gitbook/assets/task-runedittask.png b/.gitbook/assets/task-runedittask.png new file mode 100644 index 00000000..fe7ed643 Binary files /dev/null and b/.gitbook/assets/task-runedittask.png differ diff --git a/.gitbook/assets/tasks-archiveschedule.png b/.gitbook/assets/tasks-archiveschedule.png new file mode 100644 index 00000000..dae1c454 Binary files /dev/null and b/.gitbook/assets/tasks-archiveschedule.png differ diff --git a/.gitbook/assets/tasks-powershellscriptcommand.png b/.gitbook/assets/tasks-powershellscriptcommand.png new file mode 100644 index 00000000..4b56df34 Binary files /dev/null and b/.gitbook/assets/tasks-powershellscriptcommand.png differ diff --git a/.gitbook/assets/toolbox-indexviewer-chooseindex.png b/.gitbook/assets/toolbox-indexviewer-chooseindex.png new file mode 100644 index 00000000..4052cadc Binary files /dev/null and b/.gitbook/assets/toolbox-indexviewer-chooseindex.png differ diff --git a/.gitbook/assets/toolbox-indexviewer-filterresults.png b/.gitbook/assets/toolbox-indexviewer-filterresults.png new file mode 100644 index 00000000..89070728 Binary files /dev/null and b/.gitbook/assets/toolbox-indexviewer-filterresults.png differ diff --git a/.gitbook/assets/toolbox-indexviewer-results.png b/.gitbook/assets/toolbox-indexviewer-results.png new file mode 100644 index 00000000..22e552b5 Binary files /dev/null and b/.gitbook/assets/toolbox-indexviewer-results.png differ diff --git a/.gitbook/assets/toolbox-indexviewer-showinfo.png b/.gitbook/assets/toolbox-indexviewer-showinfo.png new file mode 100644 index 00000000..6fabc585 Binary files /dev/null and b/.gitbook/assets/toolbox-indexviewer-showinfo.png differ diff --git a/.gitbook/assets/toolbox-list.png b/.gitbook/assets/toolbox-list.png new file mode 100644 index 00000000..b6e29549 Binary files /dev/null and b/.gitbook/assets/toolbox-list.png differ diff --git a/.gitbook/assets/toolbox-newitem.png b/.gitbook/assets/toolbox-newitem.png new file mode 100644 index 00000000..dc0936ee Binary files /dev/null and b/.gitbook/assets/toolbox-newitem.png differ diff --git a/.gitbook/assets/warning-notification-for-licensing.png b/.gitbook/assets/warning-notification-for-licensing.png new file mode 100644 index 00000000..d6da8d64 Binary files /dev/null and b/.gitbook/assets/warning-notification-for-licensing.png differ diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..9906ce67 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +github: [michaellwest] diff --git a/.gitignore b/.gitignore index 1a366fb0..71a77ce7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Node rules: -## Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +## Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) .grunt ## Dependency directory @@ -13,4 +13,5 @@ _book # eBook build output *.epub *.mobi -*.pdf \ No newline at end of file +*.pdf +/.vs diff --git a/README.md b/README.md index 4755e94a..62e3d290 100644 --- a/README.md +++ b/README.md @@ -1,91 +1,94 @@ -# ![](images/logos/logo-45x45.jpg) Sitecore PowerShell Extensions: a command line and scripting tool +# Introduction -![Sitecore PowerShell Extensions](/images/screenshots/cover/readme-console-ise.png) +![Sitecore PowerShell Extensions](.gitbook/assets/readme-console-ise.png) -The [Sitecore PowerShell Extensions](https://marketplace.sitecore.net/Modules/Sitecore_PowerShell_console.aspx) \(SPE\) module is a Sitecore development accelerator which can drastically increase your productivity and curtail the amount of time it takes to deliver a Sitecore solution. +## About the Module -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. +The [Sitecore PowerShell Extensions](https://github.com/SitecorePowerShell/Console) \(SPE\) module is a Sitecore development accelerator that can drastically increase your productivity and curtail the amount of time it takes to deliver a Sitecore solution. -Below are some of the things you get with SPE: +The module provides a command line \(CLI\) and a 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](toolbox.md) -* [Scheduled Task Manager](toolbox.md) -* [Report Runner](reports.md) -* [User Session Manager](toolbox.md) -* [Bulk Rename/Remove/Create Tool](working-with-items.md) -* Data Importer -* ~~Professional Chef~~ +{% hint style="info" %} +The book provides documentation about how to use the module based on the latest released version. While some of the screenshots and materials may be slightly out-of-date, you will inevitably find details referring to something that doesn't exist on your installed version. Feel free to submit a pull request for corrections [here](https://github.com/SitecorePowerShell/Book). +{% endhint %} -#### Bundled Tools +{% hint style="warning" %} +Support for Sitecore 7 has discontinued with SPE 5.0. Check the [appendix](appendix/README.md) for version compatibility. +{% endhint %} + +## Development Team + +* [Adam Najmanowicz](https://blog.najmanowicz.com/) \| [@adamnaj](https://twitter.com/adamnaj) +* [Michael West](https://michaellwest.blogspot.com/) \| [@michaelwest101](https://twitter.com/MichaelWest101) + +## Bundled Tools The following are some helpful modules distributed with SPE. -* **Bundle** - * Authoring Instrumentation - * Copy Renderings - * Package Generator - * Publishing Status Gutter * **Core** * Platform + * PowerShell Background Session Manager + * Recreate site from sitemap + * X-UnitTests - examples at how to use [Pester](https://github.com/pester/Pester) to test your scripts +* **Extensions** + * [Authorable Reports](modules/integration-points/reports/authoring-reports.md) - reports based on the Sitecore Rules Engine. + * [Index Viewer](modules/integration-points/toolbox.md) - similar to the Luke tool * **Maintenance** * Index On Demand * Media Library Maintenance * System Maintenance * Task Management - * User Management - * User Session Management + * [Scheduled Task Manager](modules/integration-points/toolbox.md) * **Reporting** - * Authorable Reports - reports based on the Sitecore Rules Engine. - * Content Reports - variety of reports to help audit the Sitecore solution. + * [Content Reports](modules/integration-points/reports/) - variety of reports to help audit the Sitecore solution. * **Samples** * Automatically show quick info section * Enforce user password expiration * Example Event Handlers - * Getting Started + * Getting Started - includes the Kitchen Sink Demo for `Read-Variable`. * License Expiration * Random desktop background + * Training Modules * Unlock user items on logout +* **Tools** + * Authoring Instrumentation + * Copy Renderings + * Data Management + * Bulk Data Generator - useful for items and users + * Bulk Item Restorer - restore items from recycle bin + * Bulk Template Changer - can't think of a better description than this + * Data Importer - create or update items from a Csv + * Find and Replace - use Content Search to change text + * Elevated Unlock - provides options to unlock items using delegated administration + * Package Generator - a simple method to package up items + * Publishing Status Gutter + * Security Management + * Logged in Session Manager + * Transfer item security +* **Training** -#### Community Add-ons - -The following are Sitecore modules that enhance the SPE experience. - -* [SPE Image Importer](https://marketplace.sitecore.net/en/Modules/S/SPE_Image_Uploader_Module10.aspx) : [Himadri Chakrabarti](https://twitter.com/himadric) -* [Multi-Item Publish](http://www.sitecorenutsbolts.net/2015/12/14/Multi-Item-Publish-with-Sitecore-Powershell-Extensions/) : [Richard Seal](https://twitter.com/rich_seal) -* [ActiveCommerce PowerShell Extensions](https://github.com/ActiveCommerce/activecommerce-powershell-extensions) : [Nick Wesselman](https://twitter.com/techphoria414) - -#### 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](https://twitter.com/adeneys) - Sitecore Symposium 2012 - -Recommended by [John West](https://twitter.com/sitecorejohn) to use as a tool for [maximizing Sitecore developer productivity](http://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2015/02/maximize-sitecore-developer-productivity.aspx). - -_"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](https://marketplace.sitecore.net/Modules/Sitecore_PowerShell_console.aspx)'s comment on Marketplace - -_"Thank you for the GitBook. Invaluable Reference."_ - [Nick Wesselman](https://twitter.com/techphoria414)'s [tweet](https://twitter.com/techphoria414/status/632033887632289792) +## Endorsements -#### Training Material +> _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](https://twitter.com/adeneys) - Sitecore Symposium 2012 -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. +> Recommended by [John West](https://twitter.com/sitecorejohn) to use as a tool for [maximizing Sitecore developer productivity](https://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2015/02/maximize-sitecore-developer-productivity.aspx). -We have a video series available to help walk you through the module [here](https://www.youtube.com/playlist?list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b). +> _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](https://marketplace.sitecore.net/Modules/Sitecore_PowerShell_console.aspx)'s comment on Marketplace -We also maintain a comprehensive list of links to [blogs and videos](http://blog.najmanowicz.com/sitecore-powershell-console/) to help you on your journey to SPE awesomeness. Happy coding! +> _Thank you for the GitBook. Invaluable Reference._ - [Nick Wesselman](https://twitter.com/techphoria414)'s [tweet](https://twitter.com/techphoria414/status/632033887632289792) -#### Development Team +> _The Sitecore powershell tools are absurdly good and helpful. I know they make a lot of people nervous, but they are incredibly well managed. Everybody should learn to sling some shell in Sitecore, you'll never look back._ - [Christopher Campbell](https://twitter.com/RehbellOne) [tweet](https://twitter.com/RehbellOne/status/1058048820435607552) -* [Adam Najmanowicz](http://blog.najmanowicz.com/) \| [@adamnaj](https://twitter.com/adamnaj) -* [Michael West](http://michaellwest.blogspot.com/) \| [@michaelwest101](https://twitter.com/MichaelWest101) +> _I literally couldn't work without SPE - I can't remember the last implementation I did that _didn't_ have it installed lol_ +> _@michaellwest & @adamnaj better not ever retire it :smile:_ - [Richard Seal](https://twitter.com/rich_seal) -#### Help and Support +## Help and Support See the [Troubleshooting](troubleshooting.md) section for some common fixes. -Questions, comments, and feature requests should be submitted on [GitHub](https://git.io/spe). You may also check out the \[SPE Slack channel\]\[21\] for more interactive support. Not on Slack yet? Contact us on Twitter and we'll send you an invite. +Questions, comments, and feature requests should be submitted on [GitHub](https://git.io/spe). You may also check out the [SPE Slack channel](https://sitecorechat.slack.com/messages/module-spe/) for more interactive support. Not on Slack yet? Contact us on Twitter and we'll send you an invite. **Disclaimer:** With great power comes great responsibility – this tool can do a lot of good but also bring harm to a lot of content in a very short time – backup your system before running a script that modifies your content and never run any untested scripts in a production environment! We will not be held responsible for any use of it. Test your scripts on your development server first! Test on an exact copy of production before running scripts on production content. -\[21\]: [https://sitecorechat.slack.com/messages/module-spe/](https://sitecorechat.slack.com/messages/module-spe/) - diff --git a/SUMMARY.md b/SUMMARY.md index cc2a5513..4b8724e3 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -1,173 +1,203 @@ -# Summary +# Table of contents * [Introduction](README.md) * [Disclaimer](disclaimer.md) -* [Installation](installation.md) - * [Contributor Guide](contributor-guide.md) -* [Interfaces](interfaces.md) - * [Console](console.md) - * [Scripting](scripting.md) - * [Interface Configuration](interface-configuration.md) - * [Interactive Dialogs](interactive-dialogs.md) -* [Working with Items](working-with-items.md) - * [Item Languages](item-languages.md) - * [Item Renderings](item-renderings.md) -* [Modules](modules.md) - * [Libraries and Scripts](libraries-and-scripts.md) - * [Integration Points](integration-points.md) - * [Content Editor](content-editor.md) - * [Control Panel](control-panel.md) - * [Data Sources](data-sources.md) - * [Event Handlers](event-handlers.md) - * [Functions](functions.md) - * [Page Editor](page-editor.md) - * [Pipelines](pipelines.md) - * [Reports](reports.md) - * [Authoring Reports](authoring-reports.md) - * [Tasks](tasks.md) - * [Authoring Tasks](authoring-tasks.md) - * [Toolbox](toolbox.md) - * [Web API](web-api.md) - * [Workflows](workflows.md) +* [Installation](installation/README.md) + * [Contributor Guide](installation/contributor-guide.md) +* [Training](training.md) +* [Community](community.md) +* [Interfaces](interfaces/README.md) + * [Console](interfaces/console.md) + * [Scripting](interfaces/scripting.md) + * [Interface Configuration](interfaces/interface-configuration.md) + * [Interactive Dialogs](interfaces/interactive-dialogs.md) + * [Help](interfaces/help.md) +* [Working with Items](working-with-items/README.md) + * [Item Languages](working-with-items/item-languages.md) + * [Item Renderings](working-with-items/item-renderings.md) + * [Variables](working-with-items/variables.md) + * [Providers](working-with-items/providers.md) +* [Modules](modules/README.md) + * [Libraries and Scripts](modules/libraries-and-scripts.md) + * [Integration Points](modules/integration-points/README.md) + * [Content Editor](modules/integration-points/content-editor.md) + * [Control Panel](modules/integration-points/control-panel.md) + * [Data Sources](modules/integration-points/data-sources.md) + * [Event Handlers](modules/integration-points/event-handlers.md) + * [Functions](modules/integration-points/functions.md) + * [ISE Plugins](modules/integration-points/ise-plugins.md) + * [Page Editor](modules/integration-points/page-editor.md) + * [Pipelines](modules/integration-points/pipelines.md) + * [Reports](modules/integration-points/reports/README.md) + * [Authoring Reports](modules/integration-points/reports/authoring-reports.md) + * [Tasks](modules/integration-points/tasks/README.md) + * [Authoring Tasks](modules/integration-points/tasks/authoring-tasks.md) + * [Toolbox](modules/integration-points/toolbox.md) + * [Web API](modules/integration-points/web-api.md) + * [Workflows](modules/integration-points/workflows.md) + * [Packaging](modules/packaging.md) * [Remoting](remoting.md) -* [Security](security.md) - * [Users and Roles](users-and-roles.md) +* [Security](security/README.md) + * [Users and Roles](security/users-and-roles.md) * [Releases](releases.md) * [Troubleshooting](troubleshooting.md) -* [Code Snippets](code-snippets.md) -* [Appendix](appendix.md) - * [Common](appendix/common.md) - * [Add-BaseTemplate](appendix/commands/Add-BaseTemplate.md) - * [Add-ItemVersion](appendix/commands/Add-ItemVersion.md) - * [Add-Rendering](appendix/commands/Add-Rendering.md) - * [Close-Window](appendix/commands/Close-Window.md) - * [ConvertFrom-CliXml](appendix/commands/ConvertFrom-CliXml.md) - * [ConvertFrom-ItemClone](appendix/commands/ConvertFrom-ItemClone.md) - * [ConvertTo-CliXml](appendix/commands/ConvertTo-CliXml.md) - * [Expand-Token](appendix/commands/Expand-Token.md) - * [Get-Archive](appendix/commands/Get-Archive.md) - * [Get-Cache](appendix/commands/Get-Cache.md) - * [Get-Database](appendix/commands/Get-Database.md) - * [Get-ItemClone](appendix/commands/Get-ItemClone.md) - * [Get-ItemCloneNotification](appendix/commands/Get-ItemCloneNotification.md) - * [Get-ItemField](appendix/commands/Get-ItemField.md) - * [Get-ItemReference](appendix/commands/Get-ItemReference.md) - * [Get-ItemReferrer](appendix/commands/Get-ItemReferrer.md) - * [Get-ItemTemplate](appendix/commands/Get-ItemTemplate.md) - * [Get-ItemWorkflowEvent](appendix/commands/Get-ItemWorkflowEvent.md) - * [Get-Layout](appendix/commands/Get-Layout.md) - * [Get-LayoutDevice](appendix/commands/Get-LayoutDevice.md) - * [Get-Preset](appendix/commands/Get-Preset.md) - * [Get-Rendering](appendix/commands/Get-Rendering.md) - * [Get-SpeModule](appendix/commands/Get-SpeModule.md) - * [Get-SpeModuleFeatureRoot](appendix/commands/Get-SpeModuleFeatureRoot.md) - * [Get-TaskSchedule](appendix/commands/Get-TaskSchedule.md) - * [Get-UserAgent](appendix/commands/Get-UserAgent.md) - * [Import-Function](appendix/commands/Import-Function.md) - * [Invoke-JavaScript](appendix/commands/Invoke-JavaScript.md) - * [Invoke-Script](appendix/commands/Invoke-Script.md) - * [Invoke-ShellCommand](appendix/commands/Invoke-ShellCommand.md) - * [Invoke-Workflow](appendix/commands/Invoke-Workflow.md) - * [Merge-Layout](appendix/commands/Merge-Layout.md) - * [New-ItemClone](appendix/commands/New-ItemClone.md) - * [New-ItemWorkflowEvent](appendix/commands/New-ItemWorkflowEvent.md) - * [New-Rendering](appendix/commands/New-Rendering.md) - * [New-UsingBlock](appendix/commands/New-UsingBlock.md) - * [Out-Download](appendix/commands/Out-Download.md) - * [Publish-Item](appendix/commands/Publish-Item.md) - * [Read-Variable](appendix/commands/Read-Variable.md) - * [Receive-File](appendix/commands/Receive-File.md) - * [Receive-ItemCloneNotification](appendix/commands/Receive-ItemCloneNotification.md) - * [Remove-BaseTemplate](appendix/commands/Remove-BaseTemplate.md) - * [Remove-ItemVersion](appendix/commands/Remove-ItemVersion.md) - * [Remove-Rendering](appendix/commands/Remove-Rendering.md) - * [Reset-ItemField](appendix/commands/Reset-ItemField.md) - * [Reset-Layout](appendix/commands/Reset-Layout.md) - * [Restart-Application](appendix/commands/Restart-Application.md) - * [Send-File](appendix/commands/Send-File.md) - * [Send-SheerMessage](appendix/commands/Send-SheerMessage.md) - * [Set-HostProperty](appendix/commands/Set-HostProperty.md) - * [Set-ItemTemplate](appendix/commands/Set-ItemTemplate.md) - * [Set-Layout](appendix/commands/Set-Layout.md) - * [Set-Rendering](appendix/commands/Set-Rendering.md) - * [Show-Alert](appendix/commands/Show-Alert.md) - * [Show-Application](appendix/commands/Show-Application.md) - * [Show-Confirm](appendix/commands/Show-Confirm.md) - * [Show-FieldEditor](appendix/commands/Show-FieldEditor.md) - * [Show-Input](appendix/commands/Show-Input.md) - * [Show-ListView](appendix/commands/Show-ListView.md) - * [Show-ModalDialog](appendix/commands/Show-ModalDialog.md) - * [Show-Result](appendix/commands/Show-Result.md) - * [Show-YesNoCancel](appendix/commands/Show-YesNoCancel.md) - * [Start-TaskSchedule](appendix/commands/Start-TaskSchedule.md) - * [Test-BaseTemplate](appendix/commands/Test-BaseTemplate.md) - * [Test-Rule](appendix/commands/Test-Rule.md) - * [Update-ListView](appendix/commands/Update-ListView.md) - * [Write-Log](appendix/commands/Write-Log.md) - * [Packaging](appendix/packaging.md) - * [Export-Item](appendix/commands/Export-Item.md) - * [Export-Package](appendix/commands/Export-Package.md) - * [Export-UpdatePackage](appendix/commands/Export-UpdatePackage.md) - * [Get-Package](appendix/commands/Get-Package.md) - * [Get-UpdatePackageDiff](appendix/commands/Get-UpdatePackageDiff.md) - * [Import-Item](appendix/commands/Import-Item.md) - * [Install-Package](appendix/commands/Install-Package.md) - * [Install-UpdatePackage](appendix/commands/Install-UpdatePackage.md) - * [New-ExplicitFileSource](appendix/commands/New-ExplicitFileSource.md) - * [New-ExplicitItemSource](appendix/commands/New-ExplicitItemSource.md) - * [New-FileSource](appendix/commands/New-FileSource.md) - * [New-ItemSource](appendix/commands/New-ItemSource.md) - * [Import-Item](appendix/commands/Import-Item.md) - * [Indexing](appendix/indexing.md) - * [Find-Item](appendix/commands/Find-Item.md) - * [Get-SearchIndex](appendix/commands/Get-SearchIndex.md) - * [Initialize-Item](appendix/commands/Initialize-Item.md) - * [Initialize-SearchIndex](appendix/commands/Initialize-SearchIndex.md) - * [Initialize-SearchIndexItem](appendix/commands/Initialize-SearchIndexItem.md) - * [Remove-SearchIndexItem](appendix/commands/Remove-SearchIndexItem.md) - * [Resume-SearchIndex](appendix/commands/Resume-SearchIndex.md) - * [Stop-SearchIndex](appendix/commands/Stop-SearchIndex.md) - * [Suspend-SearchIndex](appendix/commands/Suspend-SearchIndex.md) - * [Security](appendix/security.md) - * [Add-ItemAcl](appendix/commands/Add-ItemAcl.md) - * [Add-RoleMember](appendix/commands/Add-RoleMember.md) - * [Clear-ItemAcl](appendix/commands/Clear-ItemAcl.md) - * [Clear-ItemAcl](appendix/commands/Clear-ItemAcl.md) - * [Disable-User](appendix/commands/Disable-User.md) - * [Enable-User](appendix/commands/Enable-User.md) - * [Export-Role](appendix/commands/Export-Role.md) - * [Export-User](appendix/commands/Export-User.md) - * [Get-Domain](appendix/commands/Get-Domain.md) - * [Get-ItemAcl](appendix/commands/Get-ItemAcl.md) - * [Get-Role](appendix/commands/Get-Role.md) - * [Get-RoleMember](appendix/commands/Get-RoleMember.md) - * [Get-User](appendix/commands/Get-User.md) - * [Import-Role](appendix/commands/Import-Role.md) - * [Import-User](appendix/commands/Import-User.md) - * [New-Domain](appendix/commands/New-Domain.md) - * [New-ItemAcl](appendix/commands/New-ItemAcl.md) - * [New-Role](appendix/commands/New-Role.md) - * [New-User](appendix/commands/New-User.md) - * [Protect-Item](appendix/commands/Protect-Item.md) - * [Remove-Domain](appendix/commands/Remove-Domain.md) - * [Remove-Role](appendix/commands/Remove-Role.md) - * [Remove-RoleMember](appendix/commands/Remove-RoleMember.md) - * [Remove-User](appendix/commands/Remove-User.md) - * [Set-ItemAcl](appendix/commands/Set-ItemAcl.md) - * [Set-User](appendix/commands/Set-User.md) - * [Set-UserPassword](appendix/commands/Set-UserPassword.md) - * [Test-Account](appendix/commands/Test-Account.md) - * [Test-ItemAcl](appendix/commands/Test-ItemAcl.md) - * [Unlock-Item](appendix/commands/Unlock-Item.md) - * [Unprotect-Item](appendix/commands/Unprotect-Item.md) - * [Unlock-User](appendix/commands/Unlock-User.md) - * [Session](appendix/session.md) - * [Get-ScriptSession](appendix/commands/Get-ScriptSession.md) - * [Get-Session](appendix/commands/Get-Session.md) - * [Receive-ScriptSession](appendix/commands/Receive-ScriptSession.md) - * [Remove-ScriptSession](appendix/commands/Remove-ScriptSession.md) - * [Remove-Session](appendix/commands/Remove-Session.md) - * [Start-ScriptSession](appendix/commands/Start-ScriptSession.md) - * [Stop-ScriptSession](appendix/commands/Stop-ScriptSession.md) - * [Wait-ScriptSession](appendix/commands/Wait-ScriptSession.md) +* [Code Snippets](code-snippets/README.md) + * [Item Links](code-snippets/item-links.md) + * [Field Types](code-snippets/field-types.md) + * [Manage Templates](code-snippets/manage-templates.md) +* [Appendix](appendix/README.md) + * [Common](appendix/common/README.md) + * [Add-BaseTemplate](appendix/common/add-basetemplate.md) + * [Add-ItemVersion](appendix/common/add-itemversion.md) + * [Close-Window](appendix/common/close-window.md) + * [ConvertFrom-CliXml](appendix/common/convertfrom-clixml.md) + * [ConvertFrom-ItemClone](appendix/common/convertfrom-itemclone.md) + * [ConvertTo-CliXml](appendix/common/convertto-clixml.md) + * [Expand-Token](appendix/common/expand-token.md) + * [Get-Archive](appendix/common/get-archive.md) + * [Get-ArchiveItem](appendix/common/get-archiveitem.md) + * [Get-Cache](appendix/common/get-cache.md) + * [Get-Database](appendix/common/get-database.md) + * [Get-ItemClone](appendix/common/get-itemclone.md) + * [Get-ItemCloneNotification](appendix/common/get-itemclonenotification.md) + * [Get-ItemField](appendix/common/get-itemfield.md) + * [Get-ItemReference](appendix/common/get-itemreference.md) + * [Get-ItemReferrer](appendix/common/get-itemreferrer.md) + * [Get-ItemTemplate](appendix/common/get-itemtemplate.md) + * [Get-ItemWorkflowEvent](appendix/common/get-itemworkflowevent.md) + * [Get-SitecoreJob](appendix/common/get-sitecorejob.md) + * [Get-SpeModule](appendix/common/get-spemodule.md) + * [Get-SpeModuleFeatureRoot](appendix/common/get-spemodulefeatureroot.md) + * [Get-TaskSchedule](appendix/common/get-taskschedule.md) + * [Get-UserAgent](appendix/common/get-useragent.md) + * [Import-Function](appendix/common/import-function.md) + * [Invoke-JavaScript](appendix/common/invoke-javascript.md) + * [Invoke-Script](appendix/common/invoke-script.md) + * [Invoke-ShellCommand](appendix/common/invoke-shellcommand.md) + * [Invoke-Workflow](appendix/common/invoke-workflow.md) + * [New-ItemClone](appendix/common/new-itemclone.md) + * [New-ItemWorkflowEvent](appendix/common/new-itemworkflowevent.md) + * [New-UsingBlock](appendix/common/new-usingblock.md) + * [Out-Download](appendix/common/out-download.md) + * [Publish-Item](appendix/common/publish-item.md) + * [Read-Variable](appendix/common/read-variable.md) + * [Receive-File](appendix/common/receive-file.md) + * [Receive-ItemCloneNotification](appendix/common/receive-itemclonenotification.md) + * [Remove-BaseTemplate](appendix/common/remove-basetemplate.md) + * [Remove-ArchiveItem](appendix/common/remove-archiveitem.md) + * [Remove-ItemVersion](appendix/common/remove-itemversion.md) + * [Reset-ItemField](appendix/common/reset-itemfield.md) + * [Restart-Application](appendix/common/restart-application.md) + * [Restore-ArchiveItem](appendix/common/restore-archiveitem.md) + * [Send-File](appendix/common/send-file.md) + * [Send-SheerMessage](appendix/common/send-sheermessage.md) + * [Set-HostProperty](appendix/common/set-hostproperty.md) + * [Set-ItemTemplate](appendix/common/set-itemtemplate.md) + * [Show-Alert](appendix/common/show-alert.md) + * [Show-Application](appendix/common/show-application.md) + * [Show-Confirm](appendix/common/show-confirm.md) + * [Show-FieldEditor](appendix/common/show-fieldeditor.md) + * [Show-Input](appendix/common/show-input.md) + * [Show-ListView](appendix/common/show-listview.md) + * [Show-ModalDialog](appendix/common/show-modaldialog.md) + * [Show-Result](appendix/common/show-result.md) + * [Show-YesNoCancel](appendix/common/show-yesnocancel.md) + * [Start-TaskSchedule](appendix/common/start-taskschedule.md) + * [Test-BaseTemplate](appendix/common/test-basetemplate.md) + * [Test-Rule](appendix/common/test-rule.md) + * [Update-ItemReferrer](appendix/common/update-itemreferrer.md) + * [Update-ListView](appendix/common/update-listview.md) + * [Write-Log](appendix/common/write-log.md) + * [Indexing](appendix/indexing/README.md) + * [Find-Item](appendix/indexing/find-item.md) + * [Get-SearchIndex](appendix/indexing/get-searchindex.md) + * [Initialize-Item](appendix/indexing/initialize-item.md) + * [Initialize-SearchIndex](appendix/indexing/initialize-searchindex.md) + * [Initialize-SearchIndexItem](appendix/indexing/initialize-searchindexitem.md) + * [Remove-SearchIndexItem](appendix/indexing/remove-searchindexitem.md) + * [Resume-SearchIndex](appendix/indexing/resume-searchindex.md) + * [Stop-SearchIndex](appendix/indexing/stop-searchindex.md) + * [Suspend-SearchIndex](appendix/indexing/suspend-searchindex.md) + * [Packaging](appendix/packaging/README.md) + * [Export-Item](appendix/packaging/export-item.md) + * [Export-Package](appendix/packaging/export-package.md) + * [Export-UpdatePackage](appendix/packaging/export-updatepackage.md) + * [Get-Package](appendix/packaging/get-package.md) + * [Get-Preset](appendix/packaging/get-preset.md) + * [Get-UpdatePackageDiff](appendix/packaging/get-updatepackagediff.md) + * [Import-Item](appendix/packaging/import-item.md) + * [Install-Package](appendix/packaging/install-package.md) + * [Install-UpdatePackage](appendix/packaging/install-updatepackage.md) + * [New-ExplicitFileSource](appendix/packaging/new-explicitfilesource.md) + * [New-ExplicitItemSource](appendix/packaging/new-explicititemsource.md) + * [New-FileSource](appendix/packaging/new-filesource.md) + * [New-ItemSource](appendix/packaging/new-itemsource.md) + * [New-SecuritySource](appendix/packaging/new-securitysource.md) + * [Import-Item](appendix/packaging/import-item-1.md) + * [New-Package](appendix/packaging/new-package.md) + * [Presentation](appendix/presentation/README.md) + * [Add-PlaceholderSetting](appendix/presentation/add-placeholdersetting.md) + * [Add-Rendering](appendix/presentation/add-rendering.md) + * [Get-Layout](appendix/presentation/get-layout.md) + * [Get-LayoutDevice](appendix/presentation/get-layoutdevice.md) + * [Get-PlaceholderSetting](appendix/presentation/get-placeholdersetting.md) + * [Get-Rendering](appendix/presentation/get-rendering.md) + * [Get-RenderingParameter](appendix/presentation/get-renderingparameter.md) + * [Merge-Layout](appendix/presentation/merge-layout.md) + * [New-PlaceholderSetting](appendix/presentation/new-placeholdersetting.md) + * [New-Rendering](appendix/presentation/new-rendering.md) + * [Remove-PlaceholderSetting](appendix/presentation/remove-placeholdersetting.md) + * [Remove-Rendering](appendix/presentation/remove-rendering.md) + * [Remove-RenderingParameter](appendix/presentation/remove-renderingparameter.md) + * [Reset-Layout](appendix/presentation/reset-layout.md) + * [Set-Layout](appendix/presentation/set-layout.md) + * [Set-Rendering](appendix/presentation/set-rendering.md) + * [Set-RenderingParameter](appendix/presentation/set-renderingparameter.md) + * [Switch-Rendering](appendix/presentation/switch-rendering.md) + * [Provider](appendix/provider/README.md) + * [Get-Item](appendix/provider/get-item.md) + * [Security](appendix/security/README.md) + * [Add-ItemAcl](appendix/security/add-itemacl.md) + * [Add-RoleMember](appendix/security/add-rolemember.md) + * [Clear-ItemAcl](appendix/security/clear-itemacl.md) + * [Disable-User](appendix/security/disable-user.md) + * [Enable-User](appendix/security/enable-user.md) + * [Export-Role](appendix/security/export-role.md) + * [Export-User](appendix/security/export-user.md) + * [Get-Domain](appendix/security/get-domain.md) + * [Get-ItemAcl](appendix/security/get-itemacl.md) + * [Get-Role](appendix/security/get-role.md) + * [Get-RoleMember](appendix/security/get-rolemember.md) + * [Get-User](appendix/security/get-user.md) + * [Import-Role](appendix/security/import-role.md) + * [Import-User](appendix/security/import-user.md) + * [Lock-Item](appendix/security/lock-item.md) + * [Login-User](appendix/security/login-user.md) + * [Logout-User](appendix/security/logout-user.md) + * [New-Domain](appendix/security/new-domain.md) + * [New-ItemAcl](appendix/security/new-itemacl.md) + * [New-Role](appendix/security/new-role.md) + * [New-User](appendix/security/new-user.md) + * [Protect-Item](appendix/security/protect-item.md) + * [Remove-Domain](appendix/security/remove-domain.md) + * [Remove-Role](appendix/security/remove-role.md) + * [Remove-RoleMember](appendix/security/remove-rolemember.md) + * [Remove-User](appendix/security/remove-user.md) + * [Set-ItemAcl](appendix/security/set-itemacl.md) + * [Set-User](appendix/security/set-user.md) + * [Set-UserPassword](appendix/security/set-userpassword.md) + * [Test-Account](appendix/security/test-account.md) + * [Test-ItemAcl](appendix/security/test-itemacl.md) + * [Unlock-Item](appendix/security/unlock-item.md) + * [Unprotect-Item](appendix/security/unprotect-item.md) + * [Unlock-User](appendix/security/unlock-user.md) + * [Session](appendix/session/README.md) + * [Get-ScriptSession](appendix/session/get-scriptsession.md) + * [Get-Session](appendix/session/get-session.md) + * [Receive-ScriptSession](appendix/session/receive-scriptsession.md) + * [Remove-ScriptSession](appendix/session/remove-scriptsession.md) + * [Remove-Session](appendix/session/remove-session.md) + * [Start-ScriptSession](appendix/session/start-scriptsession.md) + * [Stop-ScriptSession](appendix/session/stop-scriptsession.md) + * [Wait-ScriptSession](appendix/session/wait-scriptsession.md) diff --git a/_layouts/website/page.html b/_layouts/website/page.html new file mode 100644 index 00000000..5a693cf0 --- /dev/null +++ b/_layouts/website/page.html @@ -0,0 +1,5 @@ + +{% extends template.self %} + +{% block head %} +{% endblock %} diff --git a/appendix.md b/appendix.md deleted file mode 100644 index 9ef484bb..00000000 --- a/appendix.md +++ /dev/null @@ -1,17 +0,0 @@ -# Appendix - -## Compatibility Table - -| **SPE** | **CMS 7.0** | **CMS 7.1** | **CMS 7.2** | **XP 7.5** | **XP 8.0** | **XP 8.1** | **XP 8.2** | -| -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -| 3.0-3.3 | ✓ | ✓ | ✓ | ✓ | ✓ | – | – | -| 4.0 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | – | -| 4.1-4.3 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - -**Legend:** "–" - not supported; "✓" - supported. - -## Commands - -The following commands are distributed with the Sitecore PowerShell Extensions module. - -{% include './appendix/commands-list.md' %} \ No newline at end of file diff --git a/appendix/README.md b/appendix/README.md new file mode 100644 index 00000000..d1d3ee9c --- /dev/null +++ b/appendix/README.md @@ -0,0 +1,35 @@ +# Appendix + +[Downloads are hosted on Github](https://github.com/SitecorePowerShell/Console/releases/) + +## Compatibility Table + +| SPE ↓ / Sitecore→ | **8.0** | **8.1** | **8.2** | **9.0** | **9.1** | **9.2** | **9.3** | **10.0** | **10.1** | **10.2** | **10.3** | **10.4** | +| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :-- | :-- | :-- | +| 4.0 | ✓ | ✓ | – | – | – | – | – | - | - | - | - | - | +| 4.1-4.6 | ✓ | ✓ | ✓ | – | – | – | – | - | - | - | - | - | +| 4.7 | ✓ | ✓ | ✓ | ✓ | ✓ | – | – | - | - | - | - | - | +| 5.0 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ [[1]](#notes) [[2]](#notes) | – | - | - | - | - | - | +| 5.1 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ [[2]](#notes) | – | - | - | - | - | - | +| 6.0-6.2 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - | +| 6.3 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | +| 6.4 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | +| 7.0 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | + +**Legend:** "–" - not supported; "✓" - supported. + +### Compatibility Notes {#notes} + +- [1] Released by Sitecore for SXA which can be download from the [SXA 1.9.0 release page](https://dev.sitecore.net/Downloads/Sitecore_Experience_Accelerator/19/Sitecore_Experience_Accelerator_190.aspx) however you should be safe simply installing the official SPE release on GitHub. +- [2] Some features are not available. It is recommended to upgrade to the latest version available for 9.2. + - Publish-Item command unsupported ([#1129](https://github.com/SitecorePowerShell/Console/issues/1129)) + - Indexing commands unsupported ([#1133](https://github.com/SitecorePowerShell/Console/issues/1133)) + +### Releases + +When reviewing the different download packages you may see some names that are not too clear. The following list outlines what those names should mean. + +* **N.X : Full N.X release** - This refers to the package used by Standalone and CM roles. This includes what is required to see the PowerShell ISE, Console and their associated services. +* **N.X Minimal : Server-side remoting only** - This refers to the package with only files. Useful for remotely connecting to SPE. +* **N.X Authorable Reports : Additional reports and tools** - This package is a sublemental installation to the full version with additional reports. With version 6.0 this package is no longer needed as the reports are included with the full release. +* **N.X Remoting : SPE Remoting module for CI/CD** - This provides a Windows PowerShell module for connecting to SPE remotely. Use in combination with the full or minimal packages. diff --git a/appendix/commands-list.md b/appendix/commands-list.md index 7fc61a5b..1e01a8dd 100644 --- a/appendix/commands-list.md +++ b/appendix/commands-list.md @@ -120,6 +120,7 @@ * [Stop-ScriptSession](appendix/commands/Stop-ScriptSession.md) * [Stop-SearchIndex](appendix/commands/Stop-SearchIndex.md) * [Suspend-SearchIndex](appendix/commands/Suspend-SearchIndex.md) +* [Switch-Rendering](appendix/commands/Switch-Rendering.md) * [Test-Account](appendix/commands/Test-Account.md) * [Test-BaseTemplate](appendix/commands/Test-BaseTemplate.md) * [Test-ItemAcl](appendix/commands/Test-ItemAcl.md) @@ -130,4 +131,4 @@ * [Update-ItemReferrer](appendix/commands/Update-ItemReferrer.md) * [Update-ListView](appendix/commands/Update-ListView.md) * [Wait-ScriptSession](appendix/commands/Wait-ScriptSession.md) -* [Write-Log](appendix/commands/Write-Log.md) \ No newline at end of file +* [Write-Log](appendix/commands/Write-Log.md) diff --git a/appendix/commands/Add-BaseTemplate.md b/appendix/commands/Add-BaseTemplate.md deleted file mode 100644 index 32b79d60..00000000 --- a/appendix/commands/Add-BaseTemplate.md +++ /dev/null @@ -1,271 +0,0 @@ -# Add-BaseTemplate - -Add one or more base templates to a template item. - -## Syntax - -Add-BaseTemplate -Item <Item> -TemplateItem <TemplateItem[]> - -Add-BaseTemplate -Item <Item> -Template <String[]> - -Add-BaseTemplate -Path <String> -TemplateItem <TemplateItem[]> - -Add-BaseTemplate -Path <String> -Template <String[]> - -Add-BaseTemplate -Id <String> -TemplateItem <TemplateItem[]> - -Add-BaseTemplate -Id <String> -Template <String[]> - -Add-BaseTemplate [-Database <String>] - - -## Detailed Description - -The Add-BaseTemplate command adds one or more base templates to a template item. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Item  <Item> - -The item to add the base template to. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to add the base template to. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to add the base template to. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -TemplateItem  <TemplateItem[]> - -Sitecore item or list of items of base templates to add. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Template  <String[]> - -Path representing the template item to add as a base template. This must be of the same database as the item to be altered. -Note that this parameter only supports a single template. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to add the base template to - required if item is specified with Id. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West, Alex Washtell - -## Examples - -### EXAMPLE 1 - -Add base template of /sitecore/templates/User Defined/BaseTemplate to a template, using a path. - -```powershell - -PS master:\> Add-BaseTemplate -Path "master:/sitecore/content/User Defined/Page" -Template "/sitecore/templates/User Defined/BaseTemplate" - -``` - -### EXAMPLE 2 - -Add multiple base templates to a template, using items. - -```powershell - -PS master:\> $baseA = Get-Item -Path master:/sitecore/content/User Defined/BaseTemplateA - PS master:\> $baseB = Get-Item -Path master:/sitecore/content/User Defined/BaseTemplateB - PS master:\> Add-BaseTemplate -Path "master:/sitecore/content/User Defined/Page" -TemplateItem @($baseA, $baseB) - -``` - -## Related Topics - - * [Remove-BaseTemplate](/appendix/commands/Remove-BaseTemplate.md) * [Get-ItemTemplate](/appendix/commands/Get-ItemTemplate.md) * [Set-ItemTemplate](/appendix/commands/Set-ItemTemplate.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Add-ItemAcl.md b/appendix/commands/Add-ItemAcl.md deleted file mode 100644 index cdaca7e4..00000000 --- a/appendix/commands/Add-ItemAcl.md +++ /dev/null @@ -1,463 +0,0 @@ -# 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 <Unknown | Descendants | Entity | Any> -SecurityPermission <NotSet | AllowAccess | DenyAccess | AllowInheritance | DenyInheritance> -AccessRight <String> -Identity <AccountIdentity> -Path <String> [-PassThru] - -Add-ItemAcl -PropagationType <Unknown | Descendants | Entity | Any> -SecurityPermission <NotSet | AllowAccess | DenyAccess | AllowInheritance | DenyInheritance> -AccessRight <String> -Identity <AccountIdentity> -Id <String> [-Database <String>] [-PassThru] - -Add-ItemAcl -PropagationType <Unknown | Descendants | Entity | Any> -SecurityPermission <NotSet | AllowAccess | DenyAccess | AllowInheritance | DenyInheritance> -AccessRight <String> -Identity <AccountIdentity> -Item <Item> [-PassThru] - -Add-ItemAcl -AccessRules <AccessRuleCollection> -Path <String> [-PassThru] - -Add-ItemAcl -AccessRules <AccessRuleCollection> -Id <String> [-PassThru] - -Add-ItemAcl -AccessRules <AccessRuleCollection> -Item <Item> [-PassThru] - -Add-ItemAcl -Item <Item> [-PassThru] - -Add-ItemAcl -Path <String> [-PassThru] - -Add-ItemAcl -Id <String> [-Database <String>] [-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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -PropagationType  <PropagationType> - -The PropagationType enumeration determines which items will be granted the access right. - - Any - the item and all items inheriting - - Descendants - applies rights to inheriting children only - - Entity - applies right to the item only - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -SecurityPermission  <SecurityPermission> - -The SecurityPermission determines whether to grant (allow) or deny the access right, and deny or allow inheritance of the right. - - AllowAccess - - - DenyAccess - - - AllowInheritance - - - DenyInheritance - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -AccessRules  <AccessRuleCollection> - -A single or multiple access rules created e.g. through the New-ItemAcl or obtained from other item using the Get-ItemAcl cmdlet. -This information will be appended to the existing security descriptors on the item. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -PassThru  <SwitchParameter> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -AccessRight  <String> - -The access right to grand or deny. -Well known rights are: -- field:read - "Field Read" - controls whether an account can read a specific field on an item.. -- field:write - "Field Write" - controls whether an account can update a specific field on an item. - -- item:read - "Read" - controls whether an account can see an item in the content tree and/or on the published Web site, including all of its properties and field values. -- item:write - "Write" - controls whether an account can update field values. The write access right requires the read access right and field read and field write access rights for individual fields (field read and field write are allowed by default). -- item:rename - "Rename" - controls whether an account can change the name of an item. The rename access right requires the read access right. -- item:create - "Create" - controls whether an account can create child items. The create access right requires the read access right. -- item:delete - "Delete" - Delete right for items. controls whether an account can delete an item. The delete access right requires the read access right - Important! -The Delete command also deletes all child items, even if the account has been denied Delete -rights for one or more of the subitems. -- item:admin - "Administer" - controls whether an account can configure access rights on an item. The administer access right requires the read and write access rights. -- language:read - "Language Read" - controls whether a user can read a specific language version of items. -- language:write - "Language Write" - controls whether a user can update a specific language version of items. -- site:enter - controls whether a user can access a specific site. -- insert:show - "Show in Insert" - Determines if the user can see the insert option -- workflowState:delete - "Workflow State Delete" - controls whether a user can delete items which are currently associated with a specific workflow state. -- workflowState:write - "Workflow State Write" - controls whether a user can update items which are currently associated with a specific workflow state. -- workflowCommand:execute - "Workflow Command Execute" - — controls whether a user is shown specific workflow commands. -- profile:customize - "Customize Profile Key Values" - The right to input out of range values of profile keys, that belong to this profile. -- bucket:makebucket - "Create Bucket" - convert item to bucket. -- bucket:unmake - "Revert Bucket" - convert item back from bucket. -- remote:fieldread - "Field Remote Read" - Field Read right for remoted clients. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Identity  <AccountIdentity> - -User name including domain for which the access rule is being created. If no domain is specified - 'sitecore' will be used as the default domain. - -Specifies the Sitecore user by providing one of the following values. - - Local Name - Example: adam - Fully Qualified Name - Example: sitecore\adam - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be processed. Requires Database parameter to be specified - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be fetched using the Id Parameter. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* can be piped from another cmdlet* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Only if -PassThru is used* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -allows the "sitecore\adam" user to rename the Home item and all of its childre - -```powershell - -PS master:\> Add-ItemAcl -Path master:\content\Home -AccessRight "item:rename" -PropagationType Any -SecurityPermission AllowAccess -Identity "sitecore\admin" - -``` - -### 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. - -```powershell - -$acl1 = New-ItemAcl -AccessRight item:delete -PropagationType Any -SecurityPermission AllowAccess -Identity "sitecore\admin" -$acl2 = New-ItemAcl -AccessRight item:read -PropagationType Descendants -SecurityPermission DenyAccess -Identity "sitecore\mikey" -Get-Item -Path master:\content\home | Add-ItemAcl -AccessRules $acl1, $acl2 -PassThru - -Name Children Languages Id TemplateName ----- -------- --------- -- ------------ -Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Add-ItemAcl](/appendix/commands/Add-ItemAcl.md) * [Clear-ItemAcl](/appendix/commands/Clear-ItemAcl.md) * [Get-ItemAcl](/appendix/commands/Get-ItemAcl.md) * [New-ItemAcl](/appendix/commands/New-ItemAcl.md) * [Set-ItemAcl](/appendix/commands/Set-ItemAcl.md) * [Test-ItemAcl](/appendix/commands/Test-ItemAcl.md) * 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/
diff --git a/appendix/commands/Add-ItemVersion.md b/appendix/commands/Add-ItemVersion.md deleted file mode 100644 index 6fda2251..00000000 --- a/appendix/commands/Add-ItemVersion.md +++ /dev/null @@ -1,436 +0,0 @@ -# Add-ItemVersion - -Creates a version of the item in a new language based on an existing language version. - -## Syntax - -Add-ItemVersion [-Item] <Item> [-Recurse] [-IfExist <Append | Skip | OverwriteLatest>] [-TargetLanguage <String[]>] [-DoNotCopyFields] [-IgnoredFields <String[]>] [-Language <String[]>] - -Add-ItemVersion [-Path] <String> [-Recurse] [-IfExist <Append | Skip | OverwriteLatest>] [-TargetLanguage <String[]>] [-DoNotCopyFields] [-IgnoredFields <String[]>] [-Language <String[]>] - -Add-ItemVersion -Id <String> [-Database <String>] [-Recurse] [-IfExist <Append | Skip | OverwriteLatest>] [-TargetLanguage <String[]>] [-DoNotCopyFields] [-IgnoredFields <String[]>] [-Language <String[]>] - - -## Detailed Description - -Creates a new version of the item in a specified 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions## Aliases -The following abbreviations are aliases for this cmdlet: -* Add-ItemLanguage - -## Parameters - -### -Recurse  <SwitchParameter> - -Process the item and all of its children. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -IfExist  <ActionIfExists> - -Default vaule is Append -Accepts one of 3 pretty self explanatory actions: -- Append - [Default] if language version exists create a new version with values copied from the original language -- Skip - if language version exists don't do anything -- OverwriteLatest - if language version exists overwrite the last version with values copied from the original language - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -TargetLanguage  <String[]> - -Language or a list of languages that should be created - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -DoNotCopyFields  <SwitchParameter> - -Creates a new version in the target language but does not copy field values from the original language - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -IgnoredFields  <String[]> - -List of fields that should not be copied over from original item. As an example, use "__Security" if you don't want the new version to have the same restrictions as the original version. - -In addition to the fields in -IgnoredFields the following fields are ignored as configured in Cognifide.PowerShell.config file in the following location: -configuration/sitecore/powershell/translation/ignoredFields. - -Fields ignored out of the box include: -- __Archive date -- __Archive Version date -- __Lock -- __Owner -- __Page Level Test Set Definition -- __Reminder date -- __Reminder recipients -- __Reminder text - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - -Language that will be used as source language. If not specified the current user language will be used. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item / version to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be processed - additionally specify Language parameter to fetch different item language than the current user language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be processed - additionally specify Language parameter to fetch different item language than the current user language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Translate the Home Item from English to US and Polish leaving the "Title" field blank. If a version exists don't do anything - -```powershell - -PS master:\> Add-ItemVersion -Path "master:\content\home" -Language "en" -TargetLanguage "pl-pl", "en-us" -IfExist Skip -IgnoredFields "Title" - -``` - -### EXAMPLE 2 - - - -```powershell - -Add a Japanese version to /sitecore/content/home item in the master database based on itself -PS master:\> Add-ItemVersion -Path "master:\content\home" -Language ja-JP -IfExist Append - -``` - -### EXAMPLE 3 - -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. - -```powershell - -Get-ChildItem "master:\content\home" -Language "en" -Recurse | ` - Where-Object { $_.TemplateName -eq "Sample Item" } | ` - Add-ItemVersion -TargetLanguage "pl-pl" -IfExist Append | ` - Format-Table Name, Language, Version -auto - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Remove-ItemVersion](/appendix/commands/Remove-ItemVersion.md) * New-Item * https://gist.github.com/AdamNaj/b36ea095e3668c22c07e
diff --git a/appendix/commands/Add-RoleMember.md b/appendix/commands/Add-RoleMember.md deleted file mode 100644 index 9c1edd3c..00000000 --- a/appendix/commands/Add-RoleMember.md +++ /dev/null @@ -1,124 +0,0 @@ -# Add-RoleMember - -Adds one or more Sitecore users to the specified role. - -## Syntax - -Add-RoleMember [-Identity] <AccountIdentity> -Members <AccountIdentity[]> - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <AccountIdentity> - -Specifies the Sitecore role by providing one of the following values. - - Local Name - Example: developer - Fully Qualified Name - Example: sitecore\developer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Members  <AccountIdentity[]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* System.String -Represents the identity of a role. - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* None. - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Add-RoleMember -Identity developer -Members "michael","adam","mike" - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Get-RoleMember](/appendix/commands/Get-RoleMember.md) * [Remove-RoleMember](/appendix/commands/Remove-RoleMember.md) diff --git a/appendix/commands/Clear-ItemAcl.md b/appendix/commands/Clear-ItemAcl.md deleted file mode 100644 index 3bd58007..00000000 --- a/appendix/commands/Clear-ItemAcl.md +++ /dev/null @@ -1,236 +0,0 @@ -# Clear-ItemAcl - -Removes all security information from the item specified. - -## Syntax - -Clear-ItemAcl [-Item] <Item> [-PassThru] - -Clear-ItemAcl [-Path] <String> [-PassThru] - -Clear-ItemAcl -Id <String> [-Database <String>] [-PassThru] - - -## Detailed Description - -Removes all security information from the item specified. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -PassThru  <SwitchParameter> - -Passes the processed item back into the pipeline. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be processed. Requires the Database parameter to be specified. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be fetched with Id parameter. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* can be piped from another cmdlet* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Only if -PassThru is used* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Clears the security information from the Home item providing its path - -```powershell - -PS master:\> Clear-ItemAcl -Path master:\content\home - -``` - -### EXAMPLE 2 - -Clears the security information from the Home item by providing it from the pipeline and passing it back to the pipeline. - -```powershell - -PS master:\> Get-Item -Path master:\content\home | Clear-ItemAcl -PassThru - -Name Children Languages Id TemplateName ----- -------- --------- -- ------------ -Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item - -``` - -## Related Topics - - * [Add-ItemAcl](/appendix/commands/Add-ItemAcl.md) * [Get-ItemAcl](/appendix/commands/Get-ItemAcl.md) * [New-ItemAcl](/appendix/commands/New-ItemAcl.md) * [Set-ItemAcl](/appendix/commands/Set-ItemAcl.md) * [Test-ItemAcl](/appendix/commands/Test-ItemAcl.md) * 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/
diff --git a/appendix/commands/Close-Window.md b/appendix/commands/Close-Window.md deleted file mode 100644 index 6d968ab1..00000000 --- a/appendix/commands/Close-Window.md +++ /dev/null @@ -1,34 +0,0 @@ -# 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Close-Window - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/ConvertFrom-CliXml.md b/appendix/commands/ConvertFrom-CliXml.md deleted file mode 100644 index 2df7a320..00000000 --- a/appendix/commands/ConvertFrom-CliXml.md +++ /dev/null @@ -1,87 +0,0 @@ -# ConvertFrom-CliXml - -Imports a CliXml string with data that represents Microsoft .NET objects and creates the objects within PowerShell. - -## Syntax - -ConvertFrom-CliXml [-InputObject] <String> - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -InputObject  <String> - -String containing the Xml with serialized objects. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* System.String - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* object - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> #Convert original item to xml -PS master:\> $myCliXmlItem = Get-Item -Path master:\content\home | ConvertTo-CliXml -PS master:\> #print the CliXml -PS master:\> $myCliXmlItem -PS master:\> #print the Item converted back from CliXml -PS master:\> $myCliXmlItem | ConvertFrom-CliXml - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [ConvertTo-CliXml](/appendix/commands/ConvertTo-CliXml.md) * ConvertTo-Xml * ConvertFrom-Xml * Export-CliXml * Import-CliXml * https://github.com/SitecorePowerShell/Console/issues/218
diff --git a/appendix/commands/ConvertTo-CliXml.md b/appendix/commands/ConvertTo-CliXml.md deleted file mode 100644 index c378154a..00000000 --- a/appendix/commands/ConvertTo-CliXml.md +++ /dev/null @@ -1,87 +0,0 @@ -# ConvertTo-CliXml - -Exports Microsoft .NET objects froms PowerShell to a CliXml string. - -## Syntax - -ConvertTo-CliXml [-InputObject] <PSObject> - - -## Detailed Description - -The ConvertTo-CliXml command exports Microsoft .NET Framework objects from PowerShell to a CliXml string. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -InputObject  <PSObject> - -Specifies the object to be converted. Enter a variable that contains the objects, or type a command or expression that gets the objects. You can also pipe objects to ConvertTo-CliXml. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* object - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* System.String - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> #Convert original item to xml -PS master:\> $myCliXmlItem = Get-Item -Path master:\content\home | ConvertTo-CliXml -PS master:\> #print the CliXml -PS master:\> $myCliXmlItem -PS master:\> #print the Item converted back from CliXml -PS master:\> $myCliXmlItem | ConvertFrom-CliXml - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [ConvertFrom-CliXml](/appendix/commands/ConvertFrom-CliXml.md) * ConvertFrom-Xml * ConvertTo-Xml * Export-CliXml * Import-CliXml diff --git a/appendix/commands/Disable-User.md b/appendix/commands/Disable-User.md deleted file mode 100644 index 14f35afb..00000000 --- a/appendix/commands/Disable-User.md +++ /dev/null @@ -1,140 +0,0 @@ -# Disable-User - -Disables the specified Sitecore user. - -## Syntax - -Disable-User [-Identity] <AccountIdentity> - -Disable-User -Instance <User> - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <AccountIdentity> - -Specifies the Sitecore user by providing one of the following values. - - Local Name - Example: michael - Fully Qualified Name - Example: sitecore\michael - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Instance  <User> - -Specifies the Sitecore user by providing an instance of a user. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* System.String -Represents the identity of a user. - -Sitecore.Security.Accounts.User -One or more user instances. - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* None. - -## Notes - -Michael West - -## Examples - -### EXAMPLE 1 - - - -```powershell - -PS master:\> Disable-User -Identity michael - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\> Get-User -Filter * | Disable-User - -``` - -## Related Topics - - * http://michaellwest.blogspot.com
diff --git a/appendix/commands/Enable-User.md b/appendix/commands/Enable-User.md deleted file mode 100644 index 27a1cd8a..00000000 --- a/appendix/commands/Enable-User.md +++ /dev/null @@ -1,140 +0,0 @@ -# Enable-User - -Enables the specified Sitecore user. - -## Syntax - -Enable-User [-Identity] <AccountIdentity> - -Enable-User -Instance <User> - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <AccountIdentity> - -Specifies the Sitecore user by providing one of the following values. - - Local Name - Example: michael - Fully Qualified Name - Example: sitecore\michael - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Instance  <User> - -Specifies the Sitecore user by providing an instance of a user. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* System.String -Represents the identity of one or more users. - -Sitecore.Security.Accounts.User -One or more user instances. - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* None. - -## Notes - -Michael West - -## Examples - -### EXAMPLE 1 - - - -```powershell - -PS master:\> Enable-User -Identity michael - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\> Get-User -Filter * | Enable-User - -``` - -## Related Topics - - * http://michaellwest.blogspot.com
diff --git a/appendix/commands/Expand-Token.md b/appendix/commands/Expand-Token.md deleted file mode 100644 index a82f09b8..00000000 --- a/appendix/commands/Expand-Token.md +++ /dev/null @@ -1,226 +0,0 @@ -# Expand-Token - -Expands tokens in fields for items. - -## Syntax - -Expand-Token [-Item] <Item> [-Language <String[]>] - -Expand-Token [-Path] <String> [-Language <String[]>] - -Expand-Token -Id <String> [-Database <String>] [-Language <String[]>] - - -## Detailed Description - -The Expand-Token command expands the tokens in fields for items. - -Some example of tokens include: -- $name -- $time - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Language  <String[]> - -Language that will be processed. If not specified the current user language will be used. Globbing/wildcard supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be processed - additionally specify Language parameter to fetch different item language than the current user language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the the item to be processed - additionally specify Language parameter to fetch different item language than the current user language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -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 - - - -```powershell - -PS master:\> Get-Item master:\content\home | Expand-Token - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* http://sitecorejunkie.com/2014/05/27/launch-powershell-scripts-in-the-item-context-menu-using-sitecore-powershell-extensions/
* http://sitecorejunkie.com/2014/06/02/make-bulk-item-updates-using-sitecore-powershell-extensions/
diff --git a/appendix/commands/Export-Item.md b/appendix/commands/Export-Item.md deleted file mode 100644 index 302565b1..00000000 --- a/appendix/commands/Export-Item.md +++ /dev/null @@ -1,342 +0,0 @@ -# Export-Item - -Exports (serializes) the Sitecore item to the filesystem. - -## Syntax - -Export-Item [-Entry <IncludeEntry>] [-Recurse] [-ItemPathsAbsolute] [-Root <String>] - -Export-Item [-Item] <Item> [-Recurse] [-ItemPathsAbsolute] [-Root <String>] - -Export-Item [-Path] <String> [-Recurse] [-ItemPathsAbsolute] [-Root <String>] - -Export-Item -Id <String> [-Database <String>] [-Recurse] [-ItemPathsAbsolute] [-Root <String>] - - -## Detailed Description - -The Export-Item command serializes Sitecore items to the filesystem. The alias for the command is Serialize-Item. -The simplest command syntax is: -Export-Item -path "master:\content" - -or - -Get-Item "master:\content" | Export-Item - -Both of them will serialize the content item in the master database. In first case we pass the path to the item as a parameter, in second case we serialize the items which come from the pipeline. -You can send more items from the pipeline to the Export-Item command, e.g. if you need to serialize all the descendants of the home item created by sitecore\admin, you can use: - -Get-Childitem "master:\content\home" -recurse | Where-Object { $_."__Created By" -eq "sitecore\admin" } | Export-Item - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions## Aliases -The following abbreviations are aliases for this cmdlet: -* Serialize-Item - -## Parameters - -### -Entry  <IncludeEntry> - -Serialization preset to be serialized. Obtain the preset through the use of Get-Preset command. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Recurse  <SwitchParameter> - -Process the item and all of its children - switch which decides if serialization concerns only the single item or the whole tree below the item, e.g. - -Export-Item -path "master:\content\articles" -recurse - -Root - directory where the serialized files should be saved, e.g. -Export-Item -path "master:\content" -Root "c:\tmp" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -ItemPathsAbsolute  <SwitchParameter> - -Works only with Root parameter and decides if folder structure starting from "sitecore\content" should be created, e.g. if you want to serialize articles item in directory c:\tmp\sitecore\content you can use. For example: -Export-Item -Path "master:\content\articles" -ItemPathsAbsolute -Root "c:\tmp" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Root  <String> - -Directory where the serialized files should be saved, e.g. - -Export-Item -Path "master:\content" -Root "c:\tmp" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be serialized. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -You can pass the id of serialized item instead of path, e.g. -Export-Item -id "{0DE95AE4-41AB-4D01-9EB0-67441B7C2450}" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -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 - - - -```powershell - -PS master:\> Export-Item -Path master:\content\home - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Get-Preset](/appendix/commands/Get-Preset.md) * [Import-Item](/appendix/commands/Import-Item.md) * 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
diff --git a/appendix/commands/Export-Package.md b/appendix/commands/Export-Package.md deleted file mode 100644 index fa053328..00000000 --- a/appendix/commands/Export-Package.md +++ /dev/null @@ -1,233 +0,0 @@ -# Export-Package - -Exports a Sitecore installation package and project. - -## Syntax - -Export-Package [[-Path] <String>] [[-Project] <PackageProject>] [-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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Path  <String> - -Path the project should be saved under. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Project  <PackageProject> - -Project object created ealier with the New-Package. or Loaded with Get-Package. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?2
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Zip  <SwitchParameter> - -Specify this parameter to exposrt package with all its assets in a zip file. -If this parameter is missing only Xml file with the package project definition will be saved. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -NoClobber  <SwitchParameter> - -Do not overwrite (replace the contents) of an existing file. By default, if a file exists in the specified path, Export-Package overwrites the file without warning. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -IncludeProject  <SwitchParameter> - -Specify this parameter if exporting the zip file and when you want it to contain the project definitnion xml file in it. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Install.PackageProject - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - -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. - -```powershell - -# Create package - $package = new-package "Sitecore PowerShell Extensions"; - -# Set package metadata - $package.Sources.Clear(); - - $package.Metadata.Author = "Adam Najmanowicz - Cognifide, Michael West"; - $package.Metadata.Publisher = "Cognifide Limited"; - $package.Metadata.Version = "2.7"; - $package.Metadata.Readme = 'This text will be visible to people installing your package' - -# Add contnet/home to the package -$source = Get-Item 'master:\content\home' | New-ItemSource -Name 'Home Page' -InstallMode Overwrite -$package.Sources.Add($source); - -# Save package - Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip - -# Offer the user to download the package - Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip" - -``` - -## Related Topics - - * [Get-Package](/appendix/commands/Get-Package.md) * Import-Package * [Install-UpdatePackage](/appendix/commands/Install-UpdatePackage.md) * [New-ExplicitFileSource](/appendix/commands/New-ExplicitFileSource.md) * [New-ExplicitItemSource](/appendix/commands/New-ExplicitItemSource.md) * [New-FileSource](/appendix/commands/New-FileSource.md) * [New-ItemSource](/appendix/commands/New-ItemSource.md) * [New-Package](/appendix/commands/New-Package.md) * https://github.com/SitecorePowerShell/Console/
* http://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/
* https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae
diff --git a/appendix/commands/Export-Role.md b/appendix/commands/Export-Role.md deleted file mode 100644 index c811414f..00000000 --- a/appendix/commands/Export-Role.md +++ /dev/null @@ -1,271 +0,0 @@ -# Export-Role - -Exports (serializes) Sitecore roles to the filesystem on the server. - -## Syntax - -Export-Role [-Identity] <AccountIdentity> [-Root <String>] - -Export-Role [-Identity] <AccountIdentity> -Path <String> - -Export-Role -Filter <String> [-Root <String>] - -Export-Role [-Role] <Role> [-Root <String>] - -Export-Role [-Role] <Role> -Path <String> - - -## Detailed Description - -The Export-Role command exports (serializes) Sitecore roles to the filesystem on the server. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <AccountIdentity> - -Specifies the Sitecore role by providing one of the following values. - - Local Name - Example: developer - Fully Qualified Name - Example: sitecore\developer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Filter  <String> - -Specifies a simple pattern to match Sitecore roles. - -Examples: -The following examples show how to use the filter syntax. - -To get all the roles, use the asterisk wildcard: -Export-Role -Filter * - -To get all the roles in a domain use the following command: -Export-Role -Filter "sitecore\*" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Role  <Role> - -Specifies the role to be exported - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the file the role should be saved to. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Root  <String> - -Specifies the serialization root directory. If this parameter is not specified - the default Sitecore serialization folder will be used (unless you're saving to an explicit location with the -Path parameter). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## 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 - - - -```powershell - -PS master:\> Export-Role -Identity sitecore\Author - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\> Export-Role -Filter sitecore\* - -``` - -### EXAMPLE 3 - - - -```powershell - -PS master:\> Export-Role -Root C:\my\Serialization\Folder\ -Filter *\* - -``` - -### EXAMPLE 4 - - - -```powershell - -PS master:\> Export-Role -Path C:\my\Serialization\Folder\Authors.role -Identity sitecore\Author - -``` - -## Related Topics - - * [Import-Role](/appendix/commands/Import-Role.md) * [Export-User](/appendix/commands/Export-User.md) * [Import-User](/appendix/commands/Import-User.md) * [Export-Item](/appendix/commands/Export-Item.md) * [Import-Item](/appendix/commands/Import-Item.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Export-UpdatePackage.md b/appendix/commands/Export-UpdatePackage.md deleted file mode 100644 index 8b2a8968..00000000 --- a/appendix/commands/Export-UpdatePackage.md +++ /dev/null @@ -1,241 +0,0 @@ -# Export-UpdatePackage - -Exports a Sitecore update package containing a serialization diff list. - -## Syntax - -Export-UpdatePackage [-CommandList] <List`1> [[-Name] <String>] [[-Path] <String>] [-Readme <String>] [-LicenseFileName <String>] [-Tag <String>] - - -## Detailed Description - -The Export-UpdatePackage command generates a Sitecore update package containing a serialization diff list. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -CommandList  <List`1> - -List of changes to be included in the package. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Name  <String> - -Name of the package. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?2
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Path  <String> - -Path the update package should be saved under. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?3
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Readme  <String> - -Contents of the "read me" instruction for the package - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -LicenseFileName  <String> - -file name of the license to be included with the package. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Tag  <String> - -Package tag. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## 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 - -```powershell - -$diff = Get-UpdatePackageDiff -SourcePath C:\temp\SerializationSource -TargetPath C:\temp\SerializationTarget -Export-UpdatePackage -Path C:\temp\SerializationDiff.update -CommandList $diff -Name name - -``` - -## Related Topics - - * [Get-UpdatePackageDiff](/appendix/commands/Get-UpdatePackageDiff.md) * [Install-UpdatePackage](/appendix/commands/Install-UpdatePackage.md) * http://sitecoresnippets.blogspot.com/2012/10/sitecore-courier-effortless-packaging.html
* https://github.com/adoprog/Sitecore-Courier
* https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Export-User.md b/appendix/commands/Export-User.md deleted file mode 100644 index 72af9d3d..00000000 --- a/appendix/commands/Export-User.md +++ /dev/null @@ -1,279 +0,0 @@ -# Export-User - -Export (serialize) a Sitecore user to the filesystem on the server. - -## Syntax - -Export-User [-Identity] <AccountIdentity> [-Root <String>] - -Export-User [-Identity] <AccountIdentity> -Path <String> - -Export-User -Filter <String> [-Root <String>] - -Export-User [-User] <User> [-Root <String>] - -Export-User [-User] <User> -Path <String> - -Export-User -Current [-Root <String>] - -Export-User -Current -Path <String> - - -## Detailed Description - -The Export-User command serializes a Sitecore user to the filesystem on the server. - -The Identity parameter specifies the Sitecore user to get. You can specify a user by its local name or fully qualified name. -You can also specify user object variable, such as $<user>. - -To search for and retrieve more than one user, use the Filter parameter. - -You can also pipe a user from the Get-user command. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <AccountIdentity> - -Specifies the Sitecore user by providing one of the following values. - - Local Name - Example: admin - Fully Qualified Name - Example: sitecore\admi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Filter  <String> - -Specifies a simple pattern to match Sitecore users. - -Examples: -The following examples show how to use the filter syntax. - -To get all the users, use the asterisk wildcard: -Export-User -Filter * - -To get all the users in a domain use the following command: -Export-User -Filter "sitecore\*" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -User  <User> - -User object retrieved from the Sitecore API or using the Get-User command. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Current  <SwitchParameter> - -Specifies that the current user should be serialized. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the file the user should be saved to. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Root  <String> - -Overrides Sitecore Serialization root directory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Security.Accounts.User - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Export-User -Identify sitecore\admin - -``` - -## Related Topics - - * [Export-Role](/appendix/commands/Export-Role.md) * [Import-User](/appendix/commands/Import-User.md) * [Export-Item](/appendix/commands/Export-Item.md) * [Import-Role](/appendix/commands/Import-Role.md) * [Import-Item](/appendix/commands/Import-Item.md) * [Get-User](/appendix/commands/Get-User.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Find-Item.md b/appendix/commands/Find-Item.md deleted file mode 100644 index bc374c6a..00000000 --- a/appendix/commands/Find-Item.md +++ /dev/null @@ -1,395 +0,0 @@ -# Find-Item - -Finds items using the Sitecore Content Search API. - -## Syntax - -Find-Item [-Index] <String> [-Criteria <SearchCriteria[]>] [-Where <String>] [-WhereValues <Object[]>] [-OrderBy <String>] [-First <Int32>] [-Last <Int32>] [-Skip <Int32>] - - -## Detailed Description - -The Find-Item command searches for items using the Sitecore Content Search API. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Index  <String> - -Name of the Index that will be used for the search: - -Find-Item -Index sitecore_master_index -First 10 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Criteria  <SearchCriteria[]> - -simple search criteria in the following example form: - -@{ - Filter = "Equals"; - Field = "_templatename"; - Value = "PowerShell Script"; -}, -@{ - Filter = "StartsWith"; - Field = "_fullpath"; - Value = "/sitecore/system/Modules/PowerShell/Script Library/System Maintenance"; -}, -@{ - Filter = "DescendantOf"; - Value = (Get-Item "master:/system/Modules/PowerShell/Script Library/") -} - -Where "Filter" is one of the following values: -- Equals -- StartsWith, -- Contains, -- EndsWith -- DescendantOf - -Fields by which you can filter can be discovered using the following script: - -Find-Item -Index sitecore_master_index ` - -Criteria @{Filter = "StartsWith"; Field = "_fullpath"; Value = "/sitecore/content/" } ` - -First 1 | - select -expand "Fields" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Where  <String> - -Works on Sitecore 7.5 and later versions only. - -Filtering Criteria using Dynamic Linq syntax: http://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -WhereValues  <Object[]> - -Works on Sitecore 7.5 and later versions only. - -An Array of objects for Dynamic Linq "-Where" parameter as explained in: http://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -OrderBy  <String> - -Works on Sitecore 7.5 and later versions only. - -Field by which the search results sorting should be performed. -Dynamic Linq ordering syntax used. -http://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -First  <Int32> - -Number of returned search results. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Last  <Int32> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Skip  <Int32> - -Number of search results to be skipped skip before returning the results commences. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.ContentSearch.SearchTypes.SearchResultItem - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Fields by which filtering can be performed using the -Criteria parameter - -```powershell - -Find-Item -Index sitecore_master_index ` - -Criteria @{Filter = "StartsWith"; Field = "_fullpath"; Value = "/sitecore/content/" } ` - -First 1 | - select -expand "Fields" - -``` - -### EXAMPLE 2 - -Find all children of a specific item including that item - return Sitecore items - -```powershell - -$root = (Get-Item "master:/system/Modules/PowerShell/Script Library/") -Find-Item -Index sitecore_master_index ` - -Criteria @{Filter = "DescendantOf"; Field = $root } | - Initialize-Item - -``` - -### EXAMPLE 3 - -Find all Template Fields using Dynamic LINQ syntax - -```powershell - -Find-Item ` - -Index sitecore_master_index ` - -Where 'TemplateName = @0 And Language=@1' ` - -WhereValues "Template Field", "en" - -``` - -### EXAMPLE 4 - -Find all Template Fields using the -Criteria parameter syntax - -```powershell - -Find-Item ` - -Index sitecore_master_index ` - -Criteria @{Filter = "Equals"; Field = "_templatename"; Value = "Template Field"}, - @{Filter = "Equals"; Field = "_language"; Value = "en"} - -``` - -## Related Topics - - * [Initialize-Item](/appendix/commands/Initialize-Item.md) * Get-Item * Get-ChildItem * 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/
diff --git a/appendix/commands/Get-Archive.md b/appendix/commands/Get-Archive.md deleted file mode 100644 index 04b13ff4..00000000 --- a/appendix/commands/Get-Archive.md +++ /dev/null @@ -1,121 +0,0 @@ -# Get-Archive - -Returns Sitecore database archives. - -## Syntax - -Get-Archive [[-Database] <Database>] [[-Name] <String>] - - -## Detailed Description - -The Get-Archive command returns Sitecore archives in context of the specified database. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Name  <String> - -Name of the archive to retrieve. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <Database> - -Database for which the archives should be retrieved. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?2
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Database - -## 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 - - - -```powershell - -PS master:\> Get-Archive -Database "master" - -Name Items ----- ----- -archive 0 -recyclebin 1950 - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Get-Cache.md b/appendix/commands/Get-Cache.md deleted file mode 100644 index b9ca5cba..00000000 --- a/appendix/commands/Get-Cache.md +++ /dev/null @@ -1,88 +0,0 @@ -# Get-Cache - -Retrieves a Sitecore cache. - -## Syntax - -Get-Cache [[-Name] <String>] - - -## Detailed Description - -The Get-Cache command retrieves a Sitecore cache. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Name  <String> - -Name of the cache to retrieve. Supports wildcards. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Caching.Cache - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Get-Cache -Name master* - -Name Enabled Count Size Max Size Default Scavengable - Priority ----- ------- ----- ---- -------- -------- ----------- -master[blobIDs] True 0 0 512000 Normal False -master[blobIDs] True 0 0 512000 Normal False -master[blobIDs] True 0 0 512000 Normal False -master[itempaths] True 292 108228 10485760 Normal False -master[standardValues] True 57 38610 512000 Normal False -master[paths] True 108 13608 512000 Normal False -master[items] True 1010 5080300 10485760 Normal False -master[data] True 3427 7420654 20971520 Normal False - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Get-Database.md b/appendix/commands/Get-Database.md deleted file mode 100644 index f774b962..00000000 --- a/appendix/commands/Get-Database.md +++ /dev/null @@ -1,151 +0,0 @@ -# Get-Database - -Retrieves a Sitecore Database. - -## Syntax - -Get-Database [[-Name] <String>] [-Item <Item>] - - -## Detailed Description - -The Get-Database command retrieves one or more Sitecore Database objects based on name or item passed to it. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Name  <String> - -Name of the database to be returned. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Item  <Item> - -Database returned will be taken from the item passed to the command. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item -System.String - -## 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 - - - -```powershell - -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 - - - -```powershell - -PS master:\> Get-Database -Name "master" - -Name Languages Protected Read Only ----- --------- --------- --------- -master {en, de-DE, es-ES, pt-BR...} False False - -``` - -### EXAMPLE 3 - - - -```powershell - -PS master:\> Get-Item . | Get-Database - -Name Languages Protected Read Only ----- --------- --------- --------- -master {en, de-DE, es-ES, pt-BR...} False False - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Get-Domain.md b/appendix/commands/Get-Domain.md deleted file mode 100644 index f1147509..00000000 --- a/appendix/commands/Get-Domain.md +++ /dev/null @@ -1,102 +0,0 @@ -# Get-Domain - -Gets all available domains or the specified domain. - -## Syntax - -Get-Domain [-Name <String>] - - -## Detailed Description - -The Get-Domain command returns all the domains or the specified domain. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Name  <String> - -The name of the domai - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* System.String -Represents the name of a domain. - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Security.Domains.Domai - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - - - -```powershell - -PS master:\> Get-Domain -Name sitecore -Name AccountPrefix EnsureAnonymousUser LocallyManaged ----- ------------- ------------------- -------------- -sitecore sitecore\ False False - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\> Get-Domain - -Name AccountPrefix EnsureAnonymousUser LocallyManaged ----- ------------- ------------------- -------------- -sitecore sitecore\ False False -extranet extranet\ True False -default default\ True False - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Remove-Domain](/appendix/commands/Remove-Domain.md) * [New-Domain](/appendix/commands/New-Domain.md) diff --git a/appendix/commands/Get-ItemAcl.md b/appendix/commands/Get-ItemAcl.md deleted file mode 100644 index 0a81aa3e..00000000 --- a/appendix/commands/Get-ItemAcl.md +++ /dev/null @@ -1,296 +0,0 @@ -# Get-ItemAcl - -Retrieves security access rules from an item. - -## Syntax - -Get-ItemAcl -Identity <AccountIdentity> -Path <String> - -Get-ItemAcl -Identity <AccountIdentity> -Id <String> [-Database <String>] - -Get-ItemAcl -Identity <AccountIdentity> -Item <Item> - -Get-ItemAcl -Filter <String> -Path <String> - -Get-ItemAcl -Filter <String> -Id <String> [-Database <String>] - -Get-ItemAcl -Filter <String> -Item <Item> - -Get-ItemAcl -Item <Item> - -Get-ItemAcl -Path <String> - -Get-ItemAcl -Id <String> - - -## Detailed Description - -Retrieves security access rules from an item. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <AccountIdentity> - -User name including domain for which the access rule is being created. If no domain is specified - 'sitecore' will be used as the default domain. - -Specifies the Sitecore user by providing one of the following values. - - Local Name - Example: adam - Fully Qualified Name - Example: sitecore\adam - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Filter  <String> - -Specifies a simple pattern to match Sitecore roles & users. - -Examples: -The following examples show how to use the filter syntax. - -To get security for all roles, use the asterisk wildcard: -Get-ItemAcl -Filter * - -To security got all roles in a domain use the following command: -Get-ItemAcl -Filter "sitecore\*" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item from which the security rules should be taken. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item from which the security rules should be taken. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item from which the security rules should be taken. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be fetched with Id parameter containing the security rules that should be returned. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Security.AccessControl.AccessRule - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Take the security information from the Home item and apply it to the Settings item - -```powershell - -$acl = Get-ItemAcl -Path master:\content\home -Set-ItemAcl -Path master:\content\Settings -AccessRules $acl -PassThru - -``` - -### EXAMPLE 2 - -Take the security information from the Home item and add it to the access rules on the Settings item - -```powershell - -$acl = Get-ItemAcl -Path master:\content\home -Add-ItemAcl -Path master:\content\Settings -AccessRules $acl -PassThru - -``` - -## Related Topics - - * [Add-ItemAcl](/appendix/commands/Add-ItemAcl.md) * [Clear-ItemAcl](/appendix/commands/Clear-ItemAcl.md) * [Set-ItemAcl](/appendix/commands/Set-ItemAcl.md) * [New-ItemAcl](/appendix/commands/New-ItemAcl.md) * [Test-ItemAcl](/appendix/commands/Test-ItemAcl.md) * 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/
diff --git a/appendix/commands/Get-ItemClone.md b/appendix/commands/Get-ItemClone.md deleted file mode 100644 index b01e7a24..00000000 --- a/appendix/commands/Get-ItemClone.md +++ /dev/null @@ -1,188 +0,0 @@ -# Get-ItemClone - -Returns all the clones for the specified item. - -## Syntax - -Get-ItemClone [-Item] <Item> - -Get-ItemClone [-Path] <String> - -Get-ItemClone -Id <String> [-Database <String>] - - -## Detailed Description - -The Get-ItemClone command returns all the clones for the specified item. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Item  <Item> - -The item to be analysed for clones presence. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be analysed for clones presence. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be analysed for clones presence. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be processed - if item is being provided through Id. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Get-ItemClone -Path master:\content\home - -``` - -## Related Topics - - * [New-ItemClone](/appendix/commands/New-ItemClone.md) * [ConvertFrom-ItemClone](/appendix/commands/ConvertFrom-ItemClone.md) * https://github.com/SitecorePowerShell/Console/
* https://github.com/SitecorePowerShell/Console/issues/218
* Get-Item diff --git a/appendix/commands/Get-ItemCloneNotification.md b/appendix/commands/Get-ItemCloneNotification.md deleted file mode 100644 index e0076bae..00000000 --- a/appendix/commands/Get-ItemCloneNotification.md +++ /dev/null @@ -1,226 +0,0 @@ -# Get-ItemCloneNotification - - - -## Syntax - -Get-ItemCloneNotification [-Item] <Item> [-NotificationType <Notification | ChildCreatedNotification | FieldChangedNotification | FirstVersionAddedNotification | ItemMovedChildCreatedNotification | ItemMovedChildRemovedNotification | ItemMovedNotification | ItemTreeMovedNotification | ItemVersionNotification | OriginalItemChangedTemplateNotification | VersionAddedNotification>] [-Language <String[]>] - -Get-ItemCloneNotification [-Path] <String> [-NotificationType <Notification | ChildCreatedNotification | FieldChangedNotification | FirstVersionAddedNotification | ItemMovedChildCreatedNotification | ItemMovedChildRemovedNotification | ItemMovedNotification | ItemTreeMovedNotification | ItemVersionNotification | OriginalItemChangedTemplateNotification | VersionAddedNotification>] [-Language <String[]>] - -Get-ItemCloneNotification -Id <String> [-Database <String>] [-NotificationType <Notification | ChildCreatedNotification | FieldChangedNotification | FirstVersionAddedNotification | ItemMovedChildCreatedNotification | ItemMovedChildRemovedNotification | ItemMovedNotification | ItemTreeMovedNotification | ItemVersionNotification | OriginalItemChangedTemplateNotification | VersionAddedNotification>] [-Language <String[]>] - - -## Detailed Description - - - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -NotificationType  <NotificationType> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- - diff --git a/appendix/commands/Get-ItemField.md b/appendix/commands/Get-ItemField.md deleted file mode 100644 index 09dfb96a..00000000 --- a/appendix/commands/Get-ItemField.md +++ /dev/null @@ -1,357 +0,0 @@ -# Get-ItemField - -Retrieves item fields as either names or fields or template fields. - -## Syntax - -Get-ItemField [-Item] <Item> [-IncludeStandardFields] [-ReturnType <Name | Field | TemplateField>] [-Name <String[]>] [-Language <String[]>] - -Get-ItemField [-Path] <String> [-IncludeStandardFields] [-ReturnType <Name | Field | TemplateField>] [-Name <String[]>] [-Language <String[]>] - -Get-ItemField -Id <String> [-Database <String>] [-IncludeStandardFields] [-ReturnType <Name | Field | TemplateField>] [-Name <String[]>] [-Language <String[]>] - - -## Detailed Description - -Retrieves item fields as either names or fields or template fields. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -IncludeStandardFields  <SwitchParameter> - -Includes fields that are defined on "Standard template" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -ReturnType  <ReturnValue> - -Determines type returned. The possible values include: -- Name - strings with field names. -- Field - fields on the item -- TemplateField - template fields. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Name  <String[]> - -Array of names to include - supports wildcards. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - -Language that will be analysed. If not specified the current user language will be used. Globbing/wildcard supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be analysed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be analysed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be analysed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be analysed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Data.Items.Item -Sitecore.Data.Templates.TemplateField -Sitecore.Data.Fields.Field - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Get list of names of non standard fields from /sitecore/content/home item - -```powershell - -PS master:\> Get-ItemField -Path master:\content\home - -Text -Title -Image - -``` - -### EXAMPLE 2 - -Get list of fields including standard fields from /sitecore/content/home item and list their Name, DisplayName, SectionDisplayName and Description in a table. - -```powershell - -PS master:\> Get-Item master:\content\home | Get-ItemField -IncludeStandardFields -ReturnType Field -Name "*" | ft Name, DisplayName, SectionDisplayName, Description -auto - -Name DisplayName SectionDisplayName Description ----- ----------- ------------------ ----------- -__Revision Revision Statistics -__Standard values __Standard values Advanced -__Updated by Updated by Statistics -__Validate Button Validation Rules Validation Button Validation Rules Validation Rules -__Created Created Statistics -__Thumbnail Thumbnail Appearance -__Insert Rules Insert Rules Insert Options -__Short description Short description Help -__Created by Created by Statistics -__Presets Presets Layout -Text Text Data The text is the main content of the document. - -``` - -## Related Topics - - * [Get-ItemTemplate](/appendix/commands/Get-ItemTemplate.md) * [Reset-ItemField](/appendix/commands/Reset-ItemField.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Get-ItemReference.md b/appendix/commands/Get-ItemReference.md deleted file mode 100644 index f6cf496c..00000000 --- a/appendix/commands/Get-ItemReference.md +++ /dev/null @@ -1,289 +0,0 @@ -# Get-ItemReference - -Returns all the items linked to the specified item.. - -## Syntax - -Get-ItemReference -Item <Item> - -Get-ItemReference -Item <Item> -ItemLink - -Get-ItemReference -Path <String> [-Language <String[]>] - -Get-ItemReference -Path <String> [-Language <String[]>] -ItemLink - -Get-ItemReference -Id <String> [-Database <String>] [-Language <String[]>] - -Get-ItemReference -Id <String> [-Database <String>] [-Language <String[]>] -ItemLink - - -## Detailed Description - -The Get-ItemReference command returns all items linked to the specified item. If -ItemLink parameter is used the command will return links rather than items. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Item  <Item> - -The item to be analysed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be processed - additionally specify Language parameter to fetch different item language than the current user language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the the item to be processed - additionally specify Language parameter to fetch different item language than the current user language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - -Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -ItemLink  <SwitchParameter> - -Return ItemLink that define both source and target of a link rather than items that are being linked to from the specified item. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Data.Items.Item -Sitecore.Links.ItemLink - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - - - -```powershell - -PS master:\>Get-ItemReference -Path master:\content\home - -Name Children Languages Id TemplateName ----- -------- --------- -- ------------ -Home True {en, de-DE, es-ES, pt... {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item -Home True {en, de-DE, es-ES, pt... {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\>Get-Item master:\content\home | Get-ItemReference -ItemLink - -SourceItemLanguage : en -SourceItemVersion : 1 -TargetItemLanguage : -TargetItemVersion : 0 -SourceDatabaseName : master -SourceFieldID : {F685964D-02E1-4DB6-A0A2-BFA59F5F9806} -SourceItemID : {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} -TargetDatabaseName : master -TargetItemID : {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} -TargetPath : /sitecore/content/Home - -``` - -## Related Topics - - * [Get-ItemReferrer](/appendix/commands/Get-ItemReferrer.md) * [Update-ItemReferrer](/appendix/commands/Update-ItemReferrer.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Get-ItemReferrer.md b/appendix/commands/Get-ItemReferrer.md deleted file mode 100644 index ce32abb6..00000000 --- a/appendix/commands/Get-ItemReferrer.md +++ /dev/null @@ -1,291 +0,0 @@ -# Get-ItemReferrer - -Returns all the items referring to the specified item. - -## Syntax - -Get-ItemReferrer -Item <Item> - -Get-ItemReferrer -Item <Item> -ItemLink - -Get-ItemReferrer -Path <String> [-Language <String[]>] - -Get-ItemReferrer -Path <String> [-Language <String[]>] -ItemLink - -Get-ItemReferrer -Id <String> [-Database <String>] [-Language <String[]>] - -Get-ItemReferrer -Id <String> [-Database <String>] [-Language <String[]>] -ItemLink - - -## Detailed Description - -The Get-ItemReferrer command returns all items referring to the specified item. If -ItemLink parameter is used the command will return links rather than items. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Item  <Item> - -The item to be analysed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be processed - additionally specify Language parameter to fetch different item language than the current user language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the the item to be processed - additionally specify Language parameter to fetch different item language than the current user language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - -Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -ItemLink  <SwitchParameter> - -Return ItemLink that define both source and target of a link rather than items linking to the specified item. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Data.Items.Item -Sitecore.Links.ItemLink - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - - - -```powershell - -PS master:\>Get-ItemReferrer -Path master:\content\home - -Name Children Languages Id TemplateName ----- -------- --------- -- ------------ -Home True {en, de-DE, es-ES, pt... {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item -Form False {en, de-DE, es-ES, pt... {6D3B4E7D-FEF8-4110-804A-B56605688830} Webcontrol -news True {en, de-DE, es-ES, pt... {DB894F2F-D53F-4A2D-B58F-957BFAC2C848} Article -learn-about-oms False {en, de-DE, es-ES, pt... {79ECF4DF-9DB7-430F-9BFF-D164978C2333} Link - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\>Get-Item master:\content\home | Get-ItemReferrer -ItemLink - -SourceItemLanguage : en -SourceItemVersion : 1 -TargetItemLanguage : -TargetItemVersion : 0 -SourceDatabaseName : master -SourceFieldID : {F685964D-02E1-4DB6-A0A2-BFA59F5F9806} -SourceItemID : {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} -TargetDatabaseName : master -TargetItemID : {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} -TargetPath : /sitecore/content/Home - -``` - -## Related Topics - - * [Get-ItemReference](/appendix/commands/Get-ItemReference.md) * [Update-ItemReferrer](/appendix/commands/Update-ItemReferrer.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Get-ItemTemplate.md b/appendix/commands/Get-ItemTemplate.md deleted file mode 100644 index 52c18371..00000000 --- a/appendix/commands/Get-ItemTemplate.md +++ /dev/null @@ -1,263 +0,0 @@ -# Get-ItemTemplate - -Returns the item template and its base templates. - -## Syntax - -Get-ItemTemplate [-Item] <Item> [-Recurse] - -Get-ItemTemplate [-Path] <String> [-Recurse] - -Get-ItemTemplate -Id <String> [-Database <String>] [-Recurse] - - -## Detailed Description - -The Get-ItemTemplate command returns the item template and its base templates. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Recurse  <SwitchParameter> - -Return the template the item is based on and all of its base templates. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be analysed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be analysed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be analysed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be analysed - required if item is specified with Id. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Data.Items.TemplateItem - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Get template of /sitecore/conent/home item - -```powershell - -PS master:\> Get-ItemTemplate -Path master:\content\home - - BaseTemplates : {Standard template} - Fields : {__Context Menu, __Display name, __Editor, __Editors...} - FullName : Sample/Sample Item - Key : sample item - OwnFields : {Title, Text, Image, State...} - StandardValues : Sitecore.Data.Items.Item - Database : master - DisplayName : Sample Item - Icon : Applications/16x16/document.png - ID : {76036F5E-CBCE-46D1-AF0A-4143F9B557AA} - InnerItem : Sitecore.Data.Items.Item - Name : Sample Item - -``` - -### EXAMPLE 2 - -Get template of /sitecore/conent/home item and all of the templates its template is based on -then format it to only show the template name, path and Key - -```powershell - -PS master:\> Get-Item -Path master:/content/Home | Get-ItemTemplate -Recurse | ft Name, FullName, Key -auto - - Name FullName Key - ---- -------- --- - Sample Item Sample/Sample Item sample item - Standard template System/Templates/Standard template standard template - Advanced System/Templates/Sections/Advanced advanced - Appearance System/Templates/Sections/Appearance appearance - Help System/Templates/Sections/Help help - Layout System/Templates/Sections/Layout layout - Lifetime System/Templates/Sections/Lifetime lifetime - Insert Options System/Templates/Sections/Insert Options insert options - Publishing System/Templates/Sections/Publishing publishing - Security System/Templates/Sections/Security security - Statistics System/Templates/Sections/Statistics statistics - Tasks System/Templates/Sections/Tasks tasks - Validators System/Templates/Sections/Validators validators - Workflow System/Templates/Sections/Workflow workflow - -``` - -## Related Topics - - * [Get-ItemField](/appendix/commands/Get-ItemField.md) * [Set-ItemTemplate](/appendix/commands/Set-ItemTemplate.md) * [Add-BaseTemplate](/appendix/commands/Add-BaseTemplate.md) * [Remove-BaseTemplate](/appendix/commands/Remove-BaseTemplate.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Get-ItemWorkflowEvent.md b/appendix/commands/Get-ItemWorkflowEvent.md deleted file mode 100644 index cfdfd116..00000000 --- a/appendix/commands/Get-ItemWorkflowEvent.md +++ /dev/null @@ -1,267 +0,0 @@ -# Get-ItemWorkflowEvent - -Returns entries from the history store notifying of workflow state change for the specified item. - -## Syntax - -Get-ItemWorkflowEvent [-Item] <Item> [-Identity <String>] [-Language <String[]>] - -Get-ItemWorkflowEvent [-Path] <String> [-Identity <String>] [-Language <String[]>] - -Get-ItemWorkflowEvent -Id <String> [-Database <String>] [-Identity <String>] [-Language <String[]>] - - -## Detailed Description - -The Get-ItemWorkflowEvent command returns entries from the history store notifying of workflow state change for the specified item. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <String> - -User that has been associated with the enteries. Wildcards are supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - -Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to have its history items returned. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to have its history items returned - additionally specify Language parameter to fetch different item language than the current user language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the the item to have its history items returned - additionally specify Language parameter to fetch different item language than the current user language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to have its history items returned - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Workflows.WorkflowEvent - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Get-ItemWorkflowEvent -Path master:\content\home -Date : 2014-07-27 14:23:33 -NewState : {190B1C84-F1BE-47ED-AA41-F42193D9C8FC} -OldState : {46DA5376-10DC-4B66-B464-AFDAA29DE84F} -Text : Automated -User : sitecore\admin - -Date : 2014-08-01 15:43:29 -NewState : {190B1C84-F1BE-47ED-AA41-F42193D9C8FC} -OldState : {190B1C84-F1BE-47ED-AA41-F42193D9C8FC} -Text : Just leaving a note -User : sitecore\admin - -``` - -## Related Topics - - * [New-ItemWorkflowEvent](/appendix/commands/New-ItemWorkflowEvent.md) * Execute-Workflow * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Get-Layout.md b/appendix/commands/Get-Layout.md deleted file mode 100644 index e01ec6ed..00000000 --- a/appendix/commands/Get-Layout.md +++ /dev/null @@ -1,291 +0,0 @@ -# Get-Layout - -Returns the layout for the specified item. - -## Syntax - -Get-Layout [-Item] <Item> [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - -Get-Layout [-Path] <String> [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - -Get-Layout -Id <String> [-Database <String>] [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - - -## Detailed Description - -The Get-Layout command returns the layout for the specified item. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Device  <DeviceItem> - -Layout Device for which the item should be returned. If not specified All layouts used will be returned. -If Device is specified but no layout is specified the command will return an error that can be silenced - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -FinalLayout  <SwitchParameter> - -Returns the Final Layout. If not provided, the Shared Layout will be returned. Applies to Sitecore 8.0 and higher only. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Get-Layout -Path master:\content\home - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Add-Rendering](/appendix/commands/Add-Rendering.md) * [New-Rendering](/appendix/commands/New-Rendering.md) * [Set-Rendering](/appendix/commands/Set-Rendering.md) * [Get-Rendering](/appendix/commands/Get-Rendering.md) * [Get-LayoutDevice](/appendix/commands/Get-LayoutDevice.md) * [Remove-Rendering](/appendix/commands/Remove-Rendering.md) * [Set-Layout](/appendix/commands/Set-Layout.md) * [Reset-Layout](/appendix/commands/Reset-Layout.md) diff --git a/appendix/commands/Get-LayoutDevice.md b/appendix/commands/Get-LayoutDevice.md deleted file mode 100644 index 9a50bce3..00000000 --- a/appendix/commands/Get-LayoutDevice.md +++ /dev/null @@ -1,138 +0,0 @@ -# Get-LayoutDevice - -Returns the layout for the specified device. - -## Syntax - -Get-LayoutDevice [-Name] <String> - -Get-LayoutDevice [-Default] - - -## Detailed Description - -The Get-LayoutDevice command returns the layout for the specified device. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Name  <String> - -Name of the device to return. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Default  <SwitchParameter> - -Determines that a default system layout device should be returned. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Data.Items.DeviceItem - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Get Print device - -```powershell - -PS master:\> Get-LayoutDevice "Print" - -``` - -### EXAMPLE 2 - -Get default device - -```powershell - -PS master:\> Get-LayoutDevice -Default - -``` - -### EXAMPLE 3 - -Get all layout devices - -```powershell - -PS master:\> Get-LayoutDevice * - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Add-Rendering](/appendix/commands/Add-Rendering.md) * [New-Rendering](/appendix/commands/New-Rendering.md) * [Set-Rendering](/appendix/commands/Set-Rendering.md) * [Get-Rendering](/appendix/commands/Get-Rendering.md) * [Remove-Rendering](/appendix/commands/Remove-Rendering.md) * [Get-Layout](/appendix/commands/Get-Layout.md) * [Set-Layout](/appendix/commands/Set-Layout.md) diff --git a/appendix/commands/Get-Package.md b/appendix/commands/Get-Package.md deleted file mode 100644 index b3caddf0..00000000 --- a/appendix/commands/Get-Package.md +++ /dev/null @@ -1,76 +0,0 @@ -# Get-Package - -Loads the package definition (xml) from the specified path. - -## Syntax - -Get-Package [-Path] <String> - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Path  <String> - -Path to the package file. If the path is not absolute the path needs to be relative to the Sitecore Package path defined in the "PackagePath" setting and later exposed in the Sitecore.Shell.Applications.Install.PackageProjectPath - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Install.PackageProject - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Get-Package -Path master:\content\home - -``` - -## Related Topics - - * [Export-Package](/appendix/commands/Export-Package.md) * Import-Package * [Install-UpdatePackage](/appendix/commands/Install-UpdatePackage.md) * [New-ExplicitFileSource](/appendix/commands/New-ExplicitFileSource.md) * [New-ExplicitItemSource](/appendix/commands/New-ExplicitItemSource.md) * [New-FileSource](/appendix/commands/New-FileSource.md) * [New-ItemSource](/appendix/commands/New-ItemSource.md) * [New-Package](/appendix/commands/New-Package.md) * 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
diff --git a/appendix/commands/Get-Preset.md b/appendix/commands/Get-Preset.md deleted file mode 100644 index 7041542b..00000000 --- a/appendix/commands/Get-Preset.md +++ /dev/null @@ -1,95 +0,0 @@ -# Get-Preset - -Returns a serialization preset for use with Export-Item. - -## Syntax - -Get-Preset [[-Name] <String[]>] - - -## Detailed Description - -The Get-Preset command returns a serialization preset for use with Export-Item. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Name  <String[]> - -Name of the serialization preset. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Data.Serialization.Presets.IncludeEntry - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Get-Preset -Name "PowerShell", "AssetsOptimiser" | ft PresetName, Database, Path -AutoSize - -PresetName Database Path ----------- -------- ---- -PowerShell core /sitecore/templates/Modules/PowerShell Console -PowerShell core /sitecore/system/Modules/PowerShell/Console Colors -PowerShell core /sitecore/system/Modules/PowerShell/Script Library -PowerShell core /sitecore/layout/Layouts/Applications/PowerShell Console -PowerShell core /sitecore/layout/Layouts/Applications/PowerShell ISE Sheer -PowerShell core /sitecore/layout/Layouts/Applications/PowerShell ISE -PowerShell core /sitecore/layout/Layouts/Applications/PowerShell ListView -PowerShell core /sitecore/content/Documents and Settings/All users/Start menu/Right/PowerShell Toolbox -PowerShell core /sitecore/content/Applications/PowerShell -PowerShell core /sitecore/content/Applications/Content Editor/Context Menues/Default/Context PowerShell Scripts -PowerShell master /sitecore/templates/Modules/PowerShell Console -PowerShell master /sitecore/system/Modules/PowerShell/Console Colors -PowerShell master /sitecore/system/Modules/PowerShell/Rules -PowerShell master /sitecore/system/Modules/PowerShell/Script Library -AssetsOptimiser master /sitecore/templates/Cognifide/Optimiser -AssetsOptimiser master /sitecore/system/Modules/Optimiser - -``` - -## Related Topics - - * Serialize-Item * Deserialize-Item * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Get-Rendering.md b/appendix/commands/Get-Rendering.md deleted file mode 100644 index afed37f2..00000000 --- a/appendix/commands/Get-Rendering.md +++ /dev/null @@ -1,540 +0,0 @@ -# Get-Rendering - -Returns a RenderingDefinition for an item using the filtering parameters. - -## Syntax - -Get-Rendering -Item <Item> [-DataSource <String>] [-Rendering <Item>] [-Index <Int32>] [-PlaceHolder <String>] [-Parameter <Hashtable>] [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - -Get-Rendering -Item <Item> -Instance <RenderingDefinition> [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - -Get-Rendering -Item <Item> -UniqueId <String> [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - -Get-Rendering -Path <String> [-DataSource <String>] [-Rendering <Item>] [-Index <Int32>] [-PlaceHolder <String>] [-Parameter <Hashtable>] [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - -Get-Rendering -Path <String> -Instance <RenderingDefinition> [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - -Get-Rendering -Path <String> -UniqueId <String> [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - -Get-Rendering [-Id <String>] [-Database <String>] [-DataSource <String>] [-Rendering <Item>] [-Index <Int32>] [-PlaceHolder <String>] [-Parameter <Hashtable>] [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - -Get-Rendering [-Id <String>] [-Database <String>] -Instance <RenderingDefinition> [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - -Get-Rendering [-Id <String>] [-Database <String>] -UniqueId <String> [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - - -## Detailed Description - -The Get-Rendering command returns a RenderingDefinition for an item using the filtering parameters. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Item  <Item> - -The item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -DataSource  <String> - -Data source filter - supports wildcards. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Rendering  <Item> - -Item representing the sublayout/rendering. If matching the rendering will be returned. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Index  <Int32> - -Index at which the rendering exists in the layout. The rendering at that index will be returned. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -PlaceHolder  <String> - -Place holder at which the rendering exists in the layout. Renderings at that place holder will be returned. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Parameter  <Hashtable> - -Additional rendering parameter values. If both name and value match - the rendering will be returned. Values support wildcards. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Instance  <RenderingDefinition> - -Specific instance of rendering that should be returned. The instance could earlier be obtained through e.g. use of Get-Rendering. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -UniqueId  <String> - -UniqueID of the rendering to be retrieved. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Device  <DeviceItem> - -Device for which the renderings will be retrieved. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -FinalLayout  <SwitchParameter> - -Targets the Final Layout. If not provided, the Shared Layout will be targeted. Applies to Sitecore 8.0 and higher only. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Layouts.RenderingDefinitio - -## 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 - -```powershell - -PS master:\> Get-Item master:\content\home | Get-Rendering -Placeholder "*main*" -Device (Get-LayoutDevice "Default") - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Add-Rendering](/appendix/commands/Add-Rendering.md) * [New-Rendering](/appendix/commands/New-Rendering.md) * [Set-Rendering](/appendix/commands/Set-Rendering.md) * [Get-LayoutDevice](/appendix/commands/Get-LayoutDevice.md) * [Remove-Rendering](/appendix/commands/Remove-Rendering.md) * [Get-Layout](/appendix/commands/Get-Layout.md) * [Set-Layout](/appendix/commands/Set-Layout.md) diff --git a/appendix/commands/Get-Role.md b/appendix/commands/Get-Role.md deleted file mode 100644 index dc2ae67b..00000000 --- a/appendix/commands/Get-Role.md +++ /dev/null @@ -1,191 +0,0 @@ -# Get-Role - -Returns one or more Sitecore roles using the specified criteria. - -## Syntax - -Get-Role [-Identity] <AccountIdentity> - -Get-Role -Filter <String> - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <AccountIdentity> - -Specifies the Sitecore role by providing one of the following values. - - Local Name - Example: developer - Fully Qualified Name - Example: sitecore\developer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Filter  <String> - -Specifies a simple pattern to match Sitecore roles. - -Examples: -The following examples show how to use the filter syntax. - -To get all the roles, use the asterisk wildcard: -Get-Role -Filter * - -To get all the roles in a domain use the following command: -Get-Role -Filter "sitecore\*" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* System.String -Represents the identity of a role. - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Security.Accounts.Role -Returns one or more roles. - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - - - -```powershell - -PS master:\> Get-Role -Identity sitecore\developer - -Name Domain IsEveryone ----- ------ ---------- -sitecore\developer sitecore False - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\> "sitecore\developer","sitecore\author" | Get-Role - -Name Domain IsEveryone ----- ------ ---------- -sitecore\author sitecore False -sitecore\developer sitecore False - -``` - -### EXAMPLE 3 - - - -```powershell - -PS master:\> Get-Role -Filter sitecore\d* - -Name Domain IsEveryone ----- ------ ---------- -sitecore\Designer sitecore False -sitecore\Developer sitecore False - -``` - -### EXAMPLE 4 - -Expand the MemberOf property to see a list of roles that the specified role is a member. - -```powershell - -PS master:\> Get-Role -Identity sitecore\developer | Select-Object -ExpandProperty MemberOf - -Name Domain IsEveryone ----- ------ ---------- -sitecore\Sitecore Client Configuring sitecore False -sitecore\Sitecore Client Developing sitecore False -sitecore\Designer sitecore False -sitecore\Author sitecore False -sitecore\Sitecore Client Maintaining sitecore False - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Get-RoleMember](/appendix/commands/Get-RoleMember.md) diff --git a/appendix/commands/Get-RoleMember.md b/appendix/commands/Get-RoleMember.md deleted file mode 100644 index 398a6639..00000000 --- a/appendix/commands/Get-RoleMember.md +++ /dev/null @@ -1,227 +0,0 @@ -# Get-RoleMember - -Returns the Sitecore users in the specified role. - -## Syntax - -Get-RoleMember [-Identity] <AccountIdentity> [-Recurse] - -Get-RoleMember [-Identity] <AccountIdentity> [-UsersOnly] [-Recurse] - -Get-RoleMember [-Identity] <AccountIdentity> [-RolesOnly] [-Recurse] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <AccountIdentity> - -Specifies the Sitecore role by providing one of the following values. - - Local Name - Example: developer - Fully Qualified Name - Example: sitecore\developer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Recurse  <SwitchParameter> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -UsersOnly  <SwitchParameter> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -RolesOnly  <SwitchParameter> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* System.String -Represents the identity of a role. - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Security.Accounts.User -Returns one or more users. - -Sitecore.Security.Accounts.Role -Returns one or more roles. - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - - - -```powershell - -PS master:\> Get-RoleMember -Identity developer - -Name Domain IsAdministrator IsAuthenticated ----- ------ --------------- --------------- -sitecore\michael sitecore False False - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\> Get-RoleMember -Identity author - -Name Domain IsAdministrator IsAuthenticated ----- ------ --------------- --------------- -sitecore\michael sitecore False False - -Domain : sitecore -IsEveryone : False -IsGlobal : False -AccountType : Role -Description : Role -DisplayName : sitecore\Developer -LocalName : sitecore\Developer -Name : sitecore\Developer - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Get-Role](/appendix/commands/Get-Role.md) * [Remove-RoleMember](/appendix/commands/Remove-RoleMember.md) * [Add-RoleMember](/appendix/commands/Add-RoleMember.md) diff --git a/appendix/commands/Get-ScriptSession.md b/appendix/commands/Get-ScriptSession.md deleted file mode 100644 index f20960fc..00000000 --- a/appendix/commands/Get-ScriptSession.md +++ /dev/null @@ -1,246 +0,0 @@ -# Get-ScriptSession - -Returns the list of PowerShell Extensions script sessions running in the system. - -## Syntax - -Get-ScriptSession -Current [-SessionType <String[]>] [-State <None | Available | AvailableForNestedCommand | Busy | RemoteDebug>] - -Get-ScriptSession -Id <String[]> [-SessionType <String[]>] [-State <None | Available | AvailableForNestedCommand | Busy | RemoteDebug>] - -Get-ScriptSession -Session <ScriptSession[]> [-SessionType <String[]>] [-State <None | Available | AvailableForNestedCommand | Busy | RemoteDebug>] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Current  <SwitchParameter> - -Returns current script session if the session is run in a background job. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -SessionType  <String[]> - -Type of the script session to be retrieved. - The SessionType is a string that identifies where the session has been launched. You can type one or more session types (separated by commas) and use wildcards to filter. To find currently running types of a script session, type "Get-ScriptSession" without parameters. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -State  <RunspaceAvailability> - -Type of the script session to be retrieved. - The parameter limits script sessions to be returned to only those in a specific state, the values should be "Busy" or "Available". To find states of currently running script sessions, type "Get-ScriptSession" without parameters. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String[]> - -Gets the script session with the specified IDs. -The ID is a string that uniquely identifies the script session within the server. You can type one or more IDs (separated by commas). To find the ID of a script session, type "Get-ScriptSession" without parameters. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Session  <ScriptSession[]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* None - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Cognifide.PowerShell.PowerShellIntegrations.Host.ScriptSessio - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - - - -```powershell - -PS master:\>Get-ScriptSession - -Type Key Location Auto Disposed ----- --- -------- ------------- -Console $scriptSession$|zwlyrcmmzwisv22djsv0ej2a|8d5c3e63-3fed-0532-e7c5-761760567b83 False -Context $scriptSession$|zwlyrcmmzwisv22djsv0ej2a|renderingCopySession master:\content\Home False -Context $scriptSession$|zwlyrcmmzwisv22djsv0ej2a|packageBuilder master:\content\Home False - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\>Get-ScriptSession -Current - -Type Key Location Auto Disposed ----- --- -------- ------------- -Console $scriptSession$|zwlyrcmmzwisv22djsv0ej2a|8d5c3e63-3fed-0532-e7c5-761760567b83 False - -``` - -## Related Topics - - * [Receive-ScriptSession](/appendix/commands/Receive-ScriptSession.md) * [Remove-ScriptSession](/appendix/commands/Remove-ScriptSession.md) * [Start-ScriptSession](/appendix/commands/Start-ScriptSession.md) * [Stop-ScriptSession](/appendix/commands/Stop-ScriptSession.md) * [Wait-ScriptSession](/appendix/commands/Wait-ScriptSession.md) * https://git.io/spe
* http://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/
diff --git a/appendix/commands/Get-SearchIndex.md b/appendix/commands/Get-SearchIndex.md deleted file mode 100644 index ad95b18e..00000000 --- a/appendix/commands/Get-SearchIndex.md +++ /dev/null @@ -1,118 +0,0 @@ -# Get-SearchIndex - -Returns the available Sitecore indexes. - -## Syntax - -Get-SearchIndex [-Name <String>] - -Get-SearchIndex [-Name <String>] - - -## Detailed Description - -The Get-SearchIndex command returns the available Sitecore indexes. These are the same as those found in the Control Panel. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Name  <String> - -Name of the index to return. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* 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 - -## Examples - -### EXAMPLE 1 - - - -```powershell - -The following lists all available indexes. - -PS master:\>Get-SearchIndex - -Name IndexingState IsRebuilding IsSharded ----- ------------- ------------ --------- -sitecore_analytics_index Started False False -sitecore_core_index Started False False -sitecore_master_index Started True False -sitecore_web_index Started False False -sitecore_marketing_asset_inde... Started False False -sitecore_marketing_asset_inde... Started False False -sitecore_testing_index Started False False -sitecore_suggested_test_index Started False False -sitecore_fxm_master_index Started False False -sitecore_fxm_web_index Started False False -sitecore_list_index Started False False -social_messages_master Started False False -social_messages_web Started False False - -``` - -### EXAMPLE 2 - - - -```powershell - -The following lists only the specified index. - -PS master:\>Get-SearchIndex -Name sitecore_master_index - -Name IndexingState IsRebuilding IsSharded ----- ------------- ------------ --------- -sitecore_master_index Started True False - -``` - -## Related Topics - - * [Initialize-SearchIndex](/appendix/commands/Initialize-SearchIndex.md) * [Stop-SearchIndex](/appendix/commands/Stop-SearchIndex.md) * [Resume-SearchIndex](/appendix/commands/Resume-SearchIndex.md) * [Suspend-SearchIndex](/appendix/commands/Suspend-SearchIndex.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Get-Session.md b/appendix/commands/Get-Session.md deleted file mode 100644 index 565d78e7..00000000 --- a/appendix/commands/Get-Session.md +++ /dev/null @@ -1,159 +0,0 @@ -# Get-Session - -Returns one or more Sitecore user sessions using the specified criteria. - -## Syntax - -Get-Session [-Identity <AccountIdentity>] - -Get-Session -InstanceId <String[]> - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <AccountIdentity> - -Specifies the Sitecore user by providing one of the following values. - - Local Name - Example: admin - Fully Qualified Name - Example: sitecore\admi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -InstanceId  <String[]> - -Specifies the Sitecore SessionID. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* None. - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Web.Authentication.DomainAccessGuard.Session -Returns one or more user sessions. - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - - - -```powershell - -PS master:\> Get-Session - -Created LastRequest SessionID UserName -------- ----------- --------- -------- -7/3/2014 3:30:39 PM 7/3/2014 3:44:27 PM tekipna1lk0ccr2z1bdjsua2 sitecore\admin -7/3/2014 4:13:55 PM 7/3/2014 4:13:55 PM wq4bfivfm2tbgkgdccpyzczp sitecore\michael - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\> Get-Session -Identity admin - -Created LastRequest SessionID UserName -------- ----------- --------- -------- -7/3/2014 3:30:39 PM 7/3/2014 3:44:27 PM tekipna1lk0ccr2z1bdjsua2 sitecore\admin - -``` - -### EXAMPLE 3 - - - -```powershell - -PS master:\> Get-Session -InstanceId tekipna1lk0ccr2z1bdjsua2,wq4bfivfm2tbgkgdccpyzczp - -Created LastRequest SessionID UserName -------- ----------- --------- -------- -7/3/2014 3:30:39 PM 7/3/2014 3:44:27 PM tekipna1lk0ccr2z1bdjsua2 sitecore\admin - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Remove-Session](/appendix/commands/Remove-Session.md) diff --git a/appendix/commands/Get-SpeModule.md b/appendix/commands/Get-SpeModule.md deleted file mode 100644 index 6cb2cfa1..00000000 --- a/appendix/commands/Get-SpeModule.md +++ /dev/null @@ -1,247 +0,0 @@ -# Get-SpeModule - -Returns the object that describes a Sitecore PowerShell Extensions Module - -## Syntax - -Get-SpeModule -Item <Item> - -Get-SpeModule -Path <String> - -Get-SpeModule -Id <String> -Database <String> - -Get-SpeModule -Database <String> - -Get-SpeModule [-Database <String>] -Name <String> - - -## Detailed Description - -The Get-SpeModule command returns the object that describes a Sitecore PowerShell Extensions Module. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Item  <Item> - -A script or library item that is defined within the module to be returned. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to a script or library item that is defined within the module to be returned. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of a script or library item that is defined within the module to be returned. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the module to be returned. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Name  <String> - -Name fo the module to return. Supports wildcards. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item -System.String - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Cognifide.PowerShell.Core.Modules.Module - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Return all modules defined in the provided database - -```powershell - -PS master:\> Get-SpeModule -Database (Get-Database "master") - -``` - -### EXAMPLE 2 - -Return all modules defined in the master database Matching the "Content*" wildcard - -```powershell - -PS master:\> Get-SpeModule -Database (Get-Database "master") - -``` - -### EXAMPLE 3 - -Return the module the piped script belongs to - -```powershell - -PS master:\> Get-item "master:\system\Modules\PowerShell\Script Library\Copy Renderings\Content Editor\Context Menu\Layout\Copy Renderings" | Get-SpeModule - -``` - -## Related Topics - - * [Get-SpeModuleFeatureRoot](/appendix/commands/Get-SpeModuleFeatureRoot.md) * http://blog.najmanowicz.com/2014/11/01/sitecore-powershell-extensions-3-0-modules-proposal/
* https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Get-SpeModuleFeatureRoot.md b/appendix/commands/Get-SpeModuleFeatureRoot.md deleted file mode 100644 index d2c7ccc8..00000000 --- a/appendix/commands/Get-SpeModuleFeatureRoot.md +++ /dev/null @@ -1,184 +0,0 @@ -# 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 <Module>] [-ReturnPath] [-Feature] <String> - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Module  <Module> - -Module for which the feature root library should be returned. -If not provided the feature root will be returned for all modules. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -ReturnPath  <SwitchParameter> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Feature  <String> - -Feature for which the root library should be provided. -If root item does not exist and -ReturnPath parameter is not specified - nothing will be returned, -If -ReturnPath parameter is provided the path in which the feature root should be located will be returned - -Valid features: -- contentEditorContextMenu -- contentEditorGutters -- contentEditorRibbon -- controlPanel -- functions -- listViewExport -- listViewRibbon -- pipelineLoggedIn -- pipelineLoggingIn -- pipelineLogout -- toolbox -- startMenuReports -- eventHandlers -- webAPI -- pageEditorNotification -- isePlugi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Data.Items.Item -System.String - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Return the library item for "Content Editor Context Menu" - -```powershell - -$module = Get-SpeModule -Name "Copy Renderings" -Get-SpeModuleFeatureRoot -Feature contentEditorContextMenu -Module $module - -``` - -### EXAMPLE 2 - -Return the Path to where "List View Export" scripts would be located if this feature was defined - -```powershell - -$module = Get-SpeModule -Name "Copy Renderings" -Get-SpeModuleFeatureRoot -Module $module -Feature listViewExport -ReturnPath - -``` - -## Related Topics - - * [Get-SpeModule](/appendix/commands/Get-SpeModule.md) * http://blog.najmanowicz.com/2014/11/01/sitecore-powershell-extensions-3-0-modules-proposal/
* https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Get-UpdatePackageDiff.md b/appendix/commands/Get-UpdatePackageDiff.md deleted file mode 100644 index 643bba03..00000000 --- a/appendix/commands/Get-UpdatePackageDiff.md +++ /dev/null @@ -1,156 +0,0 @@ -# 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] <String> [[-TargetPath] <String>] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -SourcePath  <String> - -Path containing the current serialization items that needs to be transformed into Target. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -TargetPath  <String> - -Path containing the desired serialization state that the Source needs to be transformed to. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Update.Interfaces.ICommand - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Required addition to web.config file for the functionality to work: - -```powershell - - - -
- - - - - - __Created - {5DD74568-4D4B-44C1-B513-0AF5F4CDA34F} - __Revision - __Updated - __Updated by - - - - - - $(id) - - - $(id) - - - - - source - - - - target - - - - -``` - -### 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 - -```powershell - -$diff = Get-UpdatePackageDiff -SourcePath C:\temp\SerializationSource -TargetPath C:\temp\SerializationTarget -Export-UpdatePackage -Path C:\temp\SerializationDiff.update -CommandList $diff -Name name - -``` - -## Related Topics - - * [Export-UpdatePackage](/appendix/commands/Export-UpdatePackage.md) * [Install-UpdatePackage](/appendix/commands/Install-UpdatePackage.md) * http://sitecoresnippets.blogspot.com/2012/10/sitecore-courier-effortless-packaging.html
* https://github.com/adoprog/Sitecore-Courier
* https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Get-User.md b/appendix/commands/Get-User.md deleted file mode 100644 index c8e3104a..00000000 --- a/appendix/commands/Get-User.md +++ /dev/null @@ -1,313 +0,0 @@ -# Get-User - -Returns one or more Sitecore users using the specified criteria. - -## Syntax - -Get-User [-Identity] <AccountIdentity> [-Authenticated] - -Get-User -Filter <String> [-Authenticated] [-ResultPageSize <Int32>] - -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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <AccountIdentity> - -Specifies the Sitecore user by providing one of the following values. - -Local Name: - - admin - -Fully Qualified Name: - - sitecore\admi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Filter  <String> - -Specifies a simple pattern to match Sitecore users. - -Examples: -The following examples show how to use the filter syntax. - -To get all the users, use the asterisk wildcard: - - Get-User -Filter * - -To get all the users in a domain use the following command: - - Get-User -Filter "sitecore\*" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Current  <SwitchParameter> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Authenticated  <SwitchParameter> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -ResultPageSize  <Int32> - -Specifies the number of users to retrieve per request to the user provider. Each page of users is written to the pipeline before the next request is made. Without specifying this parameter all accounts are retrieved before passing down the pipeline. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* System.String -Represents the identity of a user. - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Security.Accounts.User -Returns one or more users. - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - - - -```powershell - -PS master:\> Get-User -Identity admin - -Name Domain IsAdministrator IsAuthenticated ----- ------ --------------- --------------- -sitecore\admin sitecore True False - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\> "admin","michael" | Get-User - -Name Domain IsAdministrator IsAuthenticated ----- ------ --------------- --------------- -sitecore\Admin sitecore True False -sitecore\michael sitecore False False - -``` - -### EXAMPLE 3 - - - -```powershell - -PS master:\> Get-User -Filter * - -Name Domain IsAdministrator IsAuthenticated ----- ------ --------------- --------------- -default\Anonymous default False False -extranet\Anonymous extranet False False -sitecore\Admin sitecore True False -sitecore\michael sitecore False False - -``` - -### EXAMPLE 4 - - - -```powershell - -PS master:\> Get-User -Filter "michaellwest@*.com" - -Name Domain IsAdministrator IsAuthenticated ----- ------ --------------- --------------- -sitecore\michael sitecore False False - -``` - -### EXAMPLE 5 - -Expand the MemberOf property to see a list of roles that the specified user is a member. - -```powershell - -PS master:\> Get-User -Identity sitecore\michael | Select-Object -ExpandProperty MemberOf - -Name Domain IsEveryone ----- ------ ---------- -sitecore\PowerShell Extensions Remoting sitecore False -sitecore\Developer sitecore False - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Set-User](/appendix/commands/Set-User.md) * [New-User](/appendix/commands/New-User.md) * [Remove-User](/appendix/commands/Remove-User.md) * [Unlock-User](/appendix/commands/Unlock-User.md) diff --git a/appendix/commands/Get-UserAgent.md b/appendix/commands/Get-UserAgent.md deleted file mode 100644 index fa71612f..00000000 --- a/appendix/commands/Get-UserAgent.md +++ /dev/null @@ -1,42 +0,0 @@ -# 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-2017 Adam Najmanowicz, 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 - - - -```powershell - -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/
diff --git a/appendix/commands/Import-Function.md b/appendix/commands/Import-Function.md deleted file mode 100644 index c2216dd7..00000000 --- a/appendix/commands/Import-Function.md +++ /dev/null @@ -1,151 +0,0 @@ -# Import-Function - -Imports a function script from the script library's "Functions" folder. - -## Syntax - -Import-Function [-Name] <String> [-Library <String>] [-Module <String>] - - -## Detailed Description - -The Import-Function command imports a function script from the script library's "Functions" folder. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Name  <String> - -Name of the script in the "Functions" library or one of its sub-libraries. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Library  <String> - -Name of the library withing the "Functions" library. Provide this name to disambiguate a script from other scripts of the same name that might exist in multiple sub-librarties of the Functions library. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Module  <String> - -Name of the module "Functions" are going to be taken from. Provide this name to disambiguate a script from other scripts of the same name that might exist in multiple Modules. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* System.Object - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - -The following imports a Resolve-Error function that you may later use to get a deeper understanding of a problem with script should one occur by xecuting the "Resolve-Error" command -that was imported as a result of the execution of the following line - -```powershell - -PS master:\> Import-Function -Name Resolve-Error - -``` - -## Related Topics - - * [Invoke-Script](/appendix/commands/Invoke-Script.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Import-Item.md b/appendix/commands/Import-Item.md deleted file mode 100644 index 60652ab6..00000000 --- a/appendix/commands/Import-Item.md +++ /dev/null @@ -1,376 +0,0 @@ -# Import-Item - -Imports (deserializes) the specified path from the filesystem on the server as a Sitecore item. - -## Syntax - -Import-Item [-Database <Database>] [-Root <String>] [-UseNewId] [-DisableEvents] [-ForceUpdate] - -Import-Item [-Item] <Item> [-Recurse] [-Root <String>] [-UseNewId] [-DisableEvents] [-ForceUpdate] - -Import-Item [-Preset] <IncludeEntry> [-Root <String>] [-UseNewId] [-DisableEvents] [-ForceUpdate] - -Import-Item [-Path] <String> [-Recurse] [-Root <String>] [-UseNewId] [-DisableEvents] [-ForceUpdate] - - -## Detailed Description - -The Import-Item command deserializes the specified items. - -The simplest syntax requires 2 parameters: -- -Path : which is a path to the item on the drive but without .item extension. If the item does not exist in the Sitecore tree yet, you need to pass the parent item path. -- -Root : the directory which is the root of serialization. Trailing slash \ character is required, - -e.g.: - -Import-Item -Path "c:\project\data\serialization\master\sitecore\content\articles" -Root "c:\project\data\serialization\" - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions## Aliases -The following abbreviations are aliases for this cmdlet: -* Deserialize-Item - -## Parameters - -### -Database  <Database> - -Database to contain the item to be deserialized. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be serialized. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Preset  <IncludeEntry> - -Name of the preset to be deserialized. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item on the drive but without .item extension. If the item does not exist in the Sitecore tree yet, you need to pass the parent item path. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Recurse  <SwitchParameter> - -If included in the execution - dederializes both the item and all of its children. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Root  <String> - -The directory which is the root of serialization. Trailing slash \ character is required. if not specified the default root will be used. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -UseNewId  <SwitchParameter> - -Tells Sitecore if each of the items should be created with a newly generated ID, e.g. -Import-Item -path "c:\project\data\serialization\master\sitecore\content\articles" -root "c:\project\data\serialization\" -usenewid -recurse - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -DisableEvents  <SwitchParameter> - -If set Sitecore will use EventDisabler during deserialization, e.g.: -Import-Item -path "c:\project\data\serialization\master\sitecore\content\articles" -root "c:\project - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -ForceUpdate  <SwitchParameter> - -Forces item to be updated even if it has not changed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* System.Void - -## Notes - -Help Author: Marek Musielak, Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - - - -```powershell - -PS master:\> Import-Item -path "c:\project\data\serialization\master\sitecore\content\articles" -root "c:\project\data\serialization\" - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\> Import-Item -path "c:\project\data\serialization\master\sitecore\content\articles" -root "c:\project\data\serialization\" -recurse - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Export-Item](/appendix/commands/Export-Item.md) * [Get-Preset](/appendix/commands/Get-Preset.md) * 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
diff --git a/appendix/commands/Import-Role.md b/appendix/commands/Import-Role.md deleted file mode 100644 index c79404b0..00000000 --- a/appendix/commands/Import-Role.md +++ /dev/null @@ -1,263 +0,0 @@ -# Import-Role - -Imports (deserializes) Sitecore roles from the Sitecore server filesystem. - -## Syntax - -Import-Role [-Identity] <AccountIdentity> [-Root <String>] - -Import-Role -Filter <String> [-Root <String>] - -Import-Role [-Role] <User> [-Root <String>] - -Import-Role -Path <String> - - -## Detailed Description - -The Import-Role command imports (deserializes) Sitecore roles from the Sitecore server filesystem. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <AccountIdentity> - -Specifies the Sitecore role to be deserialized by providing one of the following values. - - Local Name - Example: developer - Fully Qualified Name - Example: sitecore\developer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Filter  <String> - -Specifies a simple pattern to match Sitecore roles. - -Examples: -The following examples show how to use the filter syntax. - -To get all the roles, use the asterisk wildcard: -Import-Role -Filter * - -To get all the roles in a domain use the following command: -Import-Role -Filter "sitecore\*" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Role  <User> - -An existing role object to be restored to the version from disk - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the file the role should be loaded from. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Root  <String> - -Specifies the serialization root directory. If this parameter is not specified - the default Sitecore serialization folder will be used (unless you're reading from an explicit location with the -Path parameter). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -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 - - - -```powershell - -PS master:\> Import-Role -Identity sitecore\Author - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\> Import-Role -Filter sitecore\* - -``` - -### EXAMPLE 3 - - - -```powershell - -PS master:\> Import-Role -Root C:\my\Serialization\Folder\ -Filter *\* - -``` - -### EXAMPLE 4 - - - -```powershell - -PS master:\> Import-Role -Path C:\my\Serialization\Folder\Admins.role - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Import-User.md b/appendix/commands/Import-User.md deleted file mode 100644 index 87391e21..00000000 --- a/appendix/commands/Import-User.md +++ /dev/null @@ -1,263 +0,0 @@ -# Import-User - -Imports (deserializes) Sitecore users from the Sitecore server filesystem. - -## Syntax - -Import-User [-Identity] <AccountIdentity> [-Root <String>] - -Import-User -Filter <String> [-Root <String>] - -Import-User [-User] <User> [-Root <String>] - -Import-User -Path <String> - - -## Detailed Description - -The Import-User command imports (deserializes) Sitecore users from the Sitecore server filesystem. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <AccountIdentity> - -Specifies the Sitecore user to be deserialized by providing one of the following values. - - Local Name - Example: developer - Fully Qualified Name - Example: sitecore\developer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Filter  <String> - -Specifies a simple pattern to match Sitecore users. - -Examples: -The following examples show how to use the filter syntax. - -To get all the roles, use the asterisk wildcard: -Import-User -Filter * - -To get all the roles in a domain use the following command: -Import-User -Filter "sitecore\*" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -User  <User> - -User object retrieved from the Sitecore API or using the Get-User command identifying the user account to be deserialized. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the file the user should be loaded from. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Root  <String> - -Specifies the serialization root directory. If this parameter is not specified - the default Sitecore serialization folder will be used (unless you're reading from an explicit location with the -Path parameter). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -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 - - - -```powershell - -PS master:\> Import-User -Identity sitecore\Admin - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\> Import-User -Filter sitecore\* - -``` - -### EXAMPLE 3 - - - -```powershell - -PS master:\> Import-User -Root C:\my\Serialization\Folder\ -Filter *\* - -``` - -### EXAMPLE 4 - - - -```powershell - -PS master:\> Import-User -Path C:\my\Serialization\Folder\Admin.user - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Initialize-Item.md b/appendix/commands/Initialize-Item.md deleted file mode 100644 index dc385b8f..00000000 --- a/appendix/commands/Initialize-Item.md +++ /dev/null @@ -1,127 +0,0 @@ -# Initialize-Item - -Initializes items with the PowerShell automatic properties for each field. - -## Syntax - -Initialize-Item -Item <Item> - -Initialize-Item -SearchResultItem <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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions## Aliases -The following abbreviations are aliases for this cmdlet: -* Wrap-Item - -## Parameters - -### -Item  <Item> - -The item to be wrapped/initialized. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -SearchResultItem  <SearchResultItem> - -The item obtained from Find-Item command to be translated into a sitecore item. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item -Sitecore.ContentSearch.SearchTypes.SearchResultItem - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - -Initialize the item obtained directly through the Sitecore API with additional PowerShell properties - -```powershell - -$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 properties -$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 the added PowerShell property. -$item.Title = "New Title" - -``` - -## Related Topics - - * [Find-Item](/appendix/commands/Find-Item.md) * Get-Item * Get-ChildItem * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Initialize-SearchIndex.md b/appendix/commands/Initialize-SearchIndex.md deleted file mode 100644 index 133982c1..00000000 --- a/appendix/commands/Initialize-SearchIndex.md +++ /dev/null @@ -1,204 +0,0 @@ -# Initialize-SearchIndex - -Rebuilds the Sitecore index. - -## Syntax - -Initialize-SearchIndex -Index <ISearchIndex> [-IncludeRemoteIndex] [-AsJob] - -Initialize-SearchIndex [-IncludeRemoteIndex] [-Name <String>] [-AsJob] - -Initialize-SearchIndex [-Name <String>] [-AsJob] - - -## Detailed Description - -The Rebuild-SearchIndex command rebuilds Sitecore index. This command is an alias for Initialize-SearchIndex. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions## Aliases -The following abbreviations are aliases for this cmdlet: -* Rebuild-SearchIndex - -## Parameters - -### -Index  <ISearchIndex> - -The index instance. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -IncludeRemoteIndex  <SwitchParameter> - -The remote indexing should be triggered. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -AsJob  <SwitchParameter> - -The job created for rebuilding the index should be returned as output. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Name  <String> - -The name of the index to resume. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* 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 - - - -```powershell - -The following rebuilds the index. - -PS master:\> Rebuild-SearchIndex -Name sitecore_master_index - -``` - -### EXAMPLE 2 - - - -```powershell - -The following rebuilds the index. - -PS master:\> Get-SearchIndex -Name sitecore_master_index | Rebuild-SearchIndex - -``` - -## Related Topics - - * [Resume-SearchIndex](/appendix/commands/Resume-SearchIndex.md) * [Suspend-SearchIndex](/appendix/commands/Suspend-SearchIndex.md) * [Stop-SearchIndex](/appendix/commands/Stop-SearchIndex.md) * [Get-SearchIndex](/appendix/commands/Get-SearchIndex.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Initialize-SearchIndexItem.md b/appendix/commands/Initialize-SearchIndexItem.md deleted file mode 100644 index c4021a7a..00000000 --- a/appendix/commands/Initialize-SearchIndexItem.md +++ /dev/null @@ -1,160 +0,0 @@ -# Initialize-SearchIndexItem - - - -## Syntax - -Initialize-SearchIndexItem -Item <Item> [-Name <String>] [-AsJob] - -Initialize-SearchIndexItem -Item <Item> [-Name <String>] [-AsJob] - -Initialize-SearchIndexItem -SearchResultItem <SearchResultItem> [-AsJob] - - -## Detailed Description - - - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions## Aliases -The following abbreviations are aliases for this cmdlet: -* Rebuild-SearchIndexItem - -## Parameters - -### -Item  <Item> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -SearchResultItem  <SearchResultItem> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -AsJob  <SwitchParameter> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Name  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- - diff --git a/appendix/commands/Install-Package.md b/appendix/commands/Install-Package.md deleted file mode 100644 index e390e267..00000000 --- a/appendix/commands/Install-Package.md +++ /dev/null @@ -1,174 +0,0 @@ -# Install-Package - -Installs a Sitecore package from the specified path. - -## Syntax - -Install-Package [[-Path] <String>] [-InstallMode <Undefined | Overwrite | Merge | Skip | SideBySide>] [-MergeMode <Undefined | Clear | Append | Merge>] [-DisableIndexing] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions## Aliases -The following abbreviations are aliases for this cmdlet: -* Import-Package - -## Parameters - -### -Path  <String> - -Path to the package file. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -InstallMode  <InstallMode> - -Undefined, Overwrite, Merge, Skip, SideBySide - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -MergeMode  <MergeMode> - -Undefined, Clear, Append, Merge - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -DisableIndexing  <SwitchParameter> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Install-Package -Path SitecorePowerShellConsole.zip -InstallMode Merge -MergeMode Merge - -``` - -## Related Topics - - * [Export-Package](/appendix/commands/Export-Package.md) * [Get-Package](/appendix/commands/Get-Package.md) * [Install-UpdatePackage](/appendix/commands/Install-UpdatePackage.md) * [New-ExplicitFileSource](/appendix/commands/New-ExplicitFileSource.md) * [New-ExplicitItemSource](/appendix/commands/New-ExplicitItemSource.md) * [New-FileSource](/appendix/commands/New-FileSource.md) * [New-ItemSource](/appendix/commands/New-ItemSource.md) * [New-Package](/appendix/commands/New-Package.md) * 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
diff --git a/appendix/commands/Install-UpdatePackage.md b/appendix/commands/Install-UpdatePackage.md deleted file mode 100644 index 99d7ecd4..00000000 --- a/appendix/commands/Install-UpdatePackage.md +++ /dev/null @@ -1,183 +0,0 @@ -# Install-UpdatePackage - -Installs a Sitecore update package from the specified path. - -## Syntax - -Install-UpdatePackage [-Path] <String> [[-RollbackPackagePath] <String>] -UpgradeAction <Preview | Upgrade> -InstallMode <Install | Update> - - -## Detailed Description - -The Install-UpdatePackage command installs update packages that are used created by Sitecore CMS updates, TDS, and Courier. - -Install-UpdatePackage. - Install-UpdatePackage -Path "C:\Projects\LaunchSitecore.TDSMaster.update" - -UpgradeAction {Preview or Upgrade} - -InstallMode {Install or Update} - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Path  <String> - -Path to the .update package on the Sitecore server disk drive. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -RollbackPackagePath  <String> - -Specify Rollback Package Path - for rolling back if the installation was not functioning as expected. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -UpgradeAction  <UpgradeAction> - -Preview / Upgrade - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -InstallMode  <InstallMode> - -Install / Update - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Update.Installer.ContingencyEntry - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Install-UpdatePackage -Path "C:\Projects\LaunchSitecore.TDSMaster.update" -UpgradeAction Preview -InstallMode Install - -``` - -## Related Topics - - * [Export-UpdatePackage](/appendix/commands/Export-UpdatePackage.md) * [Get-UpdatePackageDiff](/appendix/commands/Get-UpdatePackageDiff.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Invoke-JavaScript.md b/appendix/commands/Invoke-JavaScript.md deleted file mode 100644 index 25468baa..00000000 --- a/appendix/commands/Invoke-JavaScript.md +++ /dev/null @@ -1,52 +0,0 @@ -# Invoke-JavaScript - - - -## Syntax - -Invoke-JavaScript [-Script] <String> - - -## Detailed Description - - - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Script  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- - diff --git a/appendix/commands/Invoke-Script.md b/appendix/commands/Invoke-Script.md deleted file mode 100644 index c1960268..00000000 --- a/appendix/commands/Invoke-Script.md +++ /dev/null @@ -1,159 +0,0 @@ -# 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] <Item> [-ArgumentList <Object[]>] - -Invoke-Script [-Path] <String> [-ArgumentList <Object[]>] - - -## Detailed Description - -Executes a script from Sitecore PowerShell Extensions Script Library. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions## Aliases -The following abbreviations are aliases for this cmdlet: -* Execute-Script - -## Parameters - -### -Item  <Item> - -The script item to be executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the script item to be executed. -Path can be absolute or Relavie to Script library root. e.g. the following two commands are equivalent: - -PS master:\> Invoke-Script 'master:\system\Modules\PowerShell\Script Library\Examples\Script Testing\Long Running Script with Progress Demo' -PS master:\> Invoke-Script 'Examples\Script Testing\Long Running Script with Progress Demo' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -ArgumentList  <Object[]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* System.Object - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Invoke-Script 'Examples\Script Testing\Long Running Script with Progress Demo' - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Import-Function](/appendix/commands/Import-Function.md) diff --git a/appendix/commands/Invoke-ShellCommand.md b/appendix/commands/Invoke-ShellCommand.md deleted file mode 100644 index f6f9fffa..00000000 --- a/appendix/commands/Invoke-ShellCommand.md +++ /dev/null @@ -1,279 +0,0 @@ -# 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 [-Item] <Item> [-Name] <String> [-Language <String[]>] - -Invoke-ShellCommand [-Path] <String> [-Name] <String> [-Language <String[]>] - -Invoke-ShellCommand -Id <String> [-Database <String>] [-Name] <String> [-Language <String[]>] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions## Aliases -The following abbreviations are aliases for this cmdlet: -* Execute-ShellCommand - -## Parameters - -### -Name  <String> - -Name of the sitecore command e.g. "item:publishingviewer" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - -Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be sent to the command. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be sent to the command - additionally specify Language parameter to fetch different item language than the current user language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the the item to be sent to the command - additionally specify Language parameter to fetch different item language than the current user language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be sent to the command - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Launch Publishing Viewer for /sitecore/content/home item. - -```powershell - -PS master:\> Get-Item master:\content\home\ | Invoke-ShellCommand "item:publishingviewer" - -``` - -### EXAMPLE 2 - -Initiate /sitecore/content/home item duplication. - -```powershell - -PS master:\> Get-Item master:/content/home | Invoke-ShellCommand "item:duplicate" - -``` - -### EXAMPLE 3 - -Show properties of the /sitecore/content/home item. - -```powershell - -PS master:\> Get-Item master:/content/home | Invoke-ShellCommand "contenteditor:properties" - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Invoke-Workflow.md b/appendix/commands/Invoke-Workflow.md deleted file mode 100644 index 37640491..00000000 --- a/appendix/commands/Invoke-Workflow.md +++ /dev/null @@ -1,297 +0,0 @@ -# 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 [-Item] <Item> [-CommandName <String>] [-Comments <String>] [-Language <String[]>] - -Invoke-Workflow [-Path] <String> [-CommandName <String>] [-Comments <String>] [-Language <String[]>] - -Invoke-Workflow -Id <String> [-Database <String>] [-CommandName <String>] [-Comments <String>] [-Language <String[]>] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions## Aliases -The following abbreviations are aliases for this cmdlet: -* Execute-Workflow - -## Parameters - -### -CommandName  <String> - -Namer of the workflow command. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Comments  <String> - -Comment to be saved in the history table for the action. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - -Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to have the workflow action executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to have the workflow action executed - additionally specify Language parameter to fetch different item language than the current user language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the the item to have the workflow action executed - additionally specify Language parameter to fetch different item language than the current user language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to have the workflow action executed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Submit item to approval, item gotten from path - -```powershell - -PS master:\> Invoke-Workflow -Path master:/content/home -CommandName "Submit" -Comments "Automated" - -``` - -### EXAMPLE 2 - -Reject item, item gotten from pipeline - -```powershell - -PS master:\> Get-Item master:/content/home | Invoke-Workflow -CommandName "Reject" -Comments "Automated" - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Lock-Item.md b/appendix/commands/Lock-Item.md deleted file mode 100644 index 2c41098f..00000000 --- a/appendix/commands/Lock-Item.md +++ /dev/null @@ -1,311 +0,0 @@ -# Lock-Item - -Locks the Sitecore item by the current or specified user. - -## Syntax - -Lock-Item [-Item] <Item> [-Force] [-PassThru] [-Identity <AccountIdentity>] - -Lock-Item [-Path] <String> [-Force] [-PassThru] [-Identity <AccountIdentity>] - -Lock-Item -Id <String> [-Database <String>] [-Force] [-PassThru] [-Identity <AccountIdentity>] - - -## Detailed Description - -The Lock-Item command unlocks the item. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Force  <SwitchParameter> - -Forces the item to be locked by the specified user even if it's currently locked by another user. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -PassThru  <SwitchParameter> - -Passes the processed object back into the pipeline. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Identity  <AccountIdentity> - -User name including domain for which the item is to be locked. If no domain is specified - 'sitecore' will be used as the default domain. - -Specifies the Sitecore user by providing one of the following values. - - Local Name - Example: adam - Fully Qualified Name - Example: sitecore\adam - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be processed - can work with Language parameter to specify the language other than current session language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be fetched with Id parameter. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* can be piped from another cmdlet* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Only if -PassThru is used* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Lock the Home item providing its path - -```powershell - -PS master:\> Lock-Item -Path master:\content\home - -``` - -### EXAMPLE 2 - -Lock the Home item by providing it from the pipeline and passing it back to the pipeline. The Item is locked by the "sitecore\adam" user. - -```powershell - -PS master:\> Get-Item -Path master:\content\home | Lock-Item -PassThru -Identity sitecore\adam - -Name Children Languages Id TemplateName ----- -------- --------- -- ------------ -Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Unlock-Item](/appendix/commands/Unlock-Item.md) * Get-Item diff --git a/appendix/commands/Login-User.md b/appendix/commands/Login-User.md deleted file mode 100644 index eaf4f089..00000000 --- a/appendix/commands/Login-User.md +++ /dev/null @@ -1,104 +0,0 @@ -# Login-User - -Logs a user in and performs further script instructions in the context of the user. - -## Syntax - -Login-User [-Identity] <GenericIdentity> [-Password] <String> - - -## Detailed Description - -Logs a user in and performs further script instructions in the context of the user. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <GenericIdentity> - -User name including domain. If no domain is specified - 'sitecore' will be used as the default value - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Password  <String> - -Password for the account provided using the -Identity parameter. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?2
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Login-User -Identity "sitecore\admin" -Password "b" - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Logout-User.md b/appendix/commands/Logout-User.md deleted file mode 100644 index ee585b70..00000000 --- a/appendix/commands/Logout-User.md +++ /dev/null @@ -1,34 +0,0 @@ -# Logout-User - -Logs the current user out. - -## Syntax - - -## Detailed Description - -Logs the current user out. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Logout-User - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Merge-Layout.md b/appendix/commands/Merge-Layout.md deleted file mode 100644 index 4eb83474..00000000 --- a/appendix/commands/Merge-Layout.md +++ /dev/null @@ -1,192 +0,0 @@ -# Merge-Layout - - - -## Syntax - -Merge-Layout [-Item] <Item> [-Language <String[]>] - -Merge-Layout [-Path] <String> [-Language <String[]>] - -Merge-Layout -Id <String> [-Database <String>] [-Language <String[]>] - - -## Detailed Description - - - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Language  <String[]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- - diff --git a/appendix/commands/New-Domain.md b/appendix/commands/New-Domain.md deleted file mode 100644 index 0b055eb7..00000000 --- a/appendix/commands/New-Domain.md +++ /dev/null @@ -1,117 +0,0 @@ -# New-Domain - -Creates a new domain with the specified name. - -## Syntax - -New-Domain [-Name] <String> [-LocallyManaged] - - -## Detailed Description - -The New-Domain command creates a domain if it does not exist. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Name  <String> - -The name of the domain. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -LocallyManaged  <SwitchParameter> - -TODO: Provide description for this parameter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* System.String -Represents the name of a domain. - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* None. - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> New-Domain -Name "domainName" - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Get-Domain](/appendix/commands/Get-Domain.md) * [Remove-Domain](/appendix/commands/Remove-Domain.md) diff --git a/appendix/commands/New-ExplicitFileSource.md b/appendix/commands/New-ExplicitFileSource.md deleted file mode 100644 index 8a63e94e..00000000 --- a/appendix/commands/New-ExplicitFileSource.md +++ /dev/null @@ -1,164 +0,0 @@ -# New-ExplicitFileSource - -Creates new File source that can be added to a Sitecore package. - -## Syntax - -New-ExplicitFileSource [-Name] <String> [-File <FileSystemInfo>] [-InstallMode <String>] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Name  <String> - -Name of the file source. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -File  <FileSystemInfo> - -Path to the file to be included. this can be automatically discovered if a stream of files is piped to the command. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -InstallMode  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Install.Files.ExplicitFileSource - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - -Following example creates a new package, adds content of the Console folder (except the source files) under the site folder -saves it in the Sitecore Package folder + gives you an option to download the saved package. - -```powershell - -# Create package - $package = new-package "Sitecore PowerShell Extensions"; - -# Set package metadata - $package.Sources.Clear(); - - $package.Metadata.Author = "Adam Najmanowicz - Cognifide, Michael West"; - $package.Metadata.Publisher = "Cognifide Limited"; - $package.Metadata.Version = "2.7"; - $package.Metadata.Readme = 'This text will be visible to people installing your package' - -# Add content of the Console folder (except the source files) located in the site folder to the package - $source = Get-ChildItem -exclude *.cs -Path "$AppPath\Console" -Recurse -File | New-ExplicitFileSource -Name "Console Assets" - $package.Sources.Add($source); - -# Save package - Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip - -# Offer the user to download the package - Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip" - -``` - -## Related Topics - - * [Export-Package](/appendix/commands/Export-Package.md) * [Get-Package](/appendix/commands/Get-Package.md) * Import-Package * [Install-UpdatePackage](/appendix/commands/Install-UpdatePackage.md) * [New-ExplicitItemSource](/appendix/commands/New-ExplicitItemSource.md) * [New-FileSource](/appendix/commands/New-FileSource.md) * [New-ItemSource](/appendix/commands/New-ItemSource.md) * [New-Package](/appendix/commands/New-Package.md) * 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
diff --git a/appendix/commands/New-ExplicitItemSource.md b/appendix/commands/New-ExplicitItemSource.md deleted file mode 100644 index 1f139c75..00000000 --- a/appendix/commands/New-ExplicitItemSource.md +++ /dev/null @@ -1,247 +0,0 @@ -# New-ExplicitItemSource - -Creates new Explicit Item Source that can be added to a Sitecore package. - -## Syntax - -New-ExplicitItemSource [-Item <Item>] [-Name] <String> [[-SkipVersions]] [-InstallMode <Undefined | Overwrite | Merge | Skip | SideBySide>] [-MergeMode <Undefined | Clear | Append | Merge>] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Item  <Item> - -The item to be added to the source. If used in pipeline after e.g. Get-Item the source is created once all items are piped into it. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Name  <String> - -Name of the item source. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -SkipVersions  <SwitchParameter> - -Add this parameter if you want to skip versions of the item from being included in the source and only include the version provided. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?2
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -InstallMode  <InstallMode> - -Specifies what installer should do if the item already exists. Possible values: - - Undefined - User will have to choose one of the below. But they probably don't really know what should be done so not a preferable option. - - Overwrite - All versions of the old item are removed and replaced with all versions of the new item. This option basically replaces the old item with new one. - - Merge - merge with existing item. How the item will be merged is defined with MergeMode parameter -- Skip - All versions remains unchanged. Other languages remains unchanged. All children remains unchanged. - - SideBySide - all new item will be created. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -MergeMode  <MergeMode> - -Specifies what installer should do if the item already exists and InstallMode is specified as Merge. Possible values: - - Undefined - User will have to choose one of the below. But they probably don't really know what should be done so not a preferable option. - - Clear - All versions of the old item are removed and replaced with all versions of the new item. This option basically replaces the old item with new one. Other language versions (those which are not in the package) are removed but only for items which are in the package. All child items which are not in the package keep other language versions. All child items which are in the package are changed. - - Append - All versions of the new item are added on top of versions of the previous item. This option allows for further manual merge because all history is preserved, so user can see what was changed. Other languages remains unchanged. All child items which are not in the package keep other language versions. All child items which are in the package are changed. - - Merge - All versions with the same number in both packages are replaced with versions from installed package. All versions which are in the package but not in the target are added. All versions which are not in the package but are in the target remains unchanged. This option also preserves history, however it might overwrite some of the changes. Other languages remains unchanged. All child items which are in the package are changed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Install.Items.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. - -```powershell - -# Create package - $package = new-package "Sitecore PowerShell Extensions"; - -# Set package metadata - $package.Sources.Clear(); - - $package.Metadata.Author = "Adam Najmanowicz - Cognifide, Michael West"; - $package.Metadata.Publisher = "Cognifide Limited"; - $package.Metadata.Version = "2.7"; - $package.Metadata.Readme = 'This text will be visible to people installing your package' - -# Add content/home and all of its children to the package -$source = Get-Item 'master:\content\home' | New-ExplicitItemSource -Name 'Home Page' -InstallMode Overwrite -$package.Sources.Add($source); - -# Save package - Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip - -# Offer the user to download the package - Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip" - -``` - -## Related Topics - - * [Export-Package](/appendix/commands/Export-Package.md) * [Get-Package](/appendix/commands/Get-Package.md) * Import-Package * [Install-UpdatePackage](/appendix/commands/Install-UpdatePackage.md) * [New-ExplicitFileSource](/appendix/commands/New-ExplicitFileSource.md) * [New-FileSource](/appendix/commands/New-FileSource.md) * [New-ItemSource](/appendix/commands/New-ItemSource.md) * [New-Package](/appendix/commands/New-Package.md) * 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
diff --git a/appendix/commands/New-FileSource.md b/appendix/commands/New-FileSource.md deleted file mode 100644 index 5457ae14..00000000 --- a/appendix/commands/New-FileSource.md +++ /dev/null @@ -1,232 +0,0 @@ -# New-FileSource - -Creates new File source that can be added to a Sitecore package. - -## Syntax - -New-FileSource [-Name] <String> [-Root] <DirectoryInfo> [[-IncludeFilter] <String>] [[-ExcludeFilter] <String>] [-InstallMode <String>] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Name  <String> - -Name of the file source. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Root  <DirectoryInfo> - -Root folder to include in the package - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?2
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -IncludeFilter  <String> - -Filter that defines which files will be included. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?3
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -ExcludeFilter  <String> - -Filter that defines which files will NOT be included. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?4
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -InstallMode  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Install.Files.FileSource - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - -Following example creates a new package, adds content of the Console folder under the site folder -saves it in the Sitecore Package folder + gives you an option to download the saved package. - -```powershell - -# Create package - $package = new-package "Sitecore PowerShell Extensions"; - -# Set package metadata - $package.Sources.Clear(); - - $package.Metadata.Author = "Adam Najmanowicz - Cognifide, Michael West"; - $package.Metadata.Publisher = "Cognifide Limited"; - $package.Metadata.Version = "2.7"; - $package.Metadata.Readme = 'This text will be visible to people installing your package' - -# Add content of the Console folder in the site folder to the package - $source = New-FileSource -Name "Console Assets" -Root "$AppPath\Console" - $package.Sources.Add($source); - -# Save package - Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip - -# Offer the user to download the package - Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip" - -``` - -## Related Topics - - * [Export-Package](/appendix/commands/Export-Package.md) * [Get-Package](/appendix/commands/Get-Package.md) * Import-Package * [Install-UpdatePackage](/appendix/commands/Install-UpdatePackage.md) * [New-ExplicitFileSource](/appendix/commands/New-ExplicitFileSource.md) * [New-ExplicitItemSource](/appendix/commands/New-ExplicitItemSource.md) * [New-ItemSource](/appendix/commands/New-ItemSource.md) * [New-Package](/appendix/commands/New-Package.md) * 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
diff --git a/appendix/commands/New-ItemAcl.md b/appendix/commands/New-ItemAcl.md deleted file mode 100644 index ef77f3eb..00000000 --- a/appendix/commands/New-ItemAcl.md +++ /dev/null @@ -1,260 +0,0 @@ -# New-ItemAcl - -Creates a new access rule for use with Set-ItemAcl and Add-ItemAcl cmdlets. - -## Syntax - -New-ItemAcl [-Identity] <AccountIdentity> [-AccessRight] <String> [-PropagationType] <Unknown | Descendants | Entity | Any> [-SecurityPermission] <NotSet | AllowAccess | DenyAccess | AllowInheritance | DenyInheritance> - - -## Detailed Description - -Creates a new access rule for use with Set-ItemAcl and Add-ItemAcl cmdlets. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <AccountIdentity> - -User name including domain for which the access rule is being created. If no domain is specified - 'sitecore' will be used as the default domain. - -Specifies the Sitecore user by providing one of the following values. - - Local Name - Example: adam - Fully Qualified Name - Example: sitecore\adam - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -AccessRight  <String> - -The access right to grand or deny. -Well known rights are: -- field:read - "Field Read" - controls whether an account can read a specific field on an item.. -- field:write - "Field Write" - controls whether an account can update a specific field on an item. - -- item:read - "Read" - controls whether an account can see an item in the content tree and/or on the published Web site, including all of its properties and field values. -- item:write - "Write" - controls whether an account can update field values. The write access right requires the read access right and field read and field write access rights for individual fields (field read and field write are allowed by default). -- item:rename - "Rename" - controls whether an account can change the name of an item. The rename access right requires the read access right. -- item:create - "Create" - controls whether an account can create child items. The create access right requires the read access right. -- item:delete - "Delete" - Delete right for items. controls whether an account can delete an item. The delete access right requires the read access right - Important! -The Delete command also deletes all child items, even if the account has been denied Delete -rights for one or more of the subitems. -- item:admin - "Administer" - controls whether an account can configure access rights on an item. The administer access right requires the read and write access rights. -- language:read - "Language Read" - controls whether a user can read a specific language version of items. -- language:write - "Language Write" - controls whether a user can update a specific language version of items. -- site:enter - controls whether a user can access a specific site. -- insert:show - "Show in Insert" - Determines if the user can see the insert option -- workflowState:delete - "Workflow State Delete" - controls whether a user can delete items which are currently associated with a specific workflow state. -- workflowState:write - "Workflow State Write" - controls whether a user can update items which are currently associated with a specific workflow state. -- workflowCommand:execute - "Workflow Command Execute" - — controls whether a user is shown specific workflow commands. -- profile:customize - "Customize Profile Key Values" - The right to input out of range values of profile keys, that belong to this profile. -- bucket:makebucket - "Create Bucket" - convert item to bucket. -- bucket:unmake - "Revert Bucket" - convert item back from bucket. -- remote:fieldread - "Field Remote Read" - Field Read right for remoted clients. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?2
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -PropagationType  <PropagationType> - -The PropagationType enumeration determines which items will be granted the access right. - - Any - the item and all items inheriting - - Descendants - applies rights to inheriting children only - - Entity - applies right to the item only - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?3
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -SecurityPermission  <SecurityPermission> - -The SecurityPermission determines whether to grant (allow) or deny the access right, and deny or allow inheritance of the right. - - AllowAccess - - - DenyAccess - - - AllowInheritance - - - DenyInheritance - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?4
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Security.AccessControl.AccessRule - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Creates an access rule that allows the "sitecore\adam" user to delete the item to which it will be applied and all of its childre - -```powershell - -PS master:\> New-ItemAcl -AccessRight item:delete -PropagationType Any -SecurityPermission AllowAccess -Identity "sitecore\adam" - -Account AccessRight PermissionType PropagationType SecurityPermission -------- ----------- -------------- --------------- ------------------ -sitecore\admin item:delete Access Any AllowAccess - -``` - -### EXAMPLE 2 - -Allows the "sitecore\adam" user to delete the Home item and all of its children. -Denies the "sitecore\mikey" user reading the descendants of the Home item. ;P -The security info is created prior to adding it to the item. -The item is delivered to the Add-ItemAcl from the pipeline and returned to the pipeline after processing due to the -PassThru parameter. -The security information is added to the previously existing security qualifiers. - -```powershell - -$acl1 = New-ItemAcl -AccessRight item:delete -PropagationType Any -SecurityPermission AllowAccess -Identity "sitecore\adam" -$acl2 = New-ItemAcl -AccessRight item:read -PropagationType Descendants -SecurityPermission DenyAccess -Identity "sitecore\mikey" -Get-Item -Path master:\content\home | Add-ItemAcl -AccessRules $acl1, $acl2 -PassThru - -Name Children Languages Id TemplateName ----- -------- --------- -- ------------ -Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item - -``` - -### EXAMPLE 3 - -Allows the "sitecore\adam" user to delete the Home item and all of its children. -Denies the "sitecore\mikey" user reading the descendants of the Home item. ;P -The security info is created prior to setting it to the item. -The item is delivered to the Set-ItemAcl from the pipeline and returned to the pipeline after processing due to the -PassThru parameter. -Any previuous security information on the item is removed. - -```powershell - -$acl1 = New-ItemAcl -AccessRight item:delete -PropagationType Any -SecurityPermission AllowAccess -Identity "sitecore\adam" -$acl2 = New-ItemAcl -AccessRight item:read -PropagationType Descendants -SecurityPermission DenyAccess -Identity "sitecore\mikey" -Get-Item -Path master:\content\home | Set-ItemAcl -AccessRules $acl1, $acl2 -PassThru - -Name Children Languages Id TemplateName ----- -------- --------- -- ------------ -Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Add-ItemAcl](/appendix/commands/Add-ItemAcl.md) * [Clear-ItemAcl](/appendix/commands/Clear-ItemAcl.md) * [Get-ItemAcl](/appendix/commands/Get-ItemAcl.md) * [Set-ItemAcl](/appendix/commands/Set-ItemAcl.md) * [Test-ItemAcl](/appendix/commands/Test-ItemAcl.md) * 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/
diff --git a/appendix/commands/New-ItemClone.md b/appendix/commands/New-ItemClone.md deleted file mode 100644 index d01b6b7a..00000000 --- a/appendix/commands/New-ItemClone.md +++ /dev/null @@ -1,291 +0,0 @@ -# New-ItemClone - -Creates a new item clone based on the item provided. - -## Syntax - -New-ItemClone [-Item] <Item> -Destination <Item> [-Name <String>] [-Recurse] - -New-ItemClone [-Path] <String> -Destination <Item> [-Name <String>] [-Recurse] - -New-ItemClone -Id <String> [-Database <String>] -Destination <Item> [-Name <String>] [-Recurse] - - -## Detailed Description - -Creates a new item clone based on the item provided. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Destination  <Item> - -Parent item under which the clone should be created. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Name  <String> - -Name of the item clone. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Recurse  <SwitchParameter> - -Add the parameter to clone thw whole branch rather than a single item. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be cloned. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be cloned. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be cloned - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database of the item to be cloned if item is specified through its ID. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - -Clone /sitecore/content/home/ under /sitecore/content/new-target/ with the "New Home" name. - -```powershell - -PS master:\> $newTarget = Get-Item master:\content\new-target\ -PS master:\> New-ItemClone -Path master:\content\home -Destination $newTarget -Name "New Home" - -``` - -## Related Topics - - * [Get-ItemClone](/appendix/commands/Get-ItemClone.md) * [ConvertFrom-ItemClone](/appendix/commands/ConvertFrom-ItemClone.md) * New-Item * https://github.com/SitecorePowerShell/Console/
* https://github.com/SitecorePowerShell/Console/issues/218
diff --git a/appendix/commands/New-ItemSource.md b/appendix/commands/New-ItemSource.md deleted file mode 100644 index 5dba9ffe..00000000 --- a/appendix/commands/New-ItemSource.md +++ /dev/null @@ -1,315 +0,0 @@ -# New-ItemSource - -Creates new Item source that can be added to a Sitecore package. - -## Syntax - -New-ItemSource [-Item <Item>] [-Name] <String> [[-SkipVersions]] [[-Database] <String>] [[-Root] <String>] [-InstallMode <Undefined | Overwrite | Merge | Skip | SideBySide>] [-MergeMode <Undefined | Clear | Append | Merge>] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Item  <Item> - -The item to be added as the root of the source. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Name  <String> - -Name of the item source. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -SkipVersions  <SwitchParameter> - -Add this parameter if you want to skip versions of the item from being included in the source and only include the version provided. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?2
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be added - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?3
Default Value
Accept Pipeline Input?true (ByPropertyName)
Accept Wildcard Characters?false
- -### -Root  <String> - -You can provide the Root as sitecore native path instead of specifying it through. Do not include Item in such case as Item will take priority over Root. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?4
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -InstallMode  <InstallMode> - -Specifies what installer should do if the item already exists. Possible values: - - Undefined - User will have to choose one of the below. But they probably don't really know what should be done so not a preferable option. - - Overwrite - All versions of the old item are removed and replaced with all versions of the new item. This option basically replaces the old item with new one. - - Merge - merge with existing item. How the item will be merged is defined with MergeMode parameter -- Skip - All versions remains unchanged. Other languages remains unchanged. All children remains unchanged. - - SideBySide - all new item will be created. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -MergeMode  <MergeMode> - -Specifies what installer should do if the item already exists and InstallMode is specified as Merge. Possible values: - - Undefined - User will have to choose one of the below. But they probably don't really know what should be done so not a preferable option. - - Clear - All versions of the old item are removed and replaced with all versions of the new item. This option basically replaces the old item with new one. Other language versions (those which are not in the package) are removed but only for items which are in the package. All child items which are not in the package keep other language versions. All child items which are in the package are changed. - - Append - All versions of the new item are added on top of versions of the previous item. This option allows for further manual merge because all history is preserved, so user can see what was changed. Other languages remains unchanged. All child items which are not in the package keep other language versions. All child items which are in the package are changed. - - Merge - All versions with the same number in both packages are replaced with versions from installed package. All versions which are in the package but not in the target are added. All versions which are not in the package but are in the target remains unchanged. This option also preserves history, however it might overwrite some of the changes. Other languages remains unchanged. All child items which are in the package are changed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Install.Items.ItemSource - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - -Following example creates a new package, adds content/home item to it and -saves it in the Sitecore Package folder+ gives you an option to download the saved package. - -```powershell - -# Create package - $package = new-package "Sitecore PowerShell Extensions"; - -# Set package metadata - $package.Sources.Clear(); - - $package.Metadata.Author = "Adam Najmanowicz - Cognifide, Michael West"; - $package.Metadata.Publisher = "Cognifide Limited"; - $package.Metadata.Version = "2.7"; - $package.Metadata.Readme = 'This text will be visible to people installing your package' - -# Add contnet/home to the package -$source = Get-Item 'master:\content\home' | New-ItemSource -Name 'Home Page' -InstallMode Overwrite -$package.Sources.Add($source); - -# Save package - Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip - -# Offer the user to download the package - Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip" - -``` - -## Related Topics - - * [Export-Package](/appendix/commands/Export-Package.md) * [Get-Package](/appendix/commands/Get-Package.md) * Import-Package * [Install-UpdatePackage](/appendix/commands/Install-UpdatePackage.md) * [New-ExplicitFileSource](/appendix/commands/New-ExplicitFileSource.md) * [New-ExplicitItemSource](/appendix/commands/New-ExplicitItemSource.md) * [New-FileSource](/appendix/commands/New-FileSource.md) * [New-Package](/appendix/commands/New-Package.md) * 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
diff --git a/appendix/commands/New-ItemWorkflowEvent.md b/appendix/commands/New-ItemWorkflowEvent.md deleted file mode 100644 index be178120..00000000 --- a/appendix/commands/New-ItemWorkflowEvent.md +++ /dev/null @@ -1,318 +0,0 @@ -# New-ItemWorkflowEvent - -Creates new entry in the history store notifying of workflow state change. - -## Syntax - -New-ItemWorkflowEvent [-Item] <Item> [-OldState <String>] [-NewState <String>] [-Text <String>] [-Language <String[]>] - -New-ItemWorkflowEvent [-Path] <String> [-OldState <String>] [-NewState <String>] [-Text <String>] [-Language <String[]>] - -New-ItemWorkflowEvent -Id <String> [-Database <String>] [-OldState <String>] [-NewState <String>] [-Text <String>] [-Language <String[]>] - - -## Detailed Description - -Creates new entry in the history store notifying of workflow state change. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -OldState  <String> - -Id of the old state. If not provided - current item workflow state will be used. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -NewState  <String> - -Id of the old state. If not provided - current item workflow state will be used. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Text  <String> - -Action comment. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - -Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to have the history event attached. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to have the history event attached - additionally specify Language parameter to fetch different item language than the current user language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the the item to have the history event attached - additionally specify Language parameter to fetch different item language than the current user language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to have the history event attached - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> New-ItemWorkflowEvent -Path master:\content\home -lanuage "en" -Text "Just leaving a note" - -``` - -## Related Topics - - * [Get-ItemWorkflowEvent](/appendix/commands/Get-ItemWorkflowEvent.md) * Execute-Workflow * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/New-Package.md b/appendix/commands/New-Package.md deleted file mode 100644 index 2a7efce0..00000000 --- a/appendix/commands/New-Package.md +++ /dev/null @@ -1,96 +0,0 @@ -# New-Package - -Creates a new Sitecore install package object. - -## Syntax - -New-Package [-Name] <String> - - -## Detailed Description - -Creates a new Sitecore install package object that allows for further addition of items and files & further export to file. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Name  <String> - -Package name - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Install.PackageProject - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - -Following example creates a new package, adds content/home item to it and -saves it in the Sitecore Package folder+ gives you an option to download the saved package. - -```powershell - -# Create package - $package = new-package "Sitecore PowerShell Extensions"; - -# Set package metadata - $package.Sources.Clear(); - - $package.Metadata.Author = "Adam Najmanowicz - Cognifide, Michael West"; - $package.Metadata.Publisher = "Cognifide Limited"; - $package.Metadata.Version = "2.7"; - $package.Metadata.Readme = 'This text will be visible to people installing your package' - -# Add contnet/home to the package -$source = Get-Item 'master:\content\home' | New-ItemSource -Name 'Home Page' -InstallMode Overwrite -$package.Sources.Add($source); - -# Save package - Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip - -# Offer the user to download the package - Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip" - -``` - -## Related Topics - - * [Export-Package](/appendix/commands/Export-Package.md) * [Get-Package](/appendix/commands/Get-Package.md) * Import-Package * [New-ExplicitFileSource](/appendix/commands/New-ExplicitFileSource.md) * [New-ExplicitItemSource](/appendix/commands/New-ExplicitItemSource.md) * [New-FileSource](/appendix/commands/New-FileSource.md) * [New-ItemSource](/appendix/commands/New-ItemSource.md) * [Install-UpdatePackage](/appendix/commands/Install-UpdatePackage.md) * 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
diff --git a/appendix/commands/New-Rendering.md b/appendix/commands/New-Rendering.md deleted file mode 100644 index 27da727c..00000000 --- a/appendix/commands/New-Rendering.md +++ /dev/null @@ -1,566 +0,0 @@ -# New-Rendering - -Creates new rendering definition that can later be added to an item. - -## Syntax - -New-Rendering [-Item] <Item> [-Parameter <Hashtable>] [-PlaceHolder <String>] [-DataSource <Item>] [-Cacheable] [-VaryByData] [-VaryByDevice] [-VaryByLogin] [-VaryByParameters] [-VaryByQueryString] [-VaryByUser] [-Language <String[]>] - -New-Rendering [-Path] <String> [-Parameter <Hashtable>] [-PlaceHolder <String>] [-DataSource <Item>] [-Cacheable] [-VaryByData] [-VaryByDevice] [-VaryByLogin] [-VaryByParameters] [-VaryByQueryString] [-VaryByUser] [-Language <String[]>] - -New-Rendering -Id <String> [-Database <String>] [-Parameter <Hashtable>] [-PlaceHolder <String>] [-DataSource <Item>] [-Cacheable] [-VaryByData] [-VaryByDevice] [-VaryByLogin] [-VaryByParameters] [-VaryByQueryString] [-VaryByUser] [-Language <String[]>] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Parameter  <Hashtable> - -Rendering parameters as hashtable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -PlaceHolder  <String> - -Placeholder for the rendering to be placed into. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -DataSource  <Item> - -Datasource for the rendering. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Cacheable  <SwitchParameter> - -Defined whether the rendering is cacheable. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -VaryByData  <SwitchParameter> - -Defines whether a data-specific cache version of the rendering should be kept. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -VaryByDevice  <SwitchParameter> - -Defines whether a device-specific cache version of the rendering should be kept. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -VaryByLogin  <SwitchParameter> - -Defines whether a login - specific cache version of the rendering should be kept. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -VaryByParameters  <SwitchParameter> - -Defines whether paremeter - specific cache version of the rendering should be kept. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -VaryByQueryString  <SwitchParameter> - -Defines whether query string - specific cache version of the rendering should be kept. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -VaryByUser  <SwitchParameter> - -Defines whether a user - specific cache version of the rendering should be kept. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Layouts.RenderingDefinitio - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - -find item defining rendering and create rendering definitio - -```powershell - -PS master:\> $renderingItem = gi master:\layout\Sublayouts\ZenGarden\Basic\Content | New-Rendering -Placeholder "main" -# find item you want the rendering added to -PS master:\> $item = gi master:\content\Demo\Int\Home -# Add the rendering to the item -PS master:\> Add-Rendering -Item $item -PlaceHolder "main" -Rendering $renderingItem -Parameter @{ FieldName = "Content" } - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Add-Rendering](/appendix/commands/Add-Rendering.md) * [Set-Rendering](/appendix/commands/Set-Rendering.md) * [Get-Rendering](/appendix/commands/Get-Rendering.md) * [Get-LayoutDevice](/appendix/commands/Get-LayoutDevice.md) * [Remove-Rendering](/appendix/commands/Remove-Rendering.md) * [Get-Layout](/appendix/commands/Get-Layout.md) * [Set-Layout](/appendix/commands/Set-Layout.md) diff --git a/appendix/commands/New-Role.md b/appendix/commands/New-Role.md deleted file mode 100644 index 05f4f4cf..00000000 --- a/appendix/commands/New-Role.md +++ /dev/null @@ -1,82 +0,0 @@ -# New-Role - -Creates a new Sitecore role. - -## Syntax - -New-Role [-Identity] <AccountIdentity> - - -## Detailed Description - -The New-Role command creates a new Sitecore role. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <AccountIdentity> - -Role name including domain. If no domain is specified - 'sitecore' will be used as the default value - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByPropertyName)
Accept Wildcard Characters?false
- -## 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. - -* Sitecore.Security.Accounts.Role - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> New-Role -Identity Michael - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/New-SecuritySource.md b/appendix/commands/New-SecuritySource.md deleted file mode 100644 index 2544ab3e..00000000 --- a/appendix/commands/New-SecuritySource.md +++ /dev/null @@ -1,296 +0,0 @@ -# New-SecuritySource - -Creates new User & Role source that can be added to a Sitecore package. - -## Syntax - -New-SecuritySource [-Account] <Account> [-Name] <String> - -New-SecuritySource [-Identity] <AccountIdentity> [[-AccountType] <Unknown | Role | User>] [-Name] <String> - -New-SecuritySource [-Filter] <String[]> [[-AccountType] <Unknown | Role | User>] [-Name] <String> - - -## Detailed Description - -Creates new User & Role source that can be added to a Sitecore package. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Account  <Account> - -User or Role provided from e.g. Get-Role or Get-User Cmdlet. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?2
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Identity  <AccountIdentity> - -User or role name including domain for which the access rule is being created. If no domain is specified - 'sitecore' will be used as the default domain. - -Specifies the Sitecore user by providing one of the following values. - - Local Name - Example: adam - Fully Qualified Name - Example: sitecore\adam - -if -AccountType parameter is specified as Role - only roles will be taken into consideration. -if -AccountType parameter is specified as User - only users will be taken into consideration. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?2
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Filter  <String[]> - -Specifies a simple pattern to match Sitecore roles & users. - -Examples: -The following examples show how to use the filter syntax. - -To get security for all roles, use the asterisk wildcard: -Get-ItemAcl -Filter * - -To security got all roles in a domain use the following command: -Get-ItemAcl -Filter "sitecore\*" - -if -AccountType parameter is specified as Role - only roles will be taken into consideration. -if -AccountType parameter is specified as User - only users will be taken into consideration. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?2
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -AccountType  <AccountType> - -- Unknown - Both Roles and users will be taken into consideration when looking for accounts through either -Identity or -Filter parameters -- Role - Only Roles will be taken into consideration when looking for accounts through either -Identity or -Filter parameters -- User - Only Users will be taken into consideration when looking for accounts through either -Identity or -Filter parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?3
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Name  <String> - -Name of the security source. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Security.Accounts.Account - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Install.Security.SecuritySource - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Following example creates a new package, adds sitecore\admin user to it and -saves it in the Sitecore Package folder+ gives you an option to download the saved package. - -```powershell - -# Create package - $package = new-package "Sitecore PowerShell Extensions"; - -# Set package metadata - $package.Sources.Clear(); - - $package.Metadata.Author = "Adam Najmanowicz - Cognifide, Michael West"; - $package.Metadata.Publisher = "Cognifide Limited"; - $package.Metadata.Version = "2.7"; - $package.Metadata.Readme = 'This text will be visible to people installing your package' - - # Create security source with Sitecore Administrator only - $source = New-SecuritySource -Identity sitecore\admin -Name "Sitecore Admin" -$package.Sources.Add($source); - -# Save package - Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip - -# Offer the user to download the package - Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip" - -``` - -### EXAMPLE 2 - -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. - -```powershell - -# Create package - $package = new-package "Sitecore PowerShell Extensions"; - -# Set package metadata - $package.Sources.Clear(); - - $package.Metadata.Author = "Adam Najmanowicz - Cognifide, Michael West"; - $package.Metadata.Publisher = "Cognifide Limited"; - $package.Metadata.Version = "2.7"; - $package.Metadata.Readme = 'This text will be visible to people installing your package' - - # Create security source with all roles within the sitecore domain - $source = New-SecuritySource -Filter sitecore\* -Name "Sitecore Roles" -AccountType Role -$package.Sources.Add($source); - -# Save package - Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip - -# Offer the user to download the package - Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip" - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/New-User.md b/appendix/commands/New-User.md deleted file mode 100644 index dc6026fb..00000000 --- a/appendix/commands/New-User.md +++ /dev/null @@ -1,352 +0,0 @@ -# New-User - -Creates a new Sitecore user. - -## Syntax - -New-User [-Identity] <AccountIdentity> [-Password <String>] [-Email <String>] [-FullName <String>] [-Comment <String>] [-Portrait <String>] [-Enabled] [-ProfileItemId <ID>] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <AccountIdentity> - -Specifies the Sitecore user by providing one of the following values. - - Local Name - Example: developer - Fully Qualified Name - Example: sitecore\developer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByPropertyName)
Accept Wildcard Characters?false
- -### -Password  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?true (ByPropertyName)
Accept Wildcard Characters?false
- -### -Email  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?true (ByPropertyName)
Accept Wildcard Characters?false
- -### -FullName  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?true (ByPropertyName)
Accept Wildcard Characters?false
- -### -Comment  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?true (ByPropertyName)
Accept Wildcard Characters?false
- -### -Portrait  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?true (ByPropertyName)
Accept Wildcard Characters?false
- -### -Enabled  <SwitchParameter> - -Specifies that the account should be enabled. When enabled, the Password parameter is required. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?true (ByPropertyName)
Accept Wildcard Characters?false
- -### -ProfileItemId  <ID> - -Specifies the profile id to use for the user. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?true (ByPropertyName)
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* System.String -Represents the identity of a role. - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* None. - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - - - -```powershell - -PS master:\> New-User -Identity michael - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\> New-User -Identity michael -Enabled -Password b -Email michaellwest@gmail.com -FullName "Michael West" - -``` - -### EXAMPLE 3 - - - -```powershell - -PS master:\> New-User -Identity michael -PassThru - -Name Domain IsAdministrator IsAuthenticated ----- ------ --------------- --------------- -sitecore\michael2 sitecore False False - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Get-User](/appendix/commands/Get-User.md) * [Set-User](/appendix/commands/Set-User.md) * [Remove-User](/appendix/commands/Remove-User.md) * [Unlock-User](/appendix/commands/Unlock-User.md) diff --git a/appendix/commands/New-UsingBlock.md b/appendix/commands/New-UsingBlock.md deleted file mode 100644 index 3f1d1631..00000000 --- a/appendix/commands/New-UsingBlock.md +++ /dev/null @@ -1,146 +0,0 @@ -# New-UsingBlock - -New-UsingBlock. - -## Syntax - -New-UsingBlock [-InputObject] <IDisposable> [-ScriptBlock] <ScriptBlock> - - -## Detailed Description - -New-UsingBlock. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -InputObject  <IDisposable> - -Object that should be disposed after the Script block is executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -ScriptBlock  <ScriptBlock> - -Script to be executed within the "Using" context. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?2
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* System.IDisposable - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* void - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Assuming all items under /sitecore/content/home have both 'Title' and 'MetaTitle' fields... -Using New-UsingBlock to bulk update items under /sitecore/Content/ -to have their 'MetaTitle' field to be equal to the 'Title' field - -```powershell - -New-UsingBlock (New-Object Sitecore.Data.BulkUpdateContext) { -foreach ( $item in (Get-ChildItem -Path master:\Content\Home -Recurse -WithParent) ) { - $item."MetaTitle" = $item.Title - } -} - -``` - -### EXAMPLE 2 - -Using New-UsingBlock to perform a test with UserSwitcher - checking whether an anonymous user can change a field -The test should end up showing the error as below and the Title should not be changed! - -```powershell - -$anonymous = Get-User -Identity "extranet\Anonymous" -$testItem = Get-Item -Path master:\Content\Home - -New-UsingBlock (New-Object Sitecore.Security.Accounts.UserSwitcher $anonymous) { - $testItem.Title = "If you can see this title it means that anonymous users can change this item!" -} - - -New-UsingBlock : Exception setting "Title": "Exception calling "Modify" with "3" argument(s): "The current user does not have write access to this item. User: extranet\Anonymous, Item: Home ({110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9})"" -At line:3 char:1 -+ New-UsingBlock (New-Object Sitecore.Security.Accounts.UserSwitcher $a ... -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - + CategoryInfo : NotSpecified: (:) [New-UsingBlock], SetValueInvocationException - + FullyQualifiedErrorId : ScriptSetValueRuntimeException,Cognifide.PowerShell.Commandlets.Data.NewUsingBlockCommand - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Out-Download.md b/appendix/commands/Out-Download.md deleted file mode 100644 index a7b2a59d..00000000 --- a/appendix/commands/Out-Download.md +++ /dev/null @@ -1,192 +0,0 @@ -# Out-Download - -Send an object content to the client - -## Syntax - -Out-Download -InputObject <Object> [-ContentType <String>] [-Name <String>] - - -## Detailed Description - -The cmdlet allows to send content of an object (FileInfo, Stream, String, String[] or Byte[]) to the client. This is used for example by report scripts to send the report in HTML, Json or Excel without saving the content of the object to the disk drive. -You can specify an object type and file name to make sure the downloaded file is interpreted properly by the browser. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -InputObject  <Object> - -Object content to be sent to the client. Object must be of one of the following types: -- FileInfo, -- Stream, -- String, -- String[], -- Byte[] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -ContentType  <String> - -The MIME content type of the object. In most cases you can skip this parameter and still have the content type be deduced by the browser from the - -Common examples (after Wikipedia) -- application/json -- application/x-www-form-urlencoded -- application/pdf -- application/octet-stream -- multipart/form-data -- text/html -- image/png -- image/jpg - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Name  <String> - -Name of the file you want the user browser to save the object as. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?true (ByPropertyName)
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* System.Object - -## 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 - -Send first log file to the user - -```powershell - -Get-Item "$SitecoreLogFolder\*.*" | select -first 1 | Out-Download - -``` - -### EXAMPLE 2 - -Send Hello World text file to the user - -```powershell - -"Hello World!" | Out-Download -Name hello-world.txt - -``` - -### EXAMPLE 3 - -Get a list of sitecore branches under root item in the master database and send the list to user as excel file - -```powershell - -Import-Function -Name ConvertTo-Xlsx - -[byte[]]$outobject = Get-ChildItem master:\ | - Select-Object -Property Name, ProviderPath, Language, Varsion | - ConvertTo-Xlsx - -Out-Download -Name "report-$datetime.xlsx" -InputObject $outobject - -``` - -## Related Topics - - * [Send-File](/appendix/commands/Send-File.md) * [Receive-File](/appendix/commands/Receive-File.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Protect-Item.md b/appendix/commands/Protect-Item.md deleted file mode 100644 index 93eccc50..00000000 --- a/appendix/commands/Protect-Item.md +++ /dev/null @@ -1,236 +0,0 @@ -# Protect-Item - -Protects the Sitecore item. - -## Syntax - -Protect-Item [-Item] <Item> [-PassThru] - -Protect-Item [-Path] <String> [-PassThru] - -Protect-Item -Id <String> [-Database <String>] [-PassThru] - - -## Detailed Description - -The Protect-Item command protects the item by making it read-only. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -PassThru  <SwitchParameter> - -Passes the processed item back into the pipeline. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be processed - can work with Language parameter to specify the language other than current session language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be fetched with Id parameter. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* can be piped from another cmdlet* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Only if -PassThru is used* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - - - -```powershell - -PS master:\> Protect-Item -Path master:\content\home - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\> Get-Item -Path master:\content\home | Protect-Item -PassThru - -Name Children Languages Id TemplateName ----- -------- --------- -- ------------ -Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Unprotect-Item](/appendix/commands/Unprotect-Item.md) * Get-Item diff --git a/appendix/commands/Publish-Item.md b/appendix/commands/Publish-Item.md deleted file mode 100644 index 3c30083f..00000000 --- a/appendix/commands/Publish-Item.md +++ /dev/null @@ -1,519 +0,0 @@ -# Publish-Item - -Publishes a Sitecore item. - -## Syntax - -Publish-Item [-Item] <Item> [-Recurse] [-Target <String[]>] [-PublishMode <Unknown | Full | Incremental | SingleItem | Smart>] [-PublishRelatedItems] [-RepublishAll] [-CompareRevisions] [-FromDate <DateTime>] [-AsJob] [-Language <String[]>] - -Publish-Item [-Path] <String> [-Recurse] [-Target <String[]>] [-PublishMode <Unknown | Full | Incremental | SingleItem | Smart>] [-PublishRelatedItems] [-RepublishAll] [-CompareRevisions] [-FromDate <DateTime>] [-AsJob] [-Language <String[]>] - -Publish-Item -Id <String> [-Database <String>] [-Recurse] [-Target <String[]>] [-PublishMode <Unknown | Full | Incremental | SingleItem | Smart>] [-PublishRelatedItems] [-RepublishAll] [-CompareRevisions] [-FromDate <DateTime>] [-AsJob] [-Language <String[]>] - - -## Detailed Description - -The Publish-Item command publishes the Sitecore item and optionally subitems. Allowing for granular control over languages and modes of publishing. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Recurse  <SwitchParameter> - -Specifies that subitems should also get published with the root item. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Target  <String[]> - -Specifies the publishing targets. The default target database is "web". - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -PublishMode  <PublishMode> - -Specified the Publish mode. Valid values are: -- Full -- Incremental -- SingleItem -- Smart - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -PublishRelatedItems  <SwitchParameter> - -Turns publishing of related items on. Works only on Sitecore 7.2 or newer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -RepublishAll  <SwitchParameter> - -Republishes all items provided to the publishing job. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -CompareRevisions  <SwitchParameter> - -Turns revision comparison on. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -FromDate  <DateTime> - -Publishes items newer than the date provided only. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -AsJob  <SwitchParameter> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - -Language of the item that should be published. Supports globbing/wildcards. -Allows for more than one language to be provided at once. e.g. "en*", "pl-pl" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item that should be published - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item that should be published - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* None. - -## Notes - -Help Author: Michael West, Adam Najmanowicz - -## Examples - -### EXAMPLE 1 - - - -```powershell - -PS master:\> Publish-Item -Path master:\content\home -Target Internet - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\> Get-Item -Path master:\content\home | Publish-Item -Recurse -PublishMode Incremental - -``` - -### EXAMPLE 3 - - - -```powershell - -PS master:\> Get-Item -Path master:\content\home | Publish-Item -Recurse -Language "en*" - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Read-Variable.md b/appendix/commands/Read-Variable.md deleted file mode 100644 index 523ad8f7..00000000 --- a/appendix/commands/Read-Variable.md +++ /dev/null @@ -1,431 +0,0 @@ -# Read-Variable - -Prompts user to provide values for variables required by the script to perform its operation. - -## Syntax - -Read-Variable [-Parameters <Object[]>] [-Description <String>] [-CancelButtonName <String>] [-OkButtonName <String>] [-ShowHints] [-Validator <ScriptBlock>] [-Title <String>] [-Width <Int32>] [-Height <Int32>] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Parameters  <Object[]> - -Specifies the variables that value should be provided by the user. Each variable definition can have the following structure: -- Name - the name of the PowerShell variable - without the $ sign -- Value - the initial value of the variable - if the variable have not been created prior to launching the dialog - this will be its value unless the user changes it. if Value is not specified - the existing variable name will be used. -- Title - The title for the variable shown above the variable editor. -- Tooltip - The hint describing the parameter further - if the -ShowHints parameter is provided this value will show between the Variable Title and the variable editor. -- Editor - If the default editor selected does not provide the functionality expected - you can specify this value to customize it (see examples) -- Tab - if this parameter is specified on any Variable the multi-tab dialog will be used instead of a simple one. Provide the tab name on which the variable editor should appear. - -Variable type specific: -- Root - for some Item selecting editors you can provide this to limit the selection to only part of the tree -- Source - for some Item selecting editors you can provide this to parametrize the item selection editor. (Refer to examples for some sample usages) -- Lines - for String variable you can select this parameter if you want to present the user with the multiline editor. The for this parameter is the number of lines that the editor will be configured with. -- Domain - for user and role selectors you can limit the users & roles presented to only the domain - specified) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Description  <String> - -Dialog description displayed below the dialog title. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -CancelButtonName  <String> - -Text shown on the cancel button. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -OkButtonName  <String> - -Text shown on the OK button. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -ShowHints  <SwitchParameter> - -Specifies whether the variable hints should be displayed. Hints are shown below each the variable title but above the variable editing control. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Validator  <ScriptBlock> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Title  <String> - -Dialog title - shown at the top of the dialog. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Width  <Int32> - -Dialog width. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Height  <Int32> - -Dialog width. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -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. - -```powershell - - - -``` - -### 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 - -```powershell - -$item = Get-Item master:\content\home -$result = Read-Variable -Parameters ` - @{ Name = "someText"; Value="Some Text"; Title="Single Line Text"; Tooltip="Tooltip for singleline"; Placeholder="You see this when text box is empty"}, - @{ Name = "multiText"; Value="Multiline Text"; Title="Multi Line Text"; lines=3; Tooltip="Tooltip for multiline"; Placeholder="You will see this when text box is empty"}, - @{ Name = "from"; Value=[System.DateTime]::Now.AddDays(-5); Title="Start Date"; Tooltip="Date since when you want the report to run"; Editor="date time"}, - @{ Name = "user"; Value=$me; Title="Select User"; Tooltip="Tooltip for user"; Editor="user multiple"}, - @{ Name = "item"; Title="Start Item"; Root="/sitecore/content/"} ` - -Description "This Dialog shows less editors, it doesn't need tabs as there is less of the edited variables" ` - -Title "Initialise various variable types (without tabs)" -Width 500 -Height 480 -OkButtonName "Proceed" -CancelButtonName "Abort" - -``` - -### 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 - -```powershell - -$item = Get-Item master:\content\home -$result = Read-Variable -Parameters ` - @{ Name = "silent"; Value=$true; Title="Proceed Silently"; Tooltip="Check this if you don't want to be interrupted"; Tab="Simple"}, - @{ Name = "someText"; Value="Some Text"; Title="Text"; Tooltip="Just a single line of Text"; Tab="Simple"; Placeholder="You see this when text box is empty"}, - @{ Name = "multiText"; Value="Multiline Text"; Title="Longer Text"; lines=3; Tooltip="You can put multi line text here"; Tab="Simple"; Placeholder="You see this when text box is empty"}, - @{ Name = "number"; Value=110; Title="Integer"; Tooltip="I need this number too"; Tab="Simple"}, - @{ Name = "fraction"; Value=1.1; Title="Float"; Tooltip="I'm just a bit over 1"; Tab="Simple"}, - @{ Name = "from"; Value=[System.DateTime]::Now.AddDays(-5); Title="Start Date"; Tooltip="Date since when you want the report to run"; Editor="date time"; Tab="Time"}, - @{ Name = "fromDate"; Value=[System.DateTime]::Now.AddDays(-5); Title="Start Date"; Tooltip="Date since when you want the report to run"; Editor="date"; Tab="Time"}, - @{ 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&IncludeTemplatesForSelection=Template"; - editor="treelist"; Tab="Items"}, - @{ Name = "items2"; Title="Bunch of Templates"; - Source="DataSource=/sitecore/templates&DatabaseName=master&IncludeTemplatesForDisplay=Node,Folder,Template,Template Folder&IncludeTemplatesForSelection=Template"; - editor="multilist"; Tab="More Items"}, - @{ Name = "items3"; Title="Pick One Template"; - Source="DataSource=/sitecore/templates&DatabaseName=master&IncludeTemplatesForDisplay=Node,Folder,Template,Template Folder&IncludeTemplatesForSelection=Template"; - 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="sitecore"; Tab="Rights" } ` - -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 "Abort" -ShowHints -if($result -ne "ok") -{ - Exit -} - -``` - -## Related Topics - - * [Show-Alert](/appendix/commands/Show-Alert.md) * [Show-Application](/appendix/commands/Show-Application.md) * [Show-Confirm](/appendix/commands/Show-Confirm.md) * [Show-FieldEditor](/appendix/commands/Show-FieldEditor.md) * [Show-Input](/appendix/commands/Show-Input.md) * [Show-ListView](/appendix/commands/Show-ListView.md) * [Show-ModalDialog](/appendix/commands/Show-ModalDialog.md) * [Show-YesNoCancel](/appendix/commands/Show-YesNoCancel.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Receive-File.md b/appendix/commands/Receive-File.md deleted file mode 100644 index f578dbb0..00000000 --- a/appendix/commands/Receive-File.md +++ /dev/null @@ -1,540 +0,0 @@ -# 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 <String>] [-ParentItem] <Item> [-Title <String>] [-CancelButtonName <String>] [-OkButtonName <String>] [-Versioned] [-Language <String>] [-Overwrite] [-Unpack] [-Width <Int32>] [-Height <Int32>] - -Receive-File [-Description <String>] [-Path] <String> [-Title <String>] [-CancelButtonName <String>] [-OkButtonName <String>] [-Overwrite] [-Unpack] [-Width <Int32>] [-Height <Int32>] - -Receive-File [-ParentItem] <Item> -AdvancedDialog [-Width <Int32>] [-Height <Int32>] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Description  <String> - -Dialog description displayed below the dialog title. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -ParentItem  <Item> - -The item under which the uploaded media items should be stored. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the folder where uploaded file should be stored. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Title  <String> - -Dialog title - shown at the top of the dialog. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -CancelButtonName  <String> - -Text shown on the cancel button. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -OkButtonName  <String> - -Text shown on the OK button. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Versioned  <SwitchParameter> - -Indicates that the Media item should be created as a Versioned media item. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String> - -Specifies the language in which the media item should be created. if not specified - context language is selected. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Overwrite  <SwitchParameter> - -indicates that the upload should overwrite a file or a media item if that one exists. Otherwise a file with a non-confilicting name or a sibling media item is created. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Unpack  <SwitchParameter> - -Indicates that the uplaod is expected to be a ZIP file which should be unpacked when it's received. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -AdvancedDialog  <SwitchParameter> - -Shows advanced dialog where user can upload multiple media items and select if the uploaded items are versioned, overwritten and unpacked. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Width  <Int32> - -Dialog width. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Height  <Int32> - -Dialog width. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item -System.String - -## Outputs - -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 - -```powershell - -PS master:\> Receive-File -Path "C:\temp\upload" -C:\temp\upload\text_029.txt - -``` - -### EXAMPLE 2 - -Upload text.txt file to media library under the 'master:\media library\Files' item -A new media item is created and returned - -```powershell - -PS master:\> Receive-File -ParentItem (get-item "master:\media library\Files") -Name Children Languages Id TemplateName ----- -------- --------- -- ------------ -text False {en} {7B11CE12-C0FC-4650-916C-2FC76F3DCAAF} File - -``` - -### EXAMPLE 3 - -Upload text.txt file to media library under the 'master:\media library\Files' item using advanced dialog. -A new media item is created but "undetermined" is returned as the dialog does not return the results. - -```powershell - -PS master:\> Receive-File (get-item "master:\media library\Files") -AdvancedDialog -undetermined - -``` - -### EXAMPLE 4 - -Upload text.txt file to media library under the 'master:\media library\Files' item. -A new versioned media item in Danish language is created and returned. If the media item existed - it will be overwritten. - -```powershell - -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 - - * [Send-File](/appendix/commands/Send-File.md) * [Out-Download](/appendix/commands/Out-Download.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Receive-ItemCloneNotification.md b/appendix/commands/Receive-ItemCloneNotification.md deleted file mode 100644 index 95c84b7b..00000000 --- a/appendix/commands/Receive-ItemCloneNotification.md +++ /dev/null @@ -1,296 +0,0 @@ -# Receive-ItemCloneNotification - - - -## Syntax - -Receive-ItemCloneNotification [-Notification <Notification>] -Notification <Notification> -Action <None | Accept | Reject | Dismiss> [-NotificationType <Notification | ChildCreatedNotification | FieldChangedNotification | FirstVersionAddedNotification | ItemMovedChildCreatedNotification | ItemMovedChildRemovedNotification | ItemMovedNotification | ItemTreeMovedNotification | ItemVersionNotification | OriginalItemChangedTemplateNotification | VersionAddedNotification>] [-Language <String[]>] - -Receive-ItemCloneNotification [-Item] <Item> -Notification <Notification> -Action <None | Accept | Reject | Dismiss> [-NotificationType <Notification | ChildCreatedNotification | FieldChangedNotification | FirstVersionAddedNotification | ItemMovedChildCreatedNotification | ItemMovedChildRemovedNotification | ItemMovedNotification | ItemTreeMovedNotification | ItemVersionNotification | OriginalItemChangedTemplateNotification | VersionAddedNotification>] [-Language <String[]>] - -Receive-ItemCloneNotification [-Path] <String> -Notification <Notification> -Action <None | Accept | Reject | Dismiss> [-NotificationType <Notification | ChildCreatedNotification | FieldChangedNotification | FirstVersionAddedNotification | ItemMovedChildCreatedNotification | ItemMovedChildRemovedNotification | ItemMovedNotification | ItemTreeMovedNotification | ItemVersionNotification | OriginalItemChangedTemplateNotification | VersionAddedNotification>] [-Language <String[]>] - -Receive-ItemCloneNotification -Id <String> [-Database <String>] -Notification <Notification> -Action <None | Accept | Reject | Dismiss> [-NotificationType <Notification | ChildCreatedNotification | FieldChangedNotification | FirstVersionAddedNotification | ItemMovedChildCreatedNotification | ItemMovedChildRemovedNotification | ItemMovedNotification | ItemTreeMovedNotification | ItemVersionNotification | OriginalItemChangedTemplateNotification | VersionAddedNotification>] [-Language <String[]>] - - -## Detailed Description - - - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Notification  <Notification> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Action  <NotificationAction> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -NotificationType  <NotificationType> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- - diff --git a/appendix/commands/Receive-ScriptSession.md b/appendix/commands/Receive-ScriptSession.md deleted file mode 100644 index bfbcaeb2..00000000 --- a/appendix/commands/Receive-ScriptSession.md +++ /dev/null @@ -1,227 +0,0 @@ -# Receive-ScriptSession - -Gets the results of a script session execution. - -## Syntax - -Receive-ScriptSession -Id <String[]> [-KeepResult] [-KeepSession] [-HostOutput] - -Receive-ScriptSession -Session <ScriptSession[]> [-KeepResult] [-KeepSession] [-HostOutput] - - -## Detailed Description - -The Receive-ScriptSession cmdlet gets the results of Windows PowerShell script sessions, such as those started by using the Start-ScriptSession. -You can get the results of all script sessions by their ID or by submitting a script session objects. -When you start a new script session, the session starts, but the results do not appear immediately. Instead, the command returns an object that represents the script session. The script session object contains useful information about the script session, but it does not contain the results. This method allows you to continue working in the current session while the script session runs. For more information about script sessions in Windows PowerShell, see about_script sessions. -The Receive-ScriptSession cmdlet gets the results that have been generated by the time that the Receive-ScriptSession command is submitted. If the session is not yet complete an error is raised. You can run additional Receive-ScriptSession commands to get the execution results. -By default, script session results and the session itself (unless it is a persistent session) are deleted from the system when you receive them, but you can use the KeepResult and KeepSession parameters to save the results so that you can receive them again. To delete the script session results, run the Receive-ScriptSession command again (without the KeepResult parameter), close the session, or use the Remove-ScriptSession cmdlet to delete the script session from the server. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -KeepResult  <SwitchParameter> - -Saves the script session results in the system, even after you have received them. By default, the script session results and the session itself are deleted when they are retrieved. -KeepResult parameter has the -KeepSession parameter implied in its usage. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -KeepSession  <SwitchParameter> - -Causes the receiving of the session results to not destroy the session after the cmdlet has executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -HostOutput  <SwitchParameter> - -Add this parameter to receive the host output content. The result of the command execution will basically be what the session would print if it was interactive. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String[]> - -Gets the results of script session with the specified IDs. -The ID is a string that uniquely identifies the script session within the server. You can type one or more IDs (separated by commas). To find the ID of a script session, type "Get-ScriptSession" without parameters. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Session  <ScriptSession[]> - -Specifies the script session for which results are being retrieved. Enter a variable that contains the script session or a command that gets the script session. You can also pipe a script session object to Receive-ScriptSession. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -## 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 - - - -```powershell - -The following will return the output from all available script sessions. - -PS master:\> Get-ScriptSession | Receive-ScriptSession - -``` - -## Related Topics - - * https://git.io/spe
diff --git a/appendix/commands/Remove-BaseTemplate.md b/appendix/commands/Remove-BaseTemplate.md deleted file mode 100644 index c2076b7f..00000000 --- a/appendix/commands/Remove-BaseTemplate.md +++ /dev/null @@ -1,271 +0,0 @@ -# Remove-BaseTemplate - -Remove one or more base templates from a template item. - -## Syntax - -Remove-BaseTemplate -Item <Item> -TemplateItem <TemplateItem[]> - -Remove-BaseTemplate -Item <Item> -Template <String[]> - -Remove-BaseTemplate -Path <String> -TemplateItem <TemplateItem[]> - -Remove-BaseTemplate -Path <String> -Template <String[]> - -Remove-BaseTemplate -Id <String> -TemplateItem <TemplateItem[]> - -Remove-BaseTemplate -Id <String> -Template <String[]> - -Remove-BaseTemplate [-Database <String>] - - -## Detailed Description - -The Remove-BaseTemplate command removes one or more base templates from a template item. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Item  <Item> - -The item to remove the base template from. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to remove the base template from. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to remove the base template from. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -TemplateItem  <TemplateItem[]> - -Sitecore item or list of items of base templates to remove. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Template  <String[]> - -Path representing the template item to remove as a base template. This must be of the same database as the item to be altered. -Note that this parameter only supports a single template. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to remove the base template from - required if item is specified with Id. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West, Alex Washtell - -## Examples - -### EXAMPLE 1 - -Remove base template of /sitecore/templates/User Defined/BaseTemplate from a template, using a path. - -```powershell - -PS master:\> Remove-BaseTemplate -Path "master:/sitecore/content/User Defined/Page" -Template "/sitecore/templates/User Defined/BaseTemplate" - -``` - -### EXAMPLE 2 - -Remove multiple base templates from a template, using items. - -```powershell - -PS master:\> $baseA = Get-Item -Path master:/sitecore/content/User Defined/BaseTemplateA - PS master:\> $baseB = Get-Item -Path master:/sitecore/content/User Defined/BaseTemplateB - PS master:\> Remove-BaseTemplate -Path "master:/sitecore/content/User Defined/Page" -TemplateItem @($baseA, $baseB) - -``` - -## Related Topics - - * [Add-BaseTemplate](/appendix/commands/Add-BaseTemplate.md) * [Get-ItemTemplate](/appendix/commands/Get-ItemTemplate.md) * [Set-ItemTemplate](/appendix/commands/Set-ItemTemplate.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Remove-Domain.md b/appendix/commands/Remove-Domain.md deleted file mode 100644 index f46b6f18..00000000 --- a/appendix/commands/Remove-Domain.md +++ /dev/null @@ -1,117 +0,0 @@ -# Remove-Domain - -Removes the specified domain. - -## Syntax - -Remove-Domain [-Name] <String> [-Force] - - -## Detailed Description - -The Remove-Domain command removes the specified domain. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Name  <String> - -The name of the domain. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Force  <SwitchParameter> - -Indicates that the domain should be removed although it contains users in that domain. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* System.String -Represents the name of a domain. - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* None. - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Remove-Domain -Name "domainName" - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Remove-ItemVersion.md b/appendix/commands/Remove-ItemVersion.md deleted file mode 100644 index c270999d..00000000 --- a/appendix/commands/Remove-ItemVersion.md +++ /dev/null @@ -1,393 +0,0 @@ -# Remove-ItemVersion - -Removes Language/Version from a single item or a branch of items - -## Syntax - -Remove-ItemVersion -Language <String[]> [-Version <String[]>] [-ExcludeLanguage <String[]>] [-Path] <String> [-Recurse] [-MaxRecentVersions <Int32>] - -Remove-ItemVersion -Language <String[]> [-Version <String[]>] [-ExcludeLanguage <String[]>] -Id <String> [-Database <String>] [-Recurse] [-MaxRecentVersions <Int32>] - -Remove-ItemVersion [-Language <String[]>] [-Version <String[]>] [-ExcludeLanguage <String[]>] [-Item] <Item> [-Recurse] [-MaxRecentVersions <Int32>] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions## Aliases -The following abbreviations are aliases for this cmdlet: -* Remove-ItemLanguage - -## Parameters - -### -Recurse  <SwitchParameter> - -Deleted language versions from the item and all of its children. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - -Language(s) that should be deleted form the provided item(s). -A single language or a list of languages can be defined using the parameter. -Language parameter supports globbing so you can delete whole language groups using wildcards. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Version  <String[]> - -Version(s) that should be deleted form the provided item(s). -A single version or a list of versions can be defined using the parameter. -Version parameter supports globbing so you can delete whole version groups using wildcards. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -ExcludeLanguage  <String[]> - -Language(s) that should NOT be deleted form the provided item(s). -A single language or a list of languages can be defined using the parameter. -Language parameter supports globbing so you can delete whole language groups using wildcards. - -If Language parameter is not is not specified but ExcludeLanguage is provided, the default value of "*" is assumed for Language parameter. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -MaxRecentVersions  <Int32> - -If provided - trims the selected language to value specified by this parameter. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item/version to be processed. You can pipe a specific version of the item for it to be removed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -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 - -```powershell - -PS master:\> Remove-ItemVersion -Path master:\content\home -Language "pl-pl", "es-es" - -``` - -### EXAMPLE 2 - -Remove all english based languages defined in /sitecore/content/home item and all of its children in the master database - -```powershell - -PS master:\> Remove-ItemVersion -Path master:\content\home -Language "en-*" -Recurse - -``` - -### EXAMPLE 3 - -Remove all languages except those that are "en" based defined in /sitecore/content/home item and all of its children in the master database - -```powershell - -PS master:\> Remove-ItemVersion -Path master:\content\home -ExcludeLanguage "en*" -Recurse - -``` - -### EXAMPLE 4 - -Trim all languages to 3 latest versions for /sitecore/content/home item and all of its children in the master database - -```powershell - -PS master:\> Remove-ItemVersion -Path master:\content\home -Language * -Recurse - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Add-ItemVersion](/appendix/commands/Add-ItemVersion.md) * Remove-Item * https://gist.github.com/AdamNaj/b36ea095e3668c22c07e
diff --git a/appendix/commands/Remove-Rendering.md b/appendix/commands/Remove-Rendering.md deleted file mode 100644 index cb83100a..00000000 --- a/appendix/commands/Remove-Rendering.md +++ /dev/null @@ -1,560 +0,0 @@ -# Remove-Rendering - -Removes renderings from an item. - -## Syntax - -Remove-Rendering -Item <Item> [-DataSource <String>] [-Rendering <Item>] [-Index <Int32>] [-PlaceHolder <String>] [-Parameter <Hashtable>] [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - -Remove-Rendering -Item <Item> -Instance <RenderingDefinition> [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - -Remove-Rendering -Item <Item> -UniqueId <String> [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - -Remove-Rendering -Path <String> [-DataSource <String>] [-Rendering <Item>] [-Index <Int32>] [-PlaceHolder <String>] [-Parameter <Hashtable>] [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - -Remove-Rendering -Path <String> -Instance <RenderingDefinition> [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - -Remove-Rendering -Path <String> -UniqueId <String> [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - -Remove-Rendering [-Id <String>] [-Database <String>] [-DataSource <String>] [-Rendering <Item>] [-Index <Int32>] [-PlaceHolder <String>] [-Parameter <Hashtable>] [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - -Remove-Rendering [-Id <String>] [-Database <String>] -Instance <RenderingDefinition> [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - -Remove-Rendering [-Id <String>] [-Database <String>] -UniqueId <String> [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - - -## Detailed Description - -Removes renderings from an item based on a number of qualifying criteria. The search criteria are cumulative and narrowing the search in an "AND" manner. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Item  <Item> - -The item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -DataSource  <String> - -Data source filter - supports wildcards. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Rendering  <Item> - -Item representing the sublayout/rendering. If matching the rendering will be removed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Index  <Int32> - -Index at which the rendering exists in the layout. The rendering at that index will be removed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -PlaceHolder  <String> - -Place holder at which the rendering exists in the layout. Rendering at that placeholder will be removed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Parameter  <Hashtable> - -Additional rendering parameter values. If both name and value match - the rendering will be removed. Values support wildcards. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Instance  <RenderingDefinition> - -Specific instance of rendering that should be removed. The instance coule earlier be obtained through e.g. use of Get-Rendering. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -UniqueId  <String> - -UniqueID of the rendering to be removed. The instance coule earlier be obtained through e.g. use of OD of rendering retrieved with Get-Rendering. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Device  <DeviceItem> - -Device for which the rendering should be removed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -FinalLayout  <SwitchParameter> - -Targets the Final Layout. If not provided, the Shared Layout will be targeted. Applies to Sitecore 8.0 and higher only. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* System.Void - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -remove all renderings for "Default" device - -```powershell - -PS master:\> Remove-Rendering -Path master:\content\home -Device (Get-LayoutDevice "Default") - -``` - -### EXAMPLE 2 - -remove all renderings from the "main" placeholder and all of its embedded placeholders. - -```powershell - -PS master:\> Remove-Rendering -Path master:\content\home -PlaceHolder "main*" - -``` - -### EXAMPLE 3 - -remove all renderings from the "main" placeholder and all of its embedded placeholders, but only in the "Default" device - -```powershell - -PS master:\> Remove-Rendering -Path master:\content\home -PlaceHolder "main*" -Device (Get-LayoutDevice "Default") - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Add-Rendering](/appendix/commands/Add-Rendering.md) * [New-Rendering](/appendix/commands/New-Rendering.md) * [Set-Rendering](/appendix/commands/Set-Rendering.md) * [Get-Rendering](/appendix/commands/Get-Rendering.md) * [Get-LayoutDevice](/appendix/commands/Get-LayoutDevice.md) * [Get-Layout](/appendix/commands/Get-Layout.md) * [Set-Layout](/appendix/commands/Set-Layout.md) diff --git a/appendix/commands/Remove-Role.md b/appendix/commands/Remove-Role.md deleted file mode 100644 index 5f960b9f..00000000 --- a/appendix/commands/Remove-Role.md +++ /dev/null @@ -1,118 +0,0 @@ -# Remove-Role - -Removes a Sitecore role. - -## Syntax - -Remove-Role [-Identity] <AccountIdentity> - -Remove-Role -Instance <Role> - - -## Detailed Description - -The Remove-Role command removes a Sitecore role. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <AccountIdentity> - -Role name including domain. If no domain is specified - 'sitecore' will be used as the default value - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Instance  <Role> - -Role instance like that returned by the Get-Role command. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* 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 - - - -```powershell - -PS master:\> Remove-Role -Identity Michael - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Remove-RoleMember.md b/appendix/commands/Remove-RoleMember.md deleted file mode 100644 index d978fa21..00000000 --- a/appendix/commands/Remove-RoleMember.md +++ /dev/null @@ -1,124 +0,0 @@ -# Remove-RoleMember - -Removes one or more Sitecore users from the specified role. - -## Syntax - -Remove-RoleMember [-Identity] <AccountIdentity> -Members <AccountIdentity[]> - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <AccountIdentity> - -Specifies the Sitecore role by providing one of the following values. - - Local Name - Example: developer - Fully Qualified Name - Example: sitecore\developer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Members  <AccountIdentity[]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* System.String -Represents the identity of a role. - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* None. - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Remove-RoleMember -Identity developer -Members "michael","adam","mike" - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Add-RoleMember](/appendix/commands/Add-RoleMember.md) * [Get-RoleMember](/appendix/commands/Get-RoleMember.md) diff --git a/appendix/commands/Remove-ScriptSession.md b/appendix/commands/Remove-ScriptSession.md deleted file mode 100644 index 6ca65f65..00000000 --- a/appendix/commands/Remove-ScriptSession.md +++ /dev/null @@ -1,114 +0,0 @@ -# Remove-ScriptSession - -Removes a persistent Script Session from memory. - -## Syntax - -Remove-ScriptSession -Id <String[]> - -Remove-ScriptSession -Session <ScriptSession[]> - - -## Detailed Description - -Removes a persistent Script Session from memory. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Id  <String[]> - -Id of the PowerShell session to be removed from memory. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Session  <ScriptSession[]> - -Session to be removed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Resident Script Session obtained through Get-ScriptSessio* Id of a resident Script Sessio* Cognifide.PowerShell.Core.Host.ScriptSessio* System.String - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -The following removes the script session using the specified Id. - -PS master:\> Remove-ScriptSession -Id "Long running script" - -``` - -## Related Topics - - * [Get-ScriptSession](/appendix/commands/Get-ScriptSession.md) * [Receive-ScriptSession](/appendix/commands/Receive-ScriptSession.md) * [Start-ScriptSession](/appendix/commands/Start-ScriptSession.md) * [Stop-ScriptSession](/appendix/commands/Stop-ScriptSession.md) * [Wait-ScriptSession](/appendix/commands/Wait-ScriptSession.md) * https://git.io/spe
* http://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/
diff --git a/appendix/commands/Remove-SearchIndexItem.md b/appendix/commands/Remove-SearchIndexItem.md deleted file mode 100644 index 96d4ac70..00000000 --- a/appendix/commands/Remove-SearchIndexItem.md +++ /dev/null @@ -1,158 +0,0 @@ -# Remove-SearchIndexItem - - - -## Syntax - -Remove-SearchIndexItem -Item <Item> [-Name <String>] [-AsJob] - -Remove-SearchIndexItem -Item <Item> [-Name <String>] [-AsJob] - -Remove-SearchIndexItem -SearchResultItem <SearchResultItem> [-AsJob] - - -## Detailed Description - - - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Item  <Item> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -SearchResultItem  <SearchResultItem> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -AsJob  <SwitchParameter> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Name  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- - diff --git a/appendix/commands/Remove-Session.md b/appendix/commands/Remove-Session.md deleted file mode 100644 index 84403077..00000000 --- a/appendix/commands/Remove-Session.md +++ /dev/null @@ -1,128 +0,0 @@ -# Remove-Session - -Removes one or more Sitecore user sessions. - -## Syntax - -Remove-Session -InstanceId <String[]> - -Remove-Session [-Instance] <Session> - - -## Detailed Description - -The Remove-Session command removes user sessions in Sitecore. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -InstanceId  <String[]> - -Specifies the Sitecore SessionID. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Instance  <Session> - -Specifies the Sitecore user sessions. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Accepts a user session.* Sitecore.Web.Authentication.DomainAccessGuard.Sessio - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* None. - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - - - -```powershell - -PS master:\> Remove-Session -InstanceId tekipna1lk0ccr2z1bdjsua2,wq4bfivfm2tbgkgdccpyzczp - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\> Get-Session -Identity michael | Remove-Session - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Get-Session](/appendix/commands/Get-Session.md) diff --git a/appendix/commands/Remove-User.md b/appendix/commands/Remove-User.md deleted file mode 100644 index 2a9a4958..00000000 --- a/appendix/commands/Remove-User.md +++ /dev/null @@ -1,149 +0,0 @@ -# Remove-User - -Removes the Sitecore user. - -## Syntax - -Remove-User [-Identity] <AccountIdentity> - -Remove-User -Instance <User> - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <AccountIdentity> - -Specifies the Sitecore user by providing one of the following values. - - Local Name - Example: admin - Fully Qualified Name - Example: sitecore\admi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Instance  <User> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* System.String -Represents the identity of a user. - -Sitecore.Security.Accounts.User -Represents the instance of a user. - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* None. - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - - - -```powershell - -PS master:\> Remove-User -Identity michael - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\> "michael","adam","mike" | Remove-User - -``` - -### EXAMPLE 3 - - - -```powershell - -PS master:\> Get-User -Filter sitecore\m* | Remove-User - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Get-User](/appendix/commands/Get-User.md) * [New-User](/appendix/commands/New-User.md) * [Set-User](/appendix/commands/Set-User.md) * [Unlock-User](/appendix/commands/Unlock-User.md) diff --git a/appendix/commands/Reset-ItemField.md b/appendix/commands/Reset-ItemField.md deleted file mode 100644 index 29e9d4c4..00000000 --- a/appendix/commands/Reset-ItemField.md +++ /dev/null @@ -1,310 +0,0 @@ -# Reset-ItemField - -Resets item fields, specified as either names, fields or template fields. - -## Syntax - -Reset-ItemField [-Item] <Item> [-IncludeStandardFields] [-Name <String[]>] [-Language <String[]>] - -Reset-ItemField [-Path] <String> [-IncludeStandardFields] [-Name <String[]>] [-Language <String[]>] - -Reset-ItemField -Id <String> [-Database <String>] [-IncludeStandardFields] [-Name <String[]>] [-Language <String[]>] - - -## Detailed Description - -Resets item fields, specified as either names, fields or template fields. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -IncludeStandardFields  <SwitchParameter> - -Includes fields that are defined on "Standard template" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Name  <String[]> - -Array of field names to include - supports wildcards. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - -Language that will be reset. If not specified the current user language will be used. Globbing/wildcard supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be analysed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be analysed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be analysed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be reset - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* None - -## Notes - -Help Author: Adam Najmanowicz, Michael West, Alex Washtell - -## Examples - -### EXAMPLE 1 - -Reset all item fields, excluding standard fields. - -```powershell - -PS master:\> Reset-ItemField -Path master:\content\home - -``` - -### EXAMPLE 2 - -Reset all item fields, including standard fields. - -```powershell - -PS master:\> Reset-ItemField -Path master:\content\home -IncludeStandardFields - -``` - -### EXAMPLE 3 - -Reset all item fields with names beginning with "a", excluding standard fields. - -```powershell - -PS master:\> Get-Item master:\content\home | Reset-ItemField -Name "a*" - -``` - -## Related Topics - - * [Get-ItemTemplate](/appendix/commands/Get-ItemTemplate.md) * [Get-ItemField](/appendix/commands/Get-ItemField.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Reset-Layout.md b/appendix/commands/Reset-Layout.md deleted file mode 100644 index 87e63d8d..00000000 --- a/appendix/commands/Reset-Layout.md +++ /dev/null @@ -1,256 +0,0 @@ -# Reset-Layout - -Resets the layout for the specified item. - -## Syntax - -Reset-Layout [-Item] <Item> [-FinalLayout] [-Language <String[]>] - -Reset-Layout [-Path] <String> [-FinalLayout] [-Language <String[]>] - -Reset-Layout -Id <String> [-Database <String>] [-FinalLayout] [-Language <String[]>] - - -## Detailed Description - -The Reset-Layout command resets the layout for the specified item. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -FinalLayout  <SwitchParameter> - -Targets the Final Layout. If not provided, the Shared Layout will be targeted. Applies to Sitecore 8.0 and higher only. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* None. - -## Notes - -Help Author: Adam Najmanowicz, Michael West, Alex Washtell - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Reset-Layout -Path master:\content\home - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Add-Rendering](/appendix/commands/Add-Rendering.md) * [New-Rendering](/appendix/commands/New-Rendering.md) * [Set-Rendering](/appendix/commands/Set-Rendering.md) * [Get-Rendering](/appendix/commands/Get-Rendering.md) * [Get-LayoutDevice](/appendix/commands/Get-LayoutDevice.md) * [Remove-Rendering](/appendix/commands/Remove-Rendering.md) * [Set-Layout](/appendix/commands/Set-Layout.md) * [Get-Layout](/appendix/commands/Get-Layout.md) diff --git a/appendix/commands/Restart-Application.md b/appendix/commands/Restart-Application.md deleted file mode 100644 index 04ecacba..00000000 --- a/appendix/commands/Restart-Application.md +++ /dev/null @@ -1,34 +0,0 @@ -# Restart-Application - -Restarts the Sitecore Application pool. - -## Syntax - - -## Detailed Description - -Restarts the Sitecore Application pool. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Restart-Application - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Resume-SearchIndex.md b/appendix/commands/Resume-SearchIndex.md deleted file mode 100644 index 298a98cd..00000000 --- a/appendix/commands/Resume-SearchIndex.md +++ /dev/null @@ -1,134 +0,0 @@ -# Resume-SearchIndex - -Resumes the suspended (paused) Sitecore index. - -## Syntax - -Resume-SearchIndex -Index <ISearchIndex> - -Resume-SearchIndex [-Name <String>] - -Resume-SearchIndex [-Name <String>] - - -## Detailed Description - -The Resume-SearchIndex command resumes the suspended (paused) Sitecore index. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Index  <ISearchIndex> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Name  <String> - -The name of the index to resume. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.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 - -### EXAMPLE 1 - - - -```powershell - -The following stops the indexing process from running. - -PS master:\> Resume-SearchIndex -Name sitecore_master_index - -``` - -### EXAMPLE 2 - - - -```powershell - -The following stops the indexing process from running. - -PS master:\> Get-SearchIndex -Name sitecore_master_index | Resume-SearchIndex - -``` - -## Related Topics - - * [Initialize-SearchIndex](/appendix/commands/Initialize-SearchIndex.md) * [Suspend-SearchIndex](/appendix/commands/Suspend-SearchIndex.md) * [Stop-SearchIndex](/appendix/commands/Stop-SearchIndex.md) * [Get-SearchIndex](/appendix/commands/Get-SearchIndex.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Send-File.md b/appendix/commands/Send-File.md deleted file mode 100644 index 7df130db..00000000 --- a/appendix/commands/Send-File.md +++ /dev/null @@ -1,336 +0,0 @@ -# Send-File - -Allows users to download files from server and file items from media library. - -## Syntax - -Send-File [-Path] <String> [-Message <String>] [-NoDialog] [-ShowFullPath] [-Title <String>] [-Width <Int32>] [-Height <Int32>] - -Send-File [-Item] <Item> [-Message <String>] [-NoDialog] [-ShowFullPath] [-Title <String>] [-Width <Int32>] [-Height <Int32>] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions## Aliases -The following abbreviations are aliases for this cmdlet: -* Download-File - -## Parameters - -### -Path  <String> - -Path to the file to be downloaded. The file has to exist in the Data folder. Files from outside the Data folder are not downloadable. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Message  <String> - -Message to show the user in the download dialog. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be downloaded. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -NoDialog  <SwitchParameter> - -If this parameter is used the Dialog will not be shown but instead the file download will begin immediately. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -ShowFullPath  <SwitchParameter> - -If this parameter is used the Dialog will display full path to the file downloaded in the dialog, otherwise only the file name will be shown. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Title  <String> - -Download dialog title. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Width  <Int32> - -Download dialog width. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Height  <Int32> - -Download dialog height. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* System.String - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Download File from server disk drive - -```powershell - -PS master:\> Send-File -Path "C:\Projects\ZenGarden\Data\packages\Sitecore PowerShell Extensions-2.6.zip" - -``` - -### EXAMPLE 2 - -Download item from media library - -```powershell - -PS master:\> Get-Item "master:/media library/Showcase/cognifide_logo" | Send-File -Message "Cognifide Logo" - -``` - -## Related Topics - - * [Receive-File](/appendix/commands/Receive-File.md) * [Out-Download](/appendix/commands/Out-Download.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Send-SheerMessage.md b/appendix/commands/Send-SheerMessage.md deleted file mode 100644 index 58600619..00000000 --- a/appendix/commands/Send-SheerMessage.md +++ /dev/null @@ -1,138 +0,0 @@ -# Send-SheerMessage - -Sends a sheer message to the app in which context the script is executing. - -## Syntax - -Send-SheerMessage [-Name] <String> [-GetResult] [-Parameters <Hashtable>] - - -## Detailed Description - -Sends a sheer message to the app in which context the script is executing. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Name  <String> - -Name of the Sheer message to execute. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -GetResult  <SwitchParameter> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Parameters  <Hashtable> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - -If you execute the following script in the PowerShell ISE the Save dialog will popup - -```powershell - -Send-SheerMessage -Name 'ise:save' - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Set-HostProperty.md b/appendix/commands/Set-HostProperty.md deleted file mode 100644 index aca6eda6..00000000 --- a/appendix/commands/Set-HostProperty.md +++ /dev/null @@ -1,182 +0,0 @@ -# Set-HostProperty - -Sets the current host property. - -## Syntax - -Set-HostProperty [-ForegroundColor <Black | DarkBlue | DarkGreen | DarkCyan | DarkRed | DarkMagenta | DarkYellow | Gray | DarkGray | Blue | Green | Cyan | Red | Magenta | Yellow | White>] [-BackgroundColor <Black | DarkBlue | DarkGreen | DarkCyan | DarkRed | DarkMagenta | DarkYellow | Gray | DarkGray | Blue | Green | Cyan | Red | Magenta | Yellow | White>] [-HostWidth <Int32>] [-Persist] - - -## Detailed Description - -Sets the current host property and perssits them for the future if used with -Persist parameter. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -ForegroundColor  <ConsoleColor> - -Color of the console text. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -BackgroundColor  <ConsoleColor> - -Color of the console background. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -HostWidth  <Int32> - -Width of the text buffer (texts longer than the number provided will wrap to the next line. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Persist  <SwitchParameter> - -Persist the console setting provided - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Set width of the console buffer to 80 and persist it for the future instances - -```powershell - -PS master:\> Set-HostProperty -HostWidth 80 -Persist - -``` - -### EXAMPLE 2 - -Set color of the console text to cyan. Next instance of the console will revert to default (white). - -```powershell - -PS master:\> Set-HostProperty -ForegroundColor Cyan - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Set-ItemAcl.md b/appendix/commands/Set-ItemAcl.md deleted file mode 100644 index 7a890467..00000000 --- a/appendix/commands/Set-ItemAcl.md +++ /dev/null @@ -1,278 +0,0 @@ -# Set-ItemAcl - -Sets new security information on an item overwriting the previous settings. - -## Syntax - -Set-ItemAcl -AccessRules <AccessRuleCollection> [-Path] <String> [-PassThru] - -Set-ItemAcl -AccessRules <AccessRuleCollection> -Id <String> [-Database <String>] [-PassThru] - -Set-ItemAcl -AccessRules <AccessRuleCollection> [-Item] <Item> [-PassThru] - - -## Detailed Description - -Sets new security information on an item. The new rules will overwrite the existing security descriptors on the item. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -AccessRules  <AccessRuleCollection> - -A single or multiple access rules created e.g. through the New-ItemAcl or obtained from other item using the Get-ItemAcl cmdlet. -This information will overwrite the existing security descriptors on the item. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -PassThru  <SwitchParameter> - -Passes the processed object back into the pipeline. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be processed. Requires the Database parameter to be specified. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be fetched with Id parameter. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* can be piped from another cmdlet* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Only if -PassThru is used* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Take the security information from the Home item and apply it to the Settings item - -```powershell - -$acl = Get-ItemAcl -Path master:\content\home -Set-ItemAcl -Path master:\content\Settings -AccessRules $acl -PassThru - -``` - -### EXAMPLE 2 - -Allows the "sitecore\adam" user to delete the Home item and all of its children. -Denies the "sitecore\mikey" user reading the descendants of the Home item. ;P -The security info is created prior to setting it to the item. -The item is delivered to the Set-ItemAcl from the pipeline and returned to the pipeline after processing due to the -PassThru parameter. -Any previuous security information on the item is removed. - -```powershell - -$acl1 = New-ItemAcl -AccessRight item:delete -PropagationType Any -SecurityPermission AllowAccess -Identity "sitecore\adam" -$acl2 = New-ItemAcl -AccessRight item:read -PropagationType Descendants -SecurityPermission DenyAccess -Identity "sitecore\mikey" -Get-Item -Path master:\content\home | Set-ItemAcl -AccessRules $acl1, $acl2 -PassThru - -Name Children Languages Id TemplateName ----- -------- --------- -- ------------ -Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Add-ItemAcl](/appendix/commands/Add-ItemAcl.md) * [Clear-ItemAcl](/appendix/commands/Clear-ItemAcl.md) * [Get-ItemAcl](/appendix/commands/Get-ItemAcl.md) * [New-ItemAcl](/appendix/commands/New-ItemAcl.md) * [Test-ItemAcl](/appendix/commands/Test-ItemAcl.md) * 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/
diff --git a/appendix/commands/Set-ItemTemplate.md b/appendix/commands/Set-ItemTemplate.md deleted file mode 100644 index 40ca87db..00000000 --- a/appendix/commands/Set-ItemTemplate.md +++ /dev/null @@ -1,317 +0,0 @@ -# Set-ItemTemplate - -Sets the item template. - -## Syntax - -Set-ItemTemplate -Item <Item> -TemplateItem <TemplateItem> [-FieldsToCopy <Hashtable>] - -Set-ItemTemplate -Item <Item> -Template <String> [-FieldsToCopy <Hashtable>] - -Set-ItemTemplate -Path <String> -TemplateItem <TemplateItem> [-FieldsToCopy <Hashtable>] - -Set-ItemTemplate -Path <String> -Template <String> [-FieldsToCopy <Hashtable>] - -Set-ItemTemplate -Id <String> -TemplateItem <TemplateItem> [-FieldsToCopy <Hashtable>] - -Set-ItemTemplate -Id <String> -Template <String> [-FieldsToCopy <Hashtable>] - -Set-ItemTemplate [-Database <String>] [-FieldsToCopy <Hashtable>] - - -## Detailed Description - -The Set-ItemTemplate command sets the template for an item. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Item  <Item> - -The item to set the template for. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to set the template for. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to set the template for. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -TemplateItem  <TemplateItem> - -Sitecore item representing the template. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Template  <String> - -Path representing the template item. This must be of the same database as the item to be altered. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -FieldsToCopy  <Hashtable> - -Hashtable of key value pairs mapping the old template field to a new template field. - -@{"Title"="Headline";"Text"="Copy"} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to set the template for - required if item is specified with Id. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West, Alex Washtell - -## Examples - -### EXAMPLE 1 - -Set template of /sitecore/content/home item using a Template path. - -```powershell - -PS master:\> Set-ItemTemplate -Path master:/sitecore/content/home -Template "/sitecore/templates/User Defined/Page" - -``` - -### EXAMPLE 2 - -Set template of /sitecore/content/home item using a TemplateItem. - -```powershell - -PS master:\> $template = Get-ItemTemplate -Path master:\content\home\page1 - PS master:\> Set-ItemTemplate -Path master:\content\home\page2 -TemplateItem $template - -``` - -### EXAMPLE 3 - -Set the template and remap fields to their new name. - -```powershell - -Set-ItemTemplate -Path "master:\content\home\Page1" ` - -Template "User Defined/Target" ` - -FieldsToCopy @{Field1="Field4"; Field2="Field5"; Field3="Field6"} - -``` - -## Related Topics - - * [Get-ItemTemplate](/appendix/commands/Get-ItemTemplate.md) * [Add-BaseTemplate](/appendix/commands/Add-BaseTemplate.md) * [Remove-BaseTemplate](/appendix/commands/Remove-BaseTemplate.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Set-Layout.md b/appendix/commands/Set-Layout.md deleted file mode 100644 index 9db09f9c..00000000 --- a/appendix/commands/Set-Layout.md +++ /dev/null @@ -1,318 +0,0 @@ -# Set-Layout - -Sets item layout for a device. - -## Syntax - -Set-Layout [-Item] <Item> -Device <DeviceItem> [-Layout <Item>] [-FinalLayout] [-Language <String[]>] - -Set-Layout [-Path] <String> -Device <DeviceItem> [-Layout <Item>] [-FinalLayout] [-Language <String[]>] - -Set-Layout -Id <String> [-Database <String>] -Device <DeviceItem> [-Layout <Item>] [-FinalLayout] [-Language <String[]>] - - -## Detailed Description - -Sets item layout for a specific device provided - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Device  <DeviceItem> - -Device for which to set layout. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Layout  <Item> - -Sitecore item defining the layout. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -FinalLayout  <SwitchParameter> - -Targets the Final Layout. If not provided, the Shared Layout will be targeted. Applies to Sitecore 8.0 and higher only. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Set-Layout -Path master:\content\home - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Add-Rendering](/appendix/commands/Add-Rendering.md) * [New-Rendering](/appendix/commands/New-Rendering.md) * [Set-Rendering](/appendix/commands/Set-Rendering.md) * [Get-Rendering](/appendix/commands/Get-Rendering.md) * [Get-LayoutDevice](/appendix/commands/Get-LayoutDevice.md) * [Remove-Rendering](/appendix/commands/Remove-Rendering.md) * [Get-Layout](/appendix/commands/Get-Layout.md) * [Reset-Layout](/appendix/commands/Reset-Layout.md) diff --git a/appendix/commands/Set-UserPassword.md b/appendix/commands/Set-UserPassword.md deleted file mode 100644 index d496c737..00000000 --- a/appendix/commands/Set-UserPassword.md +++ /dev/null @@ -1,207 +0,0 @@ -# Set-UserPassword - -Sets the Sitecore user password. - -## Syntax - -Set-UserPassword [-Identity] <AccountIdentity> -OldPassword <String> [-NewPassword <String>] - -Set-UserPassword [-Identity] <AccountIdentity> -Reset [-NewPassword <String>] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <AccountIdentity> - -Specifies the Sitecore user by providing one of the following values. - - Local Name - Example: admin - Fully Qualified Name - Example: sitecore\admi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -NewPassword  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?true (ByPropertyName)
Accept Wildcard Characters?false
- -### -OldPassword  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Reset  <SwitchParameter> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* System.String -Represents the identity of a user. - -Sitecore.Security.Accounts.User -Represents the instance of a user. - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* None. - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - - - -```powershell - -PS master:\> Set-UserPassword -Identity michael -NewPassword pass123 -OldPassword b - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\> "michael","adam","mike" | Set-UserPassword -NewPassword b -Reset - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Get-User](/appendix/commands/Get-User.md) * [Set-User](/appendix/commands/Set-User.md) diff --git a/appendix/commands/Show-Alert.md b/appendix/commands/Show-Alert.md deleted file mode 100644 index 649e758b..00000000 --- a/appendix/commands/Show-Alert.md +++ /dev/null @@ -1,70 +0,0 @@ -# Show-Alert - -Pauses the script and shows an alert to the user. - -## Syntax - -Show-Alert [-Title] <String> - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Title  <String> - -Text to show the user in the alert dialog. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Show-Alert "Hello world." - -``` - -## Related Topics - - * [Read-Variable](/appendix/commands/Read-Variable.md) * [Show-Application](/appendix/commands/Show-Application.md) * [Show-Confirm](/appendix/commands/Show-Confirm.md) * [Show-FieldEditor](/appendix/commands/Show-FieldEditor.md) * [Show-Input](/appendix/commands/Show-Input.md) * [Show-ListView](/appendix/commands/Show-ListView.md) * [Show-ModalDialog](/appendix/commands/Show-ModalDialog.md) * [Show-Result](/appendix/commands/Show-Result.md) * [Show-YesNoCancel](/appendix/commands/Show-YesNoCancel.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Show-Application.md b/appendix/commands/Show-Application.md deleted file mode 100644 index 50f8d33f..00000000 --- a/appendix/commands/Show-Application.md +++ /dev/null @@ -1,299 +0,0 @@ -# Show-Application - -Executes Sitecore Sheer application. - -## Syntax - -Show-Application [-Application] <String> [[-Parameter] <Hashtable>] [-Icon <String>] [-Modal] [-Title <String>] [-Width <Int32>] [-Height <Int32>] - - -## Detailed Description - -Executes Sitecore Sheer application, allows for passing additional parameters, launching it on desktop in cooperative or in Modal mode. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Application  <String> - -Name of the Application to be executed. Application must be defined in the Core databse. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Parameter  <Hashtable> - -Additional parameters passed to the application. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?2
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Icon  <String> - -Icon of the executed application (used for titlebar and in the Sitecore taskbar on the desktop) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Modal  <SwitchParameter> - -Causes the application to show in new browser modal window or modal overlay if used in Sitecore 7.2 or later. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Title  <String> - -Title of the window the app opens in. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Width  <Int32> - -Width of the modal window. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Height  <Int32> - -Height of the modal window. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Show Content Editor in new window (or as an overlay in modal mode in Sitecore 7.2+) with "/sitecore/templates" item selected. - -```powershell - -$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="$($item.Database.Name)"} ` - -Modal -Width 1600 -Height 800 - -``` - -### EXAMPLE 2 - -Show Content Editor as a new application on desktop with "/sitecore/content/home" item selected. - -```powershell - -$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="$($item.Database.Name)"} ` - -``` - -## Related Topics - - * [Read-Variable](/appendix/commands/Read-Variable.md) * [Show-Alert](/appendix/commands/Show-Alert.md) * [Show-Confirm](/appendix/commands/Show-Confirm.md) * [Show-FieldEditor](/appendix/commands/Show-FieldEditor.md) * [Show-Input](/appendix/commands/Show-Input.md) * [Show-ListView](/appendix/commands/Show-ListView.md) * [Show-ModalDialog](/appendix/commands/Show-ModalDialog.md) * [Show-Result](/appendix/commands/Show-Result.md) * [Show-YesNoCancel](/appendix/commands/Show-YesNoCancel.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Show-Confirm.md b/appendix/commands/Show-Confirm.md deleted file mode 100644 index d2410893..00000000 --- a/appendix/commands/Show-Confirm.md +++ /dev/null @@ -1,80 +0,0 @@ -# Show-Confirm - -Shows a user a confirmation request message box. - -## Syntax - -Show-Confirm [-Title] <String> - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Title  <String> - -Text to show the user in the dialog. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* System.String - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Show-Confirm -Title "Do you like Sitecore PowerShell Extensions?" - -yes - -``` - -## Related Topics - - * [Read-Variable](/appendix/commands/Read-Variable.md) * [Show-Alert](/appendix/commands/Show-Alert.md) * [Show-Application](/appendix/commands/Show-Application.md) * [Show-FieldEditor](/appendix/commands/Show-FieldEditor.md) * [Show-Input](/appendix/commands/Show-Input.md) * [Show-ListView](/appendix/commands/Show-ListView.md) * [Show-ModalDialog](/appendix/commands/Show-ModalDialog.md) * [Show-Result](/appendix/commands/Show-Result.md) * [Show-YesNoCancel](/appendix/commands/Show-YesNoCancel.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Show-FieldEditor.md b/appendix/commands/Show-FieldEditor.md deleted file mode 100644 index 4fd378b7..00000000 --- a/appendix/commands/Show-FieldEditor.md +++ /dev/null @@ -1,519 +0,0 @@ -# Show-FieldEditor - -Shows Field editor for a provided item. - -## Syntax - -Show-FieldEditor -Item <Item> -PreserveSections [-Name <String[]>] [-Title <String>] [-Width <Int32>] [-Height <Int32>] [-IncludeStandardFields] - -Show-FieldEditor -Item <Item> [-SectionTitle <String>] [-SectionIcon <String>] [-Name <String[]>] [-Title <String>] [-Width <Int32>] [-Height <Int32>] [-IncludeStandardFields] - -Show-FieldEditor -Path <String> [-Language <String[]>] -PreserveSections [-Name <String[]>] [-Title <String>] [-Width <Int32>] [-Height <Int32>] [-IncludeStandardFields] - -Show-FieldEditor -Path <String> [-Language <String[]>] [-SectionTitle <String>] [-SectionIcon <String>] [-Name <String[]>] [-Title <String>] [-Width <Int32>] [-Height <Int32>] [-IncludeStandardFields] - -Show-FieldEditor -Id <String> [-Database <String>] [-Language <String[]>] -PreserveSections [-Name <String[]>] [-Title <String>] [-Width <Int32>] [-Height <Int32>] [-IncludeStandardFields] - -Show-FieldEditor -Id <String> [-Database <String>] [-Language <String[]>] [-SectionTitle <String>] [-SectionIcon <String>] [-Name <String[]>] [-Title <String>] [-Width <Int32>] [-Height <Int32>] [-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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Name  <String[]> - -Array of names of the fields to be edited. - -This parameter supports globbing so you can simply use "*" to allow editing of all fields. -If a field is prefixed with a dash - this field will be excluded from the list of fields. -e.g. the following will display all fields except title from -Show-FieldEditor -Path "master:\content\home" -Name "*", "-Title" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Title  <String> - -Title of the dialog containing the field editor. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Width  <Int32> - -Width of the dialog containing the field editor. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Height  <Int32> - -Height of the dialog containing the field editor. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -IncludeStandardFields  <SwitchParameter> - -Add this parameter to add standard fields to the list that is being considered to be displayed - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be edited. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be edited - additionally specify Language parameter to fetch different item language than the current user language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the the item to be edited - additionally specify Language parameter to fetch different item language than the current user language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be edited - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - -Language that will be edited. If not specified the current user language will be used. Globbing/wildcard supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -PreserveSections  <SwitchParameter> - -If added this parameter tells editor to preserve the original item field sections, otherwise all fields are placed in a single section Named by SectionTitle parameter and having the SectionIcon icon. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -SectionTitle  <String> - -If PreserveSections is not added to parameters - this parameter provides a title for the global section all fields are placed under. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -SectionIcon  <String> - -If PreserveSections is not added to parameters - this parameter provides a iconfor the global section all fields are placed under. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* System.String - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Show field editor that shows all non-standard fields on sitecore/content/home item except for field "title" -The dialog will be titled "My Home Item" all fields inside will be in single section. - -```powershell - -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. - -```powershell - -PS master:\> Get-Item "master:\content\home" | Show-FieldEditor -Name "*" -IncludeStandardFields -PreserveSections - -``` - -## Related Topics - - * [Read-Variable](/appendix/commands/Read-Variable.md) * [Show-Alert](/appendix/commands/Show-Alert.md) * [Show-Application](/appendix/commands/Show-Application.md) * [Show-Confirm](/appendix/commands/Show-Confirm.md) * [Show-Input](/appendix/commands/Show-Input.md) * [Show-ListView](/appendix/commands/Show-ListView.md) * [Show-ModalDialog](/appendix/commands/Show-ModalDialog.md) * [Show-Result](/appendix/commands/Show-Result.md) * [Show-YesNoCancel](/appendix/commands/Show-YesNoCancel.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Show-Input.md b/appendix/commands/Show-Input.md deleted file mode 100644 index f3320c64..00000000 --- a/appendix/commands/Show-Input.md +++ /dev/null @@ -1,236 +0,0 @@ -# Show-Input - -Shows prompt message box asking user to provide a text string. - -## Syntax - -Show-Input [-Prompt] <String> [-DefaultValue <String>] [-Validation <String>] [-ErrorMessage <String>] [-MaxLength <Int32>] - - -## Detailed Description - -Shows prompt message box asking user to provide a text string. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Prompt  <String> - -Prompt message to show in the message box shown to a user. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -DefaultValue  <String> - -Default value to be provided for the text box. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Validation  <String> - -Regex for value validation. If user enters a value that does not validate - en error message defined with the "ErrorMessage" parameter will be shown and user will be asked to enter the value again. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -ErrorMessage  <String> - -Error message to show when regex validation fails. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -MaxLength  <Int32> - -Maximum length of the string returned. If user enters a longer value - en error message will be shown and user will be asked to enter the value again. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* System.String - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Requests that the user provides an email, validates it against a regular expression snd whows an allert if the format is not valid - -```powershell - -PS master:\> Show-Input "Please provide your email" -DefaultValue "my@email.com" -Validation "^[a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$" -ErrorMessage "Not a proper email!" - -``` - -### 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) - -```powershell - -PS master:\> $contentItem = get-item master:\content -PS master:\> $newName = Show-Input "Please provide the new name for the '$($contentItem.Name)' Item" -DefaultValue $contentItem.Name -Validation "^[\w\*\$][\w\s\-\$]*(\(\d{1,}\)){0,1}$" -ErrorMessage "Invalid characters in the name" - -#print new name -PS master:\> Write-Host "The new name you've chosen is '$($newName)'" - -``` - -### EXAMPLE 3 - -Requests that the user provides a string of at most 5 characters - -```powershell - -Show-Input "Please provide 5 characters at most" -MaxLength 5 - -``` - -## Related Topics - - * [Read-Variable](/appendix/commands/Read-Variable.md) * [Show-Alert](/appendix/commands/Show-Alert.md) * [Show-Application](/appendix/commands/Show-Application.md) * [Show-Confirm](/appendix/commands/Show-Confirm.md) * [Show-FieldEditor](/appendix/commands/Show-FieldEditor.md) * [Show-ListView](/appendix/commands/Show-ListView.md) * [Show-ModalDialog](/appendix/commands/Show-ModalDialog.md) * [Show-Result](/appendix/commands/Show-Result.md) * [Show-YesNoCancel](/appendix/commands/Show-YesNoCancel.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Show-ListView.md b/appendix/commands/Show-ListView.md deleted file mode 100644 index 29499ee1..00000000 --- a/appendix/commands/Show-ListView.md +++ /dev/null @@ -1,592 +0,0 @@ -# Show-ListView - -Sends output to an interactive table in a separate window. - -## Syntax - -Show-ListView [-PageSize <Int32>] [-Modal] [-ActionData <Object>] [-ViewName <String>] [-ActionsInSession] [-Show <None | SharedExport | Filter | PagingAlways | SharedActions | StatusBar | All>] [-InfoTitle <String>] [-InfoDescription <String>] [-MissingDataMessage <String>] [-Icon <String>] -Data <Object> [-Property <Object[]>] [-Title <String>] [-Width <Int32>] [-Height <Int32>] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -PageSize  <Int32> - -Number of results shown per page. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Modal  <SwitchParameter> - -If this parameter is provided Results will show in a new window (in Sitecore 6.x up till Sitecore 7.1) or in a modal overlay (Sitecore 7.2+) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -ActionData  <Object> - -Additional data what will be passed to the view. All actions that are executed from that view window will have that data accessible to them as $actionData variable. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -ViewName  <String> - -View signature name - this can be used by action commands to determine whether to show an action or not using the Show/Enable rules. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -ActionsInSession  <SwitchParameter> - -If this parameter is specified actions will be executed in the same session as the one in which the command is executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Show  <ShowListViewFeatures> - -Shows UI elements selectively in the results dialog --- All - shows all UI elements automatically - default value --- SharedExport - shows export filters that are not specific to this very `-ViewName report (left-most ribbon panel) --- Filter - shows filter panel --- PagingAlways - shows paging when list is shorter than the page specified --- SharedActions - shows actions that are not specific to this very `-ViewName report (right-most ribbon panel) --- StatusBar - shows status bar. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -InfoTitle  <String> - -Title on the panel that appears below the ribbon in the results window. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -InfoDescription  <String> - -Description that appears on the panel below the ribbon in the results window. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -MissingDataMessage  <String> - -If no Items were provided for -Data parameter the message provided in this parameter will be shown in the middle of the List View dialog to notify users of the lack of items to display. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Icon  <String> - -Icon of the result window. (Shows in the top/left corner and on the Sitecore taskbar). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Data  <Object> - -Data to be displayed in the view. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Property  <Object[]> - -Specifies the object properties that appear in the display and the order in which they appear. Type one or more property names (separated by commas), or use a hash table to display a calculated property. - -The value of the Property parameter can be a new calculated property. To create a calculated, property, use a hash table. Valid keys are: --- Name (or Label) <string> --- Expression <string> or <script block> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Title  <String> - -Title of the results window. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Width  <Int32> - -Width of the results window. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Height  <Int32> - -Height of the results window. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* System.Management.Automation.PSObject - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* System.String - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -This command formats information about Sitecore items in a table. The Get-ChildItem command gets objects representing the items. -The pipeline operator (|) passes the object to the Show-ListView command. Show-ListView displays the objects in a table. - -```powershell - -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. - -```powershell - -PS master:\> Get-ItemReferrer -path 'master:\templates\Sample\Sample Item' | - Show-ListView -Property ` - @{Label="Name"; Expression={$_.DisplayName} }, - @{Label="Path"; Expression={$_.Paths.Path} }, - @{Label="Languages"; Expression={$_.Languages | % { $_.Name + ", "} } } - -``` - -## Related Topics - - * [Update-ListView](/appendix/commands/Update-ListView.md) * Out-GridView * Format-Table * [Read-Variable](/appendix/commands/Read-Variable.md) * [Show-Alert](/appendix/commands/Show-Alert.md) * [Show-Application](/appendix/commands/Show-Application.md) * [Show-Confirm](/appendix/commands/Show-Confirm.md) * [Show-FieldEditor](/appendix/commands/Show-FieldEditor.md) * [Show-Input](/appendix/commands/Show-Input.md) * [Show-ModalDialog](/appendix/commands/Show-ModalDialog.md) * [Show-Result](/appendix/commands/Show-Result.md) * [Show-YesNoCancel](/appendix/commands/Show-YesNoCancel.md) * 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/
diff --git a/appendix/commands/Show-ModalDialog.md b/appendix/commands/Show-ModalDialog.md deleted file mode 100644 index cee3c2fa..00000000 --- a/appendix/commands/Show-ModalDialog.md +++ /dev/null @@ -1,288 +0,0 @@ -# Show-ModalDialog - -Shows Sitecore Sheer control as a modal dialog. - -## Syntax - -Show-ModalDialog -Control <String> [-Parameters <Hashtable>] [-HandleParameters <Hashtable>] [-Title <String>] [-Width <Int32>] [-Height <Int32>] - -Show-ModalDialog -Url <String> [-HandleParameters <Hashtable>] [-Title <String>] [-Width <Int32>] [-Height <Int32>] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Control  <String> - -Name of the Sitecore Sheer control to show - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Url  <String> - -A fully formed URL that constitutes a control execution request. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Parameters  <Hashtable> - -Hashtable of parameters to pass to the control in the url. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -HandleParameters  <Hashtable> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Title  <String> - -Title of the control dialog. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Width  <Int32> - -Width of the control dialog. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Height  <Int32> - -Height of the control dialog. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* System.String - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Show-ModalDialog -Control "ConfirmChoice" -Parameters @{btn_0="Yes (returns btn_0)"; btn_1="No (returns btn_1)"; btn_2="return btn_2"; te="Message Text"; cp="My Caption"} -Height 120 -Width 400 - -``` - -## Related Topics - - * [Read-Variable](/appendix/commands/Read-Variable.md) * [Show-Alert](/appendix/commands/Show-Alert.md) * [Show-Application](/appendix/commands/Show-Application.md) * [Show-Confirm](/appendix/commands/Show-Confirm.md) * [Show-FieldEditor](/appendix/commands/Show-FieldEditor.md) * [Show-Input](/appendix/commands/Show-Input.md) * [Show-ListView](/appendix/commands/Show-ListView.md) * [Show-Result](/appendix/commands/Show-Result.md) * [Show-YesNoCancel](/appendix/commands/Show-YesNoCancel.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Show-Result.md b/appendix/commands/Show-Result.md deleted file mode 100644 index bdd1b60d..00000000 --- a/appendix/commands/Show-Result.md +++ /dev/null @@ -1,321 +0,0 @@ -# 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 <String> [-Parameters <String[]>] [-Title <String>] [-Width <Int32>] [-Height <Int32>] - -Show-Result -Url <String> [-Title <String>] [-Width <Int32>] [-Height <Int32>] - -Show-Result [-Text] [-Title <String>] [-Width <Int32>] [-Height <Int32>] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Control  <String> - -Name of the Sheer control to execute. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Url  <String> - -Url to the Sheer control to execute. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Parameters  <String[]> - -Parameters to be passed to the executed control when executing with the -Control parameter specified. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Text  <SwitchParameter> - -Shows the default text dialog. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Title  <String> - -Title of the window containing the control. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Width  <Int32> - -Width of the window containing the control. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Height  <Int32> - -Height of the window containing the control. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* System.String - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Show results of script executio - -```powershell - -PS master:\> Show-Result -Text - -``` - -### EXAMPLE 2 - -Show the Control Panel control in a Window of specified size. - -```powershell - -PS master:\> Show-Result -Control "ControlPanel" -Width 1024 -Height 640 - -``` - -### EXAMPLE 3 - - - -```powershell - -Shows a new instance of ISE -Show-Result -Url "/sitecore/shell/Applications/PowerShell/PowerShellIse" - -``` - -### EXAMPLE 4 - - - -```powershell - - - -``` - -## Related Topics - - * [Read-Variable](/appendix/commands/Read-Variable.md) * [Show-Alert](/appendix/commands/Show-Alert.md) * [Show-Application](/appendix/commands/Show-Application.md) * [Show-Confirm](/appendix/commands/Show-Confirm.md) * [Show-FieldEditor](/appendix/commands/Show-FieldEditor.md) * [Show-Input](/appendix/commands/Show-Input.md) * [Show-ListView](/appendix/commands/Show-ListView.md) * [Show-ModalDialog](/appendix/commands/Show-ModalDialog.md) * [Show-YesNoCancel](/appendix/commands/Show-YesNoCancel.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Show-YesNoCancel.md b/appendix/commands/Show-YesNoCancel.md deleted file mode 100644 index f6c7f778..00000000 --- a/appendix/commands/Show-YesNoCancel.md +++ /dev/null @@ -1,151 +0,0 @@ -# Show-YesNoCancel - -Shows Yes/No/Cancel dialog to the user and returns user choice. - -## Syntax - -Show-YesNoCancel [-Title <String>] [-Width <Int32>] [-Height <Int32>] - - -## Detailed Description - -Shows Yes/No/Cancel dialog to the user and returns user choice as a string value. - -Depending on the user response one of the 2 strings is returned: -- yes -- no -- cancel - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Title  <String> - -Question to ask the user in the dialog - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Width  <Int32> - -Width of the dialog. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Height  <Int32> - -Height of the dialog. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* System.String - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Show-YesNoCancel "Should we delete those 2 items?" - -cancel - -``` - -## Related Topics - - * [Read-Variable](/appendix/commands/Read-Variable.md) * [Show-Alert](/appendix/commands/Show-Alert.md) * [Show-Application](/appendix/commands/Show-Application.md) * [Show-Confirm](/appendix/commands/Show-Confirm.md) * [Show-FieldEditor](/appendix/commands/Show-FieldEditor.md) * [Show-Input](/appendix/commands/Show-Input.md) * [Show-ListView](/appendix/commands/Show-ListView.md) * [Show-ModalDialog](/appendix/commands/Show-ModalDialog.md) * [Show-Result](/appendix/commands/Show-Result.md) * [Show-YesNoCancel](/appendix/commands/Show-YesNoCancel.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Start-ScriptSession.md b/appendix/commands/Start-ScriptSession.md deleted file mode 100644 index 7c584597..00000000 --- a/appendix/commands/Start-ScriptSession.md +++ /dev/null @@ -1,502 +0,0 @@ -# Start-ScriptSession - -Starts a new Script Session and executes a script provided in it. - -## Syntax - -Start-ScriptSession -Id <String[]> -Item <Item> [-JobName <String>] [-ArgumentList <Hashtable>] [-Identity <AccountIdentity>] [-DisableSecurity] [-AutoDispose] [-Interactive] [-ContextItem <Item>] - -Start-ScriptSession -Id <String[]> -ScriptBlock <ScriptBlock> [-JobName <String>] [-ArgumentList <Hashtable>] [-Identity <AccountIdentity>] [-DisableSecurity] [-AutoDispose] [-Interactive] [-ContextItem <Item>] - -Start-ScriptSession -Id <String[]> -Path <String> [-JobName <String>] [-ArgumentList <Hashtable>] [-Identity <AccountIdentity>] [-DisableSecurity] [-AutoDispose] [-Interactive] [-ContextItem <Item>] - -Start-ScriptSession -Session <ScriptSession[]> -Item <Item> [-JobName <String>] [-ArgumentList <Hashtable>] [-Identity <AccountIdentity>] [-DisableSecurity] [-AutoDispose] [-Interactive] [-ContextItem <Item>] - -Start-ScriptSession -Session <ScriptSession[]> -ScriptBlock <ScriptBlock> [-JobName <String>] [-ArgumentList <Hashtable>] [-Identity <AccountIdentity>] [-DisableSecurity] [-AutoDispose] [-Interactive] [-ContextItem <Item>] - -Start-ScriptSession -Session <ScriptSession[]> -Path <String> [-JobName <String>] [-ArgumentList <Hashtable>] [-Identity <AccountIdentity>] [-DisableSecurity] [-AutoDispose] [-Interactive] [-ContextItem <Item>] - -Start-ScriptSession -Item <Item> [-JobName <String>] [-ArgumentList <Hashtable>] [-Identity <AccountIdentity>] [-DisableSecurity] [-AutoDispose] [-Interactive] [-ContextItem <Item>] - -Start-ScriptSession -Path <String> [-JobName <String>] [-ArgumentList <Hashtable>] [-Identity <AccountIdentity>] [-DisableSecurity] [-AutoDispose] [-Interactive] [-ContextItem <Item>] - -Start-ScriptSession -ScriptBlock <ScriptBlock> [-JobName <String>] [-ArgumentList <Hashtable>] [-Identity <AccountIdentity>] [-DisableSecurity] [-AutoDispose] [-Interactive] [-ContextItem <Item>] - - -## Detailed Description - -Starts a new Script Session and executes a script provided in it. -The session can be a background session or if the caller session is interactive providint the -Interactive switch can open a Windowd for the new sessio - -© 2010-2017 Adam Najmanowicz, 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
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Session  <ScriptSession[]> - -Specifies the script session in context of which the script should be executed. Enter a variable that contains the script session or a command that gets the script session. You can also pipe a script session object to Start-ScriptSession. -If the session is busy at the moment of the call - an error will be raised instead of running the script. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -Script item containing the code to be executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the script item containing the code to be executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -ScriptBlock  <ScriptBlock> - -Script to be executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -JobName  <String> - -Name of the Sitecore job that will run the script session. This can be used to monitor the session progress. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -ArgumentList  <Hashtable> - -Hashtable with the additional parameters required by the invoked script. The parameters will be instantiated in the session as variables. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Identity  <AccountIdentity> - -User name including domain in context of which the script will be executed. If no domain is specified - 'sitecore' will be used as the default value. -If user is not specified the current user will be the impersonation context. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -DisableSecurity  <SwitchParameter> - -Add this parameter to disable security in the Job running the script session. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -AutoDispose  <SwitchParameter> - -Providing this parameter will cause the session to be automatically destroyed after it has executed. -Use this parameter if you're not in need of the results of the script execution. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Interactive  <SwitchParameter> - -If the new session is run from an interactive session (e.g. from desktop, menu item, console or ISE) using this parameter will cause dialog to be shown to the user to monitor the script progress. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -ContextItem  <Item> - -Context item for the script session. The script will start in the location of the item. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## 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 - - - -```powershell - -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 - - - -```powershell - -The following starts a script that changes its path to "master:\" and sleeps for 4 seconds. The session will persist in memory as no -AutoDispose parameter has been provided. - -Start-ScriptSession -ScriptBlock { cd master:\; Start-Sleep -Seconds 4 } -Id "Background Task" - -``` - -## Related Topics - - * [Get-ScriptSession](/appendix/commands/Get-ScriptSession.md) * [Receive-ScriptSession](/appendix/commands/Receive-ScriptSession.md) * [Remove-ScriptSession](/appendix/commands/Remove-ScriptSession.md) * [Stop-ScriptSession](/appendix/commands/Stop-ScriptSession.md) * [Wait-ScriptSession](/appendix/commands/Wait-ScriptSession.md) * http://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/
* https://git.io/spe
diff --git a/appendix/commands/Start-TaskSchedule.md b/appendix/commands/Start-TaskSchedule.md deleted file mode 100644 index adfdd552..00000000 --- a/appendix/commands/Start-TaskSchedule.md +++ /dev/null @@ -1,243 +0,0 @@ -# Start-TaskSchedule - -Executes a task schedule. - -## Syntax - -Start-TaskSchedule -Schedule <ScheduleItem> - -Start-TaskSchedule [-Item] <Item> - -Start-TaskSchedule [-Path] <String> - -Start-TaskSchedule -Id <String> [-Database <String>] - - -## Detailed Description - -Executes a task schedule either passed from Get-Schedule, based on Item or Schedule path. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Schedule  <ScheduleItem> - -ScheduleItem most conveniently obtained from Get-Schedule command. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Item  <Item> - -Schedule item - if Item is of wrong template - an appropriate error will be written to teh host. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the schedule item - if item is of wrong template - an appropriate error will be written to teh host. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Tasks.ScheduleItem -Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Tasks.ScheduleItem - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - - - -```powershell - -PS master:\> Start-TaskSchedule -Path "master:/system/Tasks/Schedules/Email Campaign/Clean Message History" - -Name Database Active Auto Remove Is Due Expired Completed Last Run Next Run ----- -------- ------ ----------- ------ ------- --------- -------- -------- -Clean Message History master True False False False False 2014-07-29 16:22:49 2014-07-30 04:52:49 - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\> Get-TaskSchedule -Name "Check Bounced Messages" -Database "master" | Start-TaskSchedule - -Name Database Active Auto Remove Is Due Expired Completed Last Run Next Run ----- -------- ------ ----------- ------ ------- --------- -------- -------- -Check Bounced Messages master True False False False False 2014-07-29 16:21:33 2014-07-30 04:51:33 - -``` - -## Related Topics - - * [Get-TaskSchedule](/appendix/commands/Get-TaskSchedule.md) * https://github.com/SitecorePowerShell/Console/
* https://www.youtube.com/watch?v=N3xgZcU9FqQ&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=9
diff --git a/appendix/commands/Stop-ScriptSession.md b/appendix/commands/Stop-ScriptSession.md deleted file mode 100644 index 9880e938..00000000 --- a/appendix/commands/Stop-ScriptSession.md +++ /dev/null @@ -1,122 +0,0 @@ -# Stop-ScriptSession - -Stops executing script session. - -## Syntax - -Stop-ScriptSession -Id <String[]> - -Stop-ScriptSession -Session <ScriptSession[]> - - -## Detailed Description - -Aborts the pipeline of a session that is executing. This will stop the session immediately in its next PowerShell command. -Caution! If your script is running a long operation in the .net code rather than in PowerShell - the session will abort after the code has finished and the control was returned to the script. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Id  <String[]> - -Stops the script session with the specified IDs. -The ID is a string that uniquely identifies the script session within the server. You can type one or more IDs (separated by commas). To find the ID of a script session, type "Get-ScriptSession" without parameters. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Session  <ScriptSession[]> - -Specifies the script session to be stopped. Enter a variable that contains the script session or a command that gets the script session. You can also pipe a script session object to Receive-ScriptSession. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -## 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 - - - -```powershell - -The following stops the script session with the specified Id. - -PS master:\> Stop-ScriptSession -Id "My Background Script Session" - -``` - -## Related Topics - - * [Get-ScriptSession](/appendix/commands/Get-ScriptSession.md) * [Receive-ScriptSession](/appendix/commands/Receive-ScriptSession.md) * [Remove-ScriptSession](/appendix/commands/Remove-ScriptSession.md) * [Start-ScriptSession](/appendix/commands/Start-ScriptSession.md) * [Wait-ScriptSession](/appendix/commands/Wait-ScriptSession.md) * http://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/
* https://git.io/spe
diff --git a/appendix/commands/Stop-SearchIndex.md b/appendix/commands/Stop-SearchIndex.md deleted file mode 100644 index a367b24a..00000000 --- a/appendix/commands/Stop-SearchIndex.md +++ /dev/null @@ -1,134 +0,0 @@ -# Stop-SearchIndex - -Stops the Sitecore index. - -## Syntax - -Stop-SearchIndex -Index <ISearchIndex> - -Stop-SearchIndex [-Name <String>] - -Stop-SearchIndex [-Name <String>] - - -## Detailed Description - -The Stop-SearchIndex command stops the Sitecore index. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Index  <ISearchIndex> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Name  <String> - -The name of the index to stop. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.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 - -### EXAMPLE 1 - - - -```powershell - -The following stops the indexing process from running. - -PS master:\> Stop-SearchIndex -Name sitecore_master_index - -``` - -### EXAMPLE 2 - - - -```powershell - -The following stops the indexing process from running. - -PS master:\> Get-SearchIndex -Name sitecore_master_index | Stop-SearchIndex - -``` - -## Related Topics - - * [Initialize-SearchIndex](/appendix/commands/Initialize-SearchIndex.md) * [Suspend-SearchIndex](/appendix/commands/Suspend-SearchIndex.md) * [Resume-SearchIndex](/appendix/commands/Resume-SearchIndex.md) * [Get-SearchIndex](/appendix/commands/Get-SearchIndex.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Suspend-SearchIndex.md b/appendix/commands/Suspend-SearchIndex.md deleted file mode 100644 index acebdbf0..00000000 --- a/appendix/commands/Suspend-SearchIndex.md +++ /dev/null @@ -1,134 +0,0 @@ -# Suspend-SearchIndex - -Suspends (pauses) the Sitecore index. - -## Syntax - -Suspend-SearchIndex -Index <ISearchIndex> - -Suspend-SearchIndex [-Name <String>] - -Suspend-SearchIndex [-Name <String>] - - -## Detailed Description - -The Suspend-SearchIndex command suspends (pauses) the Sitecore index. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Index  <ISearchIndex> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Name  <String> - -The name of the index to suspend (pause). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.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 - -### EXAMPLE 1 - - - -```powershell - -The following suspends (pauses) the indexing process from running. - -PS master:\> Suspend-SearchIndex -Name sitecore_master_index - -``` - -### EXAMPLE 2 - - - -```powershell - -The following suspends (pauses) the indexing process from running. - -PS master:\> Get-SearchIndex -Name sitecore_master_index | Suspend-SearchIndex - -``` - -## Related Topics - - * [Initialize-SearchIndex](/appendix/commands/Initialize-SearchIndex.md) * [Stop-SearchIndex](/appendix/commands/Stop-SearchIndex.md) * [Resume-SearchIndex](/appendix/commands/Resume-SearchIndex.md) * [Get-SearchIndex](/appendix/commands/Get-SearchIndex.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Test-Account.md b/appendix/commands/Test-Account.md deleted file mode 100644 index df5b76c3..00000000 --- a/appendix/commands/Test-Account.md +++ /dev/null @@ -1,122 +0,0 @@ -# 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <AccountIdentity> - -Role or User name including domain. If no domain is specified - 'sitecore' will be used as the default value - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -AccountType  <String> - -Specifies which account to check existence. - -- All -- Role -- User - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -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 - - - -```powershell - -PS master:\> Test-Account -Identity Michael - -True - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Test-BaseTemplate.md b/appendix/commands/Test-BaseTemplate.md deleted file mode 100644 index fe12bbf1..00000000 --- a/appendix/commands/Test-BaseTemplate.md +++ /dev/null @@ -1,234 +0,0 @@ -# Test-BaseTemplate - - - -## Syntax - -Test-BaseTemplate -Item <Item> -TemplateItem <TemplateItem[]> - -Test-BaseTemplate -Item <Item> -Template <String[]> - -Test-BaseTemplate -Path <String> -TemplateItem <TemplateItem[]> - -Test-BaseTemplate -Path <String> -Template <String[]> - -Test-BaseTemplate -Id <String> -TemplateItem <TemplateItem[]> - -Test-BaseTemplate -Id <String> -Template <String[]> - -Test-BaseTemplate [-Database <String>] - - -## Detailed Description - - - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Item  <Item> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Path  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -TemplateItem  <TemplateItem[]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Template  <String[]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- - diff --git a/appendix/commands/Test-ItemAcl.md b/appendix/commands/Test-ItemAcl.md deleted file mode 100644 index 29444622..00000000 --- a/appendix/commands/Test-ItemAcl.md +++ /dev/null @@ -1,303 +0,0 @@ -# Test-ItemAcl - -Tests a specific access right for a specified user against the provided item - -## Syntax - -Test-ItemAcl -Item <Item> - -Test-ItemAcl -Item <Item> -AccessRight <String> -Identity <AccountIdentity> - -Test-ItemAcl -Path <String> - -Test-ItemAcl -Path <String> -AccessRight <String> -Identity <AccountIdentity> - -Test-ItemAcl -Id <String> - -Test-ItemAcl -Id <String> [-Database <String>] -AccessRight <String> -Identity <AccountIdentity> - - -## Detailed Description - -Checks if a user can perform an operation on an item. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Item  <Item> - -The item to be tested against. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be tested against. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be tested against. Requires the Database parameter to be specified. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be fetched with Id parameter. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -AccessRight  <String> - -The access right to grand or deny. -Well known rights are: -- field:read - "Field Read" - controls whether an account can read a specific field on an item.. -- field:write - "Field Write" - controls whether an account can update a specific field on an item. - -- item:read - "Read" - controls whether an account can see an item in the content tree and/or on the published Web site, including all of its properties and field values. -- item:write - "Write" - controls whether an account can update field values. The write access right requires the read access right and field read and field write access rights for individual fields (field read and field write are allowed by default). -- item:rename - "Rename" - controls whether an account can change the name of an item. The rename access right requires the read access right. -- item:create - "Create" - controls whether an account can create child items. The create access right requires the read access right. -- item:delete - "Delete" - Delete right for items. controls whether an account can delete an item. The delete access right requires the read access right - Important! -The Delete command also deletes all child items, even if the account has been denied Delete -rights for one or more of the subitems. -- item:admin - "Administer" - controls whether an account can configure access rights on an item. The administer access right requires the read and write access rights. -- language:read - "Language Read" - controls whether a user can read a specific language version of items. -- language:write - "Language Write" - controls whether a user can update a specific language version of items. -- site:enter - controls whether a user can access a specific site. -- insert:show - "Show in Insert" - Determines if the user can see the insert option -- workflowState:delete - "Workflow State Delete" - controls whether a user can delete items which are currently associated with a specific workflow state. -- workflowState:write - "Workflow State Write" - controls whether a user can update items which are currently associated with a specific workflow state. -- workflowCommand:execute - "Workflow Command Execute" - — controls whether a user is shown specific workflow commands. -- profile:customize - "Customize Profile Key Values" - The right to input out of range values of profile keys, that belong to this profile. -- bucket:makebucket - "Create Bucket" - convert item to bucket. -- bucket:unmake - "Revert Bucket" - convert item back from bucket. -- remote:fieldread - "Field Remote Read" - Field Read right for remoted clients. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Identity  <AccountIdentity> - -User name including domain for which the access rule is being created. If no domain is specified - 'sitecore' will be used as the default domain. - -Specifies the Sitecore user by providing one of the following values. - - Local Name - Example: adam - Fully Qualified Name - Example: sitecore\adam - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## 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. - -```powershell - -PS master:\> $acl = New-ItemAcl -AccessRight item:rename -PropagationType Descendants -SecurityPermission AllowAccess -Identity "sitecore\author2" -PS master:\> Get-Item -Path master:\content\home | Set-ItemAcl -AccessRules $acl - -# Assuming the Home item has one child and author2 does not have rename rights granted above in the tree and is not an administrator -PS master:\> Get-Item master:\content\home | Test-ItemAcl -Identity "sitecore\author2" -AccessRight item:rename -False - -PS master:\> Get-ChildItem master:\content\home | Test-ItemAcl -Identity "sitecore\author2" -AccessRight item:rename -True - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Add-ItemAcl](/appendix/commands/Add-ItemAcl.md) * [Clear-ItemAcl](/appendix/commands/Clear-ItemAcl.md) * [Get-ItemAcl](/appendix/commands/Get-ItemAcl.md) * [New-ItemAcl](/appendix/commands/New-ItemAcl.md) * [Set-ItemAcl](/appendix/commands/Set-ItemAcl.md) * 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/
diff --git a/appendix/commands/Test-Rule.md b/appendix/commands/Test-Rule.md deleted file mode 100644 index aa38c7a6..00000000 --- a/appendix/commands/Test-Rule.md +++ /dev/null @@ -1,181 +0,0 @@ -# Test-Rule - -Tests item against a sitecore serialized rules engine rule set. - -## Syntax - -Test-Rule [-Rule <String>] [-InputObject <PSObject>] [-RuleDatabase <String>] - - -## Detailed Description - -Tests item or a stream of items against a sitecore serialized rules engine rule set. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Rule  <String> - -Serialized sitecore rules engine rule. Such rules can be read from rule fields or created by user with the Read-Variable cmdlet. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -InputObject  <PSObject> - -Item to be tested - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -RuleDatabase  <String> - -Name of the database from which rules are pulled. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* System.Boolea - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Specifies a rule as "items that have layout" and runs the rule againste all items under the ome Item - -```powershell - -$rule = ' - - - - - -' - -Get-ChildItem master:\content\Home -Recurse | ? { Test-Rule -InputObject $_ -Rule $rule -RuleDatabase master} - -``` - -### EXAMPLE 2 - -Asks user for the rule and root under which items should be filtered, and lists all items fulfilling the rule under the selected path - -```powershell - -$rule = '' -$root = Get-Item master:\content\home\ - -$result = Read-Variable -Parameters ` -@{Name="root"; title="Items under"; Tooltip="Items under the selected item will be considered for evaluation"}, ` -@{Name="rule"; Editor="rule"; title="Filter rules"; Tooltip="Only items conforming to this rule will be displayed."} ` --Description "This dialog shows editor how a rule can be taken from an item and edited using the Read-Variable cmdlet." ` --Title "Sample rule editing" -Width 600 -Height 600 -ShowHints - -if($result -eq "cancel"){ -exit; -} - -Get-ChildItem $root.ProviderPath | ? { Test-Rule -InputObject $_ -Rule $rule -RuleDatabase master} - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Unlock-Item.md b/appendix/commands/Unlock-Item.md deleted file mode 100644 index de162bc8..00000000 --- a/appendix/commands/Unlock-Item.md +++ /dev/null @@ -1,236 +0,0 @@ -# Unlock-Item - -Unlocks the specified Sitecore item. - -## Syntax - -Unlock-Item [-Item] <Item> [-PassThru] - -Unlock-Item [-Path] <String> [-PassThru] - -Unlock-Item -Id <String> [-Database <String>] [-PassThru] - - -## Detailed Description - -The Unlock-Item command unlocks the item specified with parameters. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -PassThru  <SwitchParameter> - -Passes the unlocked item back into the pipeline. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be unlocked. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be unlocked - can work with Language parameter to specify the language other than current session language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be unlocked. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be fetched with Id parameter. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* can be piped from another cmdlet* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Only if -PassThru is used* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Unlock the Home item providing its path - -```powershell - -PS master:\> Unlock-Item -Path master:\content\home - -``` - -### EXAMPLE 2 - -Unlock the Home item providing it from the pipeline and passing it back to the pipeline - -```powershell - -PS master:\> Get-Item -Path master:\content\home | Unlock-Item -PassThru - -Name Children Languages Id TemplateName ----- -------- --------- -- ------------ -Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Lock-Item](/appendix/commands/Lock-Item.md) * Get-Item diff --git a/appendix/commands/Unlock-User.md b/appendix/commands/Unlock-User.md deleted file mode 100644 index 4aec3d2c..00000000 --- a/appendix/commands/Unlock-User.md +++ /dev/null @@ -1,135 +0,0 @@ -# Unlock-User - -Unlocks a Sitecore user using the specified criteria. - -## Syntax - -Unlock-User [-Identity] <AccountIdentity> - -Unlock-User -Instance <User> - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Identity  <AccountIdentity> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Instance  <User> - -Specifies the Sitecore user by providing an instance of a user. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* System.String -Represents the identity of a user. - -Sitecore.Security.Accounts.User -One or more user instances. - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* None. - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - - - -```powershell - -PS master:\> Unlock-User -Identity michael - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\> Get-User -Filter * | Unlock-User - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Get-User](/appendix/commands/Get-User.md) * [New-User](/appendix/commands/New-User.md) * [Remove-User](/appendix/commands/Remove-User.md) * [Set-User](/appendix/commands/Set-User.md) diff --git a/appendix/commands/Unprotect-Item.md b/appendix/commands/Unprotect-Item.md deleted file mode 100644 index 8f5b70d9..00000000 --- a/appendix/commands/Unprotect-Item.md +++ /dev/null @@ -1,236 +0,0 @@ -# Unprotect-Item - -Unprotects the specified Sitecore item. - -## Syntax - -Unprotect-Item [-Item] <Item> [-PassThru] - -Unprotect-Item [-Path] <String> [-PassThru] - -Unprotect-Item -Id <String> [-Database <String>] [-PassThru] - - -## Detailed Description - -The Unprotect-Item command removes protection from the item provided to it. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -PassThru  <SwitchParameter> - -Passes the unprotected item back into the pipeline. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be unprotected. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be unprotected - can work with Language parameter to specify the language other than current session language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be unprotected. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be fetched with Id parameter. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* can be piped from another cmdlet* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Only if -PassThru is used* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -Unprotect the Home item providing its path - -```powershell - -PS master:\> Unprotect-Item -Path master:\content\home - -``` - -### EXAMPLE 2 - -Unprotect the Home item providing it from the pipeline and passing it back to the pipeline - -```powershell - -PS master:\> Get-Item -Path master:\content\home | Unprotect-Item -PassThru - -Name Children Languages Id TemplateName ----- -------- --------- -- ------------ -Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Protect-Item](/appendix/commands/Protect-Item.md) * Get-Item diff --git a/appendix/commands/Update-ItemReferrer.md b/appendix/commands/Update-ItemReferrer.md deleted file mode 100644 index 8647780d..00000000 --- a/appendix/commands/Update-ItemReferrer.md +++ /dev/null @@ -1,424 +0,0 @@ -# Update-ItemReferrer - -Updates references to specified item to point to a new provided in the -NewTarget ore removes links to the item. - -## Syntax - -Update-ItemReferrer [-Link] <ItemLink> [-NewTarget] <Item> - -Update-ItemReferrer [-Link] <ItemLink> -RemoveLink - -Update-ItemReferrer [-NewTarget] <Item> [-Item] <Item> - -Update-ItemReferrer -NewTarget <Item> -Path <String> [-Language <String[]>] - -Update-ItemReferrer -NewTarget <Item> -Id <String> [-Database <String>] [-Language <String[]>] - -Update-ItemReferrer -RemoveLink [-Item] <Item> - -Update-ItemReferrer -RemoveLink -Path <String> [-Language <String[]>] - -Update-ItemReferrer -RemoveLink -Id <String> [-Database <String>] [-Language <String[]>] - - -## Detailed Description - -The cmdlet manipulates link to a specific item. The target item can be provided as an Item object or through Path/ID. -it does not modifies the item itself but rather other items that link to it. -If the -RemoveLink parameter is used the link will be removed rather than modified. -To deliver more fine grained filtering you can provide ItemLink using the -Link parameter. You can obtain ItemLinks using Get-ItemReferrer or Get-ItemReference cmdlets. -Consult Examples for specific use cases of each approach. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Link  <ItemLink> - -ItemLink retrieved from the Link database. Use this parameter to do more granular filtering. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -NewTarget  <Item> - -New item the links should be pointing to - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?2
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -RemoveLink  <SwitchParameter> - -If provided, removes all links to the current target item. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The current item to be relinked. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the current item to be relinked - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the current item to be relinked - can work with Language parameter to specify the language other than current session language. Requires the Database parameter to be specified. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the current item to be relinked. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - -If you need the current item to be relinked in specific Language You can specify it with this parameter. Globbing/wildcard supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - -This example covers global operations - -Assuming Sitecore PowerShell Extensions 4.2 or newer is installed -Assuming your Home has an "Image" field of type "Image" -Assuming you have second item next to Home called Home2 that has an "Image" field of type "Image" - -```powershell - -$coverImage = Get-Item 'master:\media library\Default Website\cover' -$scLogoImage = Get-item 'master:\media library\Default Website\sc_logo' - -Write-Host "`nReset 'home', 'child' and 'home2' to link to 'cover'- 3 items" -Foreground Magenta -(Get-item master:\content\home).Image = $coverImage -(Get-item master:\content\Home\child).Image = $coverImage -(Get-item master:\content\home2).Image = $coverImage - -Get-ItemReferrer -Item $coverImage - -Write-Host "`nRelinking all instances of 'cover' image to 'sc_logo'" -Foreground Yellow -$coverImage | Update-ItemReferrer -NewTarget $scLogoImage - -Write-Host "`n'cover' should no longer have links leading to it - 0 items " -Foreground Red -$coverImage | Get-ItemReferrer - -Write-Host "`n'sc_logo' should now be linked from all - 3 items" -Foreground Green -$scLogoImage | Get-ItemReferrer - -Write-Host "`nRemoving links to 'sc_logo' from all items" -Foreground Yellow -$scLogoImage | Update-ItemReferrer -RemoveLink - -Write-Host "`n'sc_logo' should have no links to it - 0 items" -Foreground Red -$scLogoImage | Get-ItemReferrer - -``` - -### EXAMPLE 2 - -This example covers more fine-grained filtered approach to removing links - -Assuming Sitecore PowerShell Extensions 4.2 or newer is installed -Assuming your Home has an "Image" field of type "Image" -Assuming you have second item next to Home called Home2 that has an "Image" field of type "Image" - -```powershell - -$coverImage = Get-Item 'master:\media library\Default Website\cover' -$scLogoImage = Get-item 'master:\media library\Default Website\sc_logo' - -Write-Host "`nReset 'home', 'child' and 'home2' to link to 'cover'- 3 items" -Foreground Magenta -(Get-item master:\content\home).Image = $coverImage -(Get-item master:\content\Home\child).Image = $coverImage -(Get-item master:\content\home2).Image = $coverImage - -Get-ItemReferrer -Item $coverImage - -Write-Host "`nRemove links to the 'cover' image from all items under 'master:\content\home'" -Foreground Yellow -Get-ChildItem master:\content\home -WithParent -Recurse | # get items under home - Get-ItemReference -ItemLink | # get all items that they are refering to - ? { $_.TargetItemID -eq $coverImage.ID } | # filter only references to $coverImage - Update-ItemReferrer -RemoveLink # remove links - -Write-Host "`n'cover' should have 1 link leading from 'home2'" -Foreground Green -$coverImage | Get-ItemReferrer - -``` - -### EXAMPLE 3 - -This example covers more fine-grained filtered approach to removing links - -Assuming Sitecore PowerShell Extensions 4.2 or newer is installed -Assuming your Home has an "Image" field of type "Image" -Assuming you have second item next to Home called Home2 that has an "Image" field of type "Image" - -```powershell - -$coverImage = Get-Item 'master:\media library\Default Website\cover' -$scLogoImage = Get-item 'master:\media library\Default Website\sc_logo' - -Write-Host "`nReset 'home', 'child' and 'home2' to link to 'cover'- 3 items" -Foreground Magenta -(Get-item master:\content\home).Image = $coverImage -(Get-item master:\content\Home\child).Image = $coverImage -(Get-item master:\content\home2).Image = $coverImage - -Get-ItemReferrer -Item $coverImage - -Write-Host "`nUpdate all links to 'cover' image to point to 'sc_logo' from all immediate children of /sitecore/content" -Foreground Yellow -Get-ChildItem master:\content | # get items immediately under 'under home'content' - Get-ItemReference -ItemLink | # get all items that they are refering to - ? { $_.TargetItemID -eq $coverImage.ID } | # filter only references to $coverImage - Update-ItemReferrer -NewTarget $scLogoImage # point them to 'sc_logo' image - -Write-Host "`n'cover' should have link from home2/child - 1 item" -Foreground Green -$coverImage | Get-ItemReferrer - -Write-Host "`n'sc_logo' should have links leading from 'home' and 'home2' - 2 items" -Foreground Green -$scLogoImage | Get-ItemReferrer - -``` - -## Related Topics - - * [Get-ItemReferrer](/appendix/commands/Get-ItemReferrer.md) * [Get-ItemReference](/appendix/commands/Get-ItemReference.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Update-ListView.md b/appendix/commands/Update-ListView.md deleted file mode 100644 index e438a7ff..00000000 --- a/appendix/commands/Update-ListView.md +++ /dev/null @@ -1,283 +0,0 @@ -# Update-ListView - -Updates List View (created by Show-ListView) data. - -## Syntax - -Update-ListView [-InfoTitle <String>] [-InfoDescription <String>] [-MissingDataMessage <String>] [-Icon <String>] -Data <Object> [-Property <Object[]>] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -InfoTitle  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -InfoDescription  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -MissingDataMessage  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Icon  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Data  <Object> - -Data that you want to be sent to the list view for display. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Property  <Object[]> - -If this parameter is specified - it allows for modifying the columns shown in the list view, otherwise the columns stay the same as in the original view. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## 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. - -```powershell - -# THE INITIAL SCRIPT showing the list of tasks in a list view -# This script does not yet make use of Update-ListView but tests the state for actions to be performed - -Import-Function "Edit-TaskSchedule" - -# Get all the items recursively where the TemplateName equals "Schedule". -Get-ChildItem -Path master:\system\Tasks\Schedules -Recurse | Where-Object { $_.TemplateName -eq "Schedule" } | - Show-ListView -Property @{Label="Name"; Expression={ $_.DisplayName } }, - @{Label="Last Run"; Expression={ $_."Last Run" } }, - @{Label="Command"; Expression={ $_.Database.GetItem($_.Command).Name } }, - @{Label="From"; Expression={ Parse-TaskSchedule $_ "from"} }, - @{Label="To"; Expression={ Parse-TaskSchedule $_ "to"} }, - @{Label="On Week Days"; Expression={ Parse-TaskSchedule $_ "strWeekdays" } }, - @{Label="Run Every"; Expression={ Parse-TaskSchedule $_ "interval" } } ` - -Title "Task Manager" -Close-Window - - - -# NOW THE PROPER ACTION SCRIPT - -# The Execute task action that (at the very end) updates the list with the latest tasks data -foreach($sheduleItem in $resultSet) -{ - $shedule = New-Object -TypeName "Sitecore.Tasks.ScheduleItem" -ArgumentList $sheduleItem - $shedule.Execute(); -} -Import-Function "Edit-TaskSchedule" -Get-ChildItem -Path master:\system\Tasks\Schedules -Recurse | Where-Object { $_.TemplateName -eq "Schedule" } | Update-ListView - -``` - -## Related Topics - - * [Show-ListView](/appendix/commands/Show-ListView.md) * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/commands/Wait-ScriptSession.md b/appendix/commands/Wait-ScriptSession.md deleted file mode 100644 index 43631f55..00000000 --- a/appendix/commands/Wait-ScriptSession.md +++ /dev/null @@ -1,188 +0,0 @@ -# Wait-ScriptSession - -Suppresses script execution command prompt until one or all of the script sessions provided are complete. - -## Syntax - -Wait-ScriptSession -Id <String[]> [-Timeout <Int32>] [-Any] - -Wait-ScriptSession -Session <ScriptSession[]> [-Timeout <Int32>] [-Any] - - -## Detailed Description - -The Wait-ScriptSession cmdlet waits for script session to complete before it displays the command prompt or allows the script to continue. You can wait until any script session is complete, or until all script sessions are complete, and you can set a maximum wait time for the script session. -When the commands in the script session are complete, Wait-ScriptSession displays the command prompt and returns a script session object so that you can pipe it to another command. -You can use Wait-ScriptSession cmdlet to wait for script sessions, such as those that were started by using the Start-ScriptSession cmdlet. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Timeout  <Int32> - -The maximum time to wait for all the other running script sessions to complete. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Any  <SwitchParameter> - -Returns control to the script or displays the command prompt (and returns the ScriptSession object) when any script session completes. By default, Wait-ScriptSession waits until all of the specified jobs are complete before displaying the prompt. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String[]> - -Id(s) of the session to be stopped. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Session  <ScriptSession[]> - -Session(s) to be stopped. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* System.String or Cognifide.PowerShell.Core.Host.ScriptSessio - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Cognifide.PowerShell.Core.Host.ScriptSessio - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Wait-ScriptSession -Id "My Background Script Session" - -``` - -## Related Topics - - * [Get-ScriptSession](/appendix/commands/Get-ScriptSession.md) * [Receive-ScriptSession](/appendix/commands/Receive-ScriptSession.md) * [Remove-ScriptSession](/appendix/commands/Remove-ScriptSession.md) * [Start-ScriptSession](/appendix/commands/Start-ScriptSession.md) * [Stop-ScriptSession](/appendix/commands/Stop-ScriptSession.md) * http://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/
* https://git.io/spe
diff --git a/appendix/commands/Write-Log.md b/appendix/commands/Write-Log.md deleted file mode 100644 index e4c1a9a6..00000000 --- a/appendix/commands/Write-Log.md +++ /dev/null @@ -1,151 +0,0 @@ -# Write-Log - -Writes text to the Sitecore event log. - -## Syntax - -Write-Log [[-Object] <Object>] [-Separator <Object>] [-Log <Debug | Info | Warning | Error | Fatal | None>] - - -## Detailed Description - -The Write-Log command writes text to the Sitecore event log with the specified logging level. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Object  <Object> - -Specifies the object to write to the log. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Separator  <Object> - -Strings the output together with the specified text. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Log  <LogNotificationLevel> - -Specifies the Sitecore logging level. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* System.String -Represents the identity of a role. - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* None. - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> Write-Log "Information." - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
diff --git a/appendix/common.md b/appendix/common/README.md similarity index 83% rename from appendix/common.md rename to appendix/common/README.md index 254ac011..19cc38e7 100644 --- a/appendix/common.md +++ b/appendix/common/README.md @@ -1,2 +1,4 @@ # Common + + diff --git a/appendix/common/add-basetemplate.md b/appendix/common/add-basetemplate.md new file mode 100644 index 00000000..b0db9607 --- /dev/null +++ b/appendix/common/add-basetemplate.md @@ -0,0 +1,137 @@ +# Add-BaseTemplate + +Add one or more base templates to a template item. + +## Syntax + +Add-BaseTemplate -Item <Item> -TemplateItem <TemplateItem\[\]> + +Add-BaseTemplate -Item <Item> -Template <String\[\]> + +Add-BaseTemplate -Path <String> -TemplateItem <TemplateItem\[\]> + +Add-BaseTemplate -Path <String> -Template <String\[\]> + +Add-BaseTemplate -Id <String> -TemplateItem <TemplateItem\[\]> + +Add-BaseTemplate -Id <String> -Template <String\[\]> + +Add-BaseTemplate \[-Database <String>\] + +## Detailed Description + +The Add-BaseTemplate command adds one or more base templates to a template item. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Item <Item> + +The item to add the base template to. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to add the base template to. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to add the base template to. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -TemplateItem <TemplateItem\[\]> + +Sitecore item or list of items of base templates to add. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Template <String\[\]> + +Path representing the template item to add as a base template. This must be of the same database as the item to be altered. Note that this parameter only supports a single template. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to add the base template to - required if item is specified with Id. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West, Alex Washtell + +## Examples + +### EXAMPLE 1 + +Add base template of /sitecore/templates/User Defined/BaseTemplate to a template, using a path. + +```powershell +PS master:\> Add-BaseTemplate -Path "master:/sitecore/content/User Defined/Page" -Template "/sitecore/templates/User Defined/BaseTemplate" +``` + +### EXAMPLE 2 + +Add multiple base templates to a template, using items. + +```powershell +PS master:\> $baseA = Get-Item -Path master:/sitecore/content/User Defined/BaseTemplateA + PS master:\> $baseB = Get-Item -Path master:/sitecore/content/User Defined/BaseTemplateB + PS master:\> Add-BaseTemplate -Path "master:/sitecore/content/User Defined/Page" -TemplateItem @($baseA, $baseB) +``` + +## Related Topics + +* [Remove-BaseTemplate](remove-basetemplate.md) +* [Get-ItemTemplate](get-itemtemplate.md) +* [Set-ItemTemplate](set-itemtemplate.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/add-itemversion.md b/appendix/common/add-itemversion.md new file mode 100644 index 00000000..a4007a18 --- /dev/null +++ b/appendix/common/add-itemversion.md @@ -0,0 +1,231 @@ +# Add-ItemVersion + +Creates a version of the item in a new language based on an existing language version. + +## Syntax + +```powershell +Add-ItemVersion [-Item] [-Recurse] [-IfExist ] [-TargetLanguage ] [-DoNotCopyFields] [-IgnoredFields ] [-Language ] + +Add-ItemVersion [-Path] [-Recurse] [-IfExist ] [-TargetLanguage ] [-DoNotCopyFields] [-IgnoredFields ] [-Language ] + +Add-ItemVersion -Id [-Database ] [-Recurse] [-IfExist ] [-TargetLanguage ] [-DoNotCopyFields] [-IgnoredFields ] [-Language ] +``` + +## Detailed Description + +Creates a new version of the item in a specified 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-2020 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Aliases + +The following abbreviations are aliases for this cmdlet: + +* Add-ItemLanguage + +## Parameters + +### -Recurse <SwitchParameter> + +Process the item and all of its children. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -IfExist <ActionIfExists> + +Default value is Append. Accepts one of 3 values: + +* Append - \[Default\] if language version exists create a new version with values copied from the original language +* Skip - if language version exists don't do anything +* OverwriteLatest - if language version exists overwrite the last version with values copied from the original language + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -IfNoSourceVersion <ActionIfNoVersion> + +Default value is Skip. Accepts one of 2 values: + +* Skip - \[Default\] if the source item has no versions don't do anything +* Add - if the source item has no versions create a version without any copied values + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -TargetLanguage <String\[\]> + +Language or a list of languages that should be created + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -DoNotCopyFields <SwitchParameter> + +Creates a new version in the target language but does not copy field values from the original language + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -IgnoredFields <String\[\]> + +List of fields that should not be copied over from original item. As an example, use "\_\_Security" if you don't want the new version to have the same restrictions as the original version. + +In addition to the fields in -IgnoredFields the following fields are ignored as configured in Spe.config file in the following location: configuration/sitecore/powershell/translation/ignoredFields. + +Fields ignored out of the box include: + +* \_\_Archive date +* \_\_Archive Version date +* \_\_Lock +* \_\_Owner +* \_\_Page Level Test Set Definition +* \_\_Reminder date +* \_\_Reminder recipients +* \_\_Reminder text + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +Language that will be used as source language. If not specified the current user language will be used. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item / version to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be processed - additionally specify Language parameter to fetch different item language than the current user language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be processed - additionally specify Language parameter to fetch different item language than the current user language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Translate the Home Item from English to US and Polish leaving the "Title" field blank. If a version exists don't do anything + +```powershell +PS master:\> Add-ItemVersion -Path "master:\content\home" -Language "en" -TargetLanguage "pl-pl", "en-us" -IfExist Skip -IgnoredFields "Title" +``` + +### EXAMPLE 2 + +```powershell +Add a Japanese version to /sitecore/content/home item in the master database based on itself +PS master:\> Add-ItemVersion -Path "master:\content\home" -Language ja-JP -IfExist Append +``` + +### EXAMPLE 3 + +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. + +```powershell +Get-ChildItem "master:\content\home" -Language "en" -Recurse | ` + Where-Object { $_.TemplateName -eq "Sample Item" } | ` + Add-ItemVersion -TargetLanguage "pl-pl" -IfExist Append | ` + Format-Table Name, Language, Version -auto +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Remove-ItemVersion](remove-itemversion.md) +* New-Item +* [https://gist.github.com/AdamNaj/b36ea095e3668c22c07e](https://gist.github.com/AdamNaj/b36ea095e3668c22c07e) + diff --git a/appendix/common/close-window.md b/appendix/common/close-window.md new file mode 100644 index 00000000..78380c07 --- /dev/null +++ b/appendix/common/close-window.md @@ -0,0 +1,32 @@ +# Close-Window + +Closes the runner job window after the script completes. + +## Syntax + +Close-Window + +## Detailed Description + +Ensures the runner process window is closed after the script finishes execution. This is commonly used when the runner should close after a report runs while in the Desktop mode. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> Close-Window +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/convertfrom-clixml.md b/appendix/common/convertfrom-clixml.md new file mode 100644 index 00000000..3421cff5 --- /dev/null +++ b/appendix/common/convertfrom-clixml.md @@ -0,0 +1,67 @@ +# ConvertFrom-CliXml + +Imports a CliXml string with data that represents Microsoft .NET objects and creates the objects within PowerShell. + +## Syntax + +ConvertFrom-CliXml \[-InputObject\] <String> + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -InputObject <String> + +String containing the Xml with serialized objects. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.String + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* object + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> #Convert original item to xml +PS master:\> $myCliXmlItem = Get-Item -Path master:\content\home | ConvertTo-CliXml +PS master:\> #print the CliXml +PS master:\> $myCliXmlItem +PS master:\> #print the Item converted back from CliXml +PS master:\> $myCliXmlItem | ConvertFrom-CliXml +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [ConvertTo-CliXml](convertto-clixml.md) +* ConvertTo-Xml +* ConvertFrom-Xml +* Export-CliXml +* Import-CliXml +* [https://github.com/SitecorePowerShell/Console/issues/218](https://github.com/SitecorePowerShell/Console/issues/218) + diff --git a/appendix/common/convertfrom-itemclone.md b/appendix/common/convertfrom-itemclone.md new file mode 100644 index 00000000..03ec6767 --- /dev/null +++ b/appendix/common/convertfrom-itemclone.md @@ -0,0 +1,118 @@ +# ConvertFrom-ItemClone + +Converts an item from a clone to a fully independent item. + +## Syntax + +ConvertFrom-ItemClone \[-Item\] <Item> \[-Recurse\] \[-PassThru\] + +ConvertFrom-ItemClone \[-Path\] <String> \[-Recurse\] \[-PassThru\] + +ConvertFrom-ItemClone -Id <String> \[-Database <String>\] \[-Recurse\] \[-PassThru\] + +## Detailed Description + +Converts an item from a clone to a fully independent item. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Recurse <SwitchParameter> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -PassThru <SwitchParameter> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be converted. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be converted + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be converted + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be converted + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> ConvertFrom-ItemClone -Path master:\content\home +``` + +## Related Topics + +* [New-ItemClone](new-itemclone.md) +* [Get-ItemClone](get-itemclone.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/convertto-clixml.md b/appendix/common/convertto-clixml.md new file mode 100644 index 00000000..2ac51956 --- /dev/null +++ b/appendix/common/convertto-clixml.md @@ -0,0 +1,66 @@ +# ConvertTo-CliXml + +Exports Microsoft .NET objects froms PowerShell to a CliXml string. + +## Syntax + +ConvertTo-CliXml \[-InputObject\] <PSObject> + +## Detailed Description + +The ConvertTo-CliXml command exports Microsoft .NET Framework objects from PowerShell to a CliXml string. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -InputObject <PSObject> + +Specifies the object to be converted. Enter a variable that contains the objects, or type a command or expression that gets the objects. You can also pipe objects to ConvertTo-CliXml. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* object + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* System.String + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> #Convert original item to xml +PS master:\> $myCliXmlItem = Get-Item -Path master:\content\home | ConvertTo-CliXml +PS master:\> #print the CliXml +PS master:\> $myCliXmlItem +PS master:\> #print the Item converted back from CliXml +PS master:\> $myCliXmlItem | ConvertFrom-CliXml +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [ConvertFrom-CliXml](convertfrom-clixml.md) +* ConvertFrom-Xml +* ConvertTo-Xml +* Export-CliXml +* Import-CliXml + diff --git a/appendix/common/expand-token.md b/appendix/common/expand-token.md new file mode 100644 index 00000000..caf900a7 --- /dev/null +++ b/appendix/common/expand-token.md @@ -0,0 +1,144 @@ +# Expand-Token + +Expands tokens in fields for items. + +## Syntax + +Expand-Token \[-Item\] <Item> \[-Language <String\[\]>\] + +Expand-Token \[-Path\] <String> \[-Language <String\[\]>\] + +Expand-Token -Id <String> \[-Database <String>\] \[-Language <String\[\]>\] + +## Detailed Description + +The Expand-Token command expands the tokens in fields for items. + +Some example of tokens include: + +* $name +* $time + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Language <String\[\]> + +Language that will be processed. If not specified the current user language will be used. Globbing/wildcard supported. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be processed - additionally specify Language parameter to fetch different item language than the current user language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the the item to be processed - additionally specify Language parameter to fetch different item language than the current user language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +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 + +The following expands tokens in fields on the item. + +```powershell +Get-Item -Path "master:\content\home" | Expand-Token +``` + +### EXAMPLE 2 + +The following expands tokens in fields on the item. If the standard value of the field contains a token we modify the field to the token so the expansion will work (Sitecore API does not expand if the field is the same as Standard Values and never modified). + +```powershell +$tokens = @('$name', '$id', '$parentId', '$parentname', '$date', '$time', '$now') + +$item = Get-Item -Path "master:\content\home" + +$standardValueFields = Get-ItemField -Item $item -ReturnType Field -Name "*" ` + | Where-Object { $_.ContainsStandardValue } + +$item.Editing.BeginEdit() + +foreach ($field in $standardValueFields) { + $value = $field.Value + + if ($tokens -contains $value) { + $item[$field.Name] = $value + } +} + +$item.Editing.EndEdit() + +Expand-Token -Item $item +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [https://sitecorejunkie.com/2014/05/27/launch-powershell-scripts-in-the-item-context-menu-using-sitecore-powershell-extensions/](https://sitecorejunkie.com/2014/05/27/launch-powershell-scripts-in-the-item-context-menu-using-sitecore-powershell-extensions/) +* [https://sitecorejunkie.com/2014/06/02/make-bulk-item-updates-using-sitecore-powershell-extensions/](https://sitecorejunkie.com/2014/06/02/make-bulk-item-updates-using-sitecore-powershell-extensions/) + diff --git a/appendix/common/get-archive.md b/appendix/common/get-archive.md new file mode 100644 index 00000000..8cba45c1 --- /dev/null +++ b/appendix/common/get-archive.md @@ -0,0 +1,73 @@ +# Get-Archive + +Returns Sitecore database archives. + +## Syntax + +Get-Archive \[\[-Database\] <Database>\] \[\[-Name\] <String>\] + +## Detailed Description + +The Get-Archive command returns Sitecore archives in context of the specified database. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Name <String> + +Name of the archive to retrieve. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <Database> + +Database for which the archives should be retrieved. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 2 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Database + +## 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 + +```powershell +PS master:\> Get-Archive -Database "master" + +Name Items +---- ----- +archive 0 +recyclebin 1950 +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/get-archiveitem.md b/appendix/common/get-archiveitem.md new file mode 100644 index 00000000..e9b9c02e --- /dev/null +++ b/appendix/common/get-archiveitem.md @@ -0,0 +1,138 @@ +# Get-ArchiveItem + +Retrieves a list of items found in the specified archive. + +## Syntax + +```powershell +Get-ArchiveItem -Archive +Get-ArchiveItem -Archive [-ItemId ] +Get-ArchiveItem -Archive [-Identity ] +``` + +## Detailed Description + +The Get-ArchiveItem command returns items found in the "archive" and "recyclebin" archives. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Archive <Archive> + +Specifies the archive to use when determining which ArchiveEntry items to process. Use Get-Archive to find the appropriate archive. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false| +| Accept Wildcard Characters? | false | + +### -ItemId <ID> + +Specifies the ID for the original item that should be processed. This is NOT the ArchivalId. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Identity <AccountIdentity> + +Specifies the user responsible for moving the item to the archive. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +None. + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Data.Archiving.ArchiveEntry + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +The following returns all items found in the specified archive. + +```powershell +$database = Get-Database -Name "master" +$archiveName = "recyclebin" +$archive = Get-Archive -Database $database -Name $archiveName +Get-ArchiveItem -Archive $archive +``` + +### EXAMPLE 2 + +The following returns items matching the ItemId found in the specified archive. + +```powershell +$database = Get-Database -Name "master" +$archiveName = "recyclebin" +$archive = Get-Archive -Database $database -Name $archiveName +Get-ArchiveItem -Archive $archive -ItemId "{1BB32980-66B4-4ADA-9170-10A9D3336613}" +``` + +### EXAMPLE 3 + +The following returns items moved to the recycle bin by the user found in the specified archive. + +```powershell +$database = Get-Database -Name "master" +$archiveName = "recyclebin" +$archive = Get-Archive -Database $database -Name $archiveName +Get-ArchiveItem -Archive $archive -Identity "sitecore\admin" +``` + +### EXAMPLE 4 + +The following demonstrates changing the archive date on an item followed by retrieving the archived item. + +```powershell +$item = Get-Item -Path "master:" -ID "{1BB32980-66B4-4ADA-9170-10A9D3336613}" +$date = $item[[Sitecore.FieldIDs]::ArchiveDate] +$serverTime = [Sitecore.DateUtil]::IsoDateToServerTimeIsoDate($date) +$serverTimeDateTime = [Sitecore.DateUtil]::IsoDateToDateTime($serverTime, [datetime]::MinValue) + +# Here you could add more time to the $serverTimeDateTime + +$utcTimeDateTime = [Sitecore.DateUtil]::ToUniversalTime($serverTimeDateTime) +$isoTime = [Sitecore.DateUtil]::ToIsoDate($utcTimeDateTime) + +$item.Editing.BeginEdit() +$item[[Sitecore.FieldIDs]::ArchiveDate] = $isoTime +$item.Editing.EndEdit() + +# Some time after the date has passed +$database = Get-Database -Name "master" +$archiveName = "archive" +$archive = Get-Archive -Database $database -Name $archiveName +Get-ArchiveItem -Archive $archive -ItemId "{1BB32980-66B4-4ADA-9170-10A9D3336613}" +``` + +## Related Topics + +* Remove-ArchiveItem +* Restore-ArchiveItem +* Remove-Item +* Remove-ItemVersion +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) \ No newline at end of file diff --git a/appendix/common/get-cache.md b/appendix/common/get-cache.md new file mode 100644 index 00000000..124de384 --- /dev/null +++ b/appendix/common/get-cache.md @@ -0,0 +1,62 @@ +# Get-Cache + +Retrieves a Sitecore cache. + +## Syntax + +Get-Cache \[\[-Name\] <String>\] + +## Detailed Description + +The Get-Cache command retrieves a Sitecore cache. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Name <String> + +Name of the cache to retrieve. Supports wildcards. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Caching.Cache + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> Get-Cache -Name master* + +Name Enabled Count Size Max Size Default Scavengable + Priority +---- ------- ----- ---- -------- -------- ----------- +master[blobIDs] True 0 0 512000 Normal False +master[blobIDs] True 0 0 512000 Normal False +master[blobIDs] True 0 0 512000 Normal False +master[itempaths] True 292 108228 10485760 Normal False +master[standardValues] True 57 38610 512000 Normal False +master[paths] True 108 13608 512000 Normal False +master[items] True 1010 5080300 10485760 Normal False +master[data] True 3427 7420654 20971520 Normal False +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/get-database.md b/appendix/common/get-database.md new file mode 100644 index 00000000..9ef037e7 --- /dev/null +++ b/appendix/common/get-database.md @@ -0,0 +1,96 @@ +# Get-Database + +Retrieves a Sitecore Database. + +## Syntax + +Get-Database \[\[-Name\] <String>\] \[-Item <Item>\] + +## Detailed Description + +The Get-Database command retrieves one or more Sitecore Database objects based on name or item passed to it. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Name <String> + +Name of the database to be returned. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +Database returned will be taken from the item passed to the command. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + + System.String + +## 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 + +```powershell +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 + +```powershell +PS master:\> Get-Database -Name "master" + +Name Languages Protected Read Only +---- --------- --------- --------- +master {en, de-DE, es-ES, pt-BR...} False False +``` + +### EXAMPLE 3 + +```powershell +PS master:\> Get-Item . | Get-Database + +Name Languages Protected Read Only +---- --------- --------- --------- +master {en, de-DE, es-ES, pt-BR...} False False +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/get-itemclone.md b/appendix/common/get-itemclone.md new file mode 100644 index 00000000..b794c146 --- /dev/null +++ b/appendix/common/get-itemclone.md @@ -0,0 +1,100 @@ +# Get-ItemClone + +Returns all the clones for the specified item. + +## Syntax + +Get-ItemClone \[-Item\] <Item> + +Get-ItemClone \[-Path\] <String> + +Get-ItemClone -Id <String> \[-Database <String>\] + +## Detailed Description + +The Get-ItemClone command returns all the clones for the specified item. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Item <Item> + +The item to be analysed for clones presence. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be analysed for clones presence. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be analysed for clones presence. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be processed - if item is being provided through Id. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> Get-ItemClone -Path master:\content\home +``` + +## Related Topics + +* [New-ItemClone](new-itemclone.md) +* [ConvertFrom-ItemClone](convertfrom-itemclone.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [https://github.com/SitecorePowerShell/Console/issues/218](https://github.com/SitecorePowerShell/Console/issues/218) +* Get-Item + diff --git a/appendix/common/get-itemclonenotification.md b/appendix/common/get-itemclonenotification.md new file mode 100644 index 00000000..607fd898 --- /dev/null +++ b/appendix/common/get-itemclonenotification.md @@ -0,0 +1,95 @@ +# Get-ItemCloneNotification + +## Syntax + +```powershell +Get-ItemCloneNotification [-Item] [-NotificationType ] [-Language ] +Get-ItemCloneNotification [-Path] [-NotificationType ] [-Language ] +Get-ItemCloneNotification -Id [-Database ] [-NotificationType ] [-Language ] +``` + +## Detailed Description + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -NotificationType  <NotificationType> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language  <String\[\]> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item  <Item> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path  <String> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id  <String> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database  <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Examples + +### EXAMPLE 1 + +The following gets the cloned `Item` and returns the available notifications. + +```powershell +$clonedItem = Get-Item -Path "master:" -ID "{9F158637-52C2-4005-8329-21527685CB71}" +Get-ItemCloneNotification -Item $clonedItem +``` + +### EXAMPLE 2 + +The following gets the cloned `Item` based on the specified type of notification. + +```powershell +$clonedItem = Get-Item -Path "master:" -ID "{9F158637-52C2-4005-8329-21527685CB71}" +$clonedItem | Get-ItemCloneNotification -NotificationType ItemMovedChildRemovedNotification +``` diff --git a/appendix/common/get-itemfield.md b/appendix/common/get-itemfield.md new file mode 100644 index 00000000..120be8af --- /dev/null +++ b/appendix/common/get-itemfield.md @@ -0,0 +1,182 @@ +# Get-ItemField + +Retrieves item fields as either names or fields or template fields. + +## Syntax + +Get-ItemField \[-Item\] <Item> \[-IncludeStandardFields\] \[-ReturnType <Name \| Field \| TemplateField>\] \[-Name <String\[\]>\] \[-Language <String\[\]>\] + +Get-ItemField \[-Path\] <String> \[-IncludeStandardFields\] \[-ReturnType <Name \| Field \| TemplateField>\] \[-Name <String\[\]>\] \[-Language <String\[\]>\] + +Get-ItemField -Id <String> \[-Database <String>\] \[-IncludeStandardFields\] \[-ReturnType <Name \| Field \| TemplateField>\] \[-Name <String\[\]>\] \[-Language <String\[\]>\] + +## Detailed Description + +Retrieves item fields as either names or fields or template fields. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -IncludeStandardFields <SwitchParameter> + +Includes fields that are defined on "Standard template" + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ReturnType <ReturnValue> + +Determines type returned. The possible values include: + +* Name - strings with field names. +* Field - fields on the item +* TemplateField - template fields. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Name <String\[\]> + +Array of names to include - supports wildcards. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +Language that will be analysed. If not specified the current user language will be used. Globbing/wildcard supported. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be analysed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be analysed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be analysed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be analysed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Data.Items.Item + + Sitecore.Data.Templates.TemplateField + + Sitecore.Data.Fields.Field + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Get list of names of non standard fields from /sitecore/content/home item + +```powershell +PS master:\> Get-ItemField -Path master:\content\home + +Text +Title +Image +``` + +### EXAMPLE 2 + +Get list of fields including standard fields from /sitecore/content/home item and list their Name, DisplayName, SectionDisplayName and Description in a table. + +```powershell +PS master:\> Get-Item master:\content\home | Get-ItemField -IncludeStandardFields -ReturnType Field -Name "*" | ft Name, DisplayName, SectionDisplayName, Description -auto + +Name DisplayName SectionDisplayName Description +---- ----------- ------------------ ----------- +__Revision Revision Statistics +__Standard values __Standard values Advanced +__Updated by Updated by Statistics +__Validate Button Validation Rules Validation Button Validation Rules Validation Rules +__Created Created Statistics +__Thumbnail Thumbnail Appearance +__Insert Rules Insert Rules Insert Options +__Short description Short description Help +__Created by Created by Statistics +__Presets Presets Layout +Text Text Data The text is the main content of the document. +``` + +## Related Topics + +* [Get-ItemTemplate](get-itemtemplate.md) +* [Reset-ItemField](reset-itemfield.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/get-itemreference.md b/appendix/common/get-itemreference.md new file mode 100644 index 00000000..cbadce23 --- /dev/null +++ b/appendix/common/get-itemreference.md @@ -0,0 +1,152 @@ +# Get-ItemReference + +Returns all the items linked to the specified item.. + +## Syntax + +Get-ItemReference -Item <Item> + +Get-ItemReference -Item <Item> -ItemLink + +Get-ItemReference -Path <String> \[-Language <String\[\]>\] + +Get-ItemReference -Path <String> \[-Language <String\[\]>\] -ItemLink + +Get-ItemReference -Id <String> \[-Database <String>\] \[-Language <String\[\]>\] + +Get-ItemReference -Id <String> \[-Database <String>\] \[-Language <String\[\]>\] -ItemLink + +## Detailed Description + +The Get-ItemReference command returns all items linked to the specified item. If -ItemLink parameter is used the command will return links rather than items. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Item <Item> + +The item to be analysed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be processed - additionally specify Language parameter to fetch different item language than the current user language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the the item to be processed - additionally specify Language parameter to fetch different item language than the current user language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard supported. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ItemLink <SwitchParameter> + +Return ItemLink that define both source and target of a link rather than items that are being linked to from the specified item. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Data.Items.Item + + Sitecore.Links.ItemLink + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\>Get-ItemReference -Path master:\content\home + +Name Children Languages Id TemplateName +---- -------- --------- -- ------------ +Home True {en, de-DE, es-ES, pt... {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item +Home True {en, de-DE, es-ES, pt... {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item +``` + +### EXAMPLE 2 + +```powershell +PS master:\>Get-Item master:\content\home | Get-ItemReference -ItemLink + +SourceItemLanguage : en +SourceItemVersion : 1 +TargetItemLanguage : +TargetItemVersion : 0 +SourceDatabaseName : master +SourceFieldID : {F685964D-02E1-4DB6-A0A2-BFA59F5F9806} +SourceItemID : {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} +TargetDatabaseName : master +TargetItemID : {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} +TargetPath : /sitecore/content/Home +``` + +## Related Topics + +* [Get-ItemReferrer](get-itemreferrer.md) +* [Update-ItemReferrer](update-itemreferrer.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/get-itemreferrer.md b/appendix/common/get-itemreferrer.md new file mode 100644 index 00000000..df0b89b2 --- /dev/null +++ b/appendix/common/get-itemreferrer.md @@ -0,0 +1,154 @@ +# Get-ItemReferrer + +Returns all the items referring to the specified item. + +## Syntax + +Get-ItemReferrer -Item <Item> + +Get-ItemReferrer -Item <Item> -ItemLink + +Get-ItemReferrer -Path <String> \[-Language <String\[\]>\] + +Get-ItemReferrer -Path <String> \[-Language <String\[\]>\] -ItemLink + +Get-ItemReferrer -Id <String> \[-Database <String>\] \[-Language <String\[\]>\] + +Get-ItemReferrer -Id <String> \[-Database <String>\] \[-Language <String\[\]>\] -ItemLink + +## Detailed Description + +The Get-ItemReferrer command returns all items referring to the specified item. If -ItemLink parameter is used the command will return links rather than items. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Item <Item> + +The item to be analysed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be processed - additionally specify Language parameter to fetch different item language than the current user language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the the item to be processed - additionally specify Language parameter to fetch different item language than the current user language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard supported. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ItemLink <SwitchParameter> + +Return ItemLink that define both source and target of a link rather than items linking to the specified item. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Data.Items.Item + + Sitecore.Links.ItemLink + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\>Get-ItemReferrer -Path master:\content\home + +Name Children Languages Id TemplateName +---- -------- --------- -- ------------ +Home True {en, de-DE, es-ES, pt... {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item +Form False {en, de-DE, es-ES, pt... {6D3B4E7D-FEF8-4110-804A-B56605688830} Webcontrol +news True {en, de-DE, es-ES, pt... {DB894F2F-D53F-4A2D-B58F-957BFAC2C848} Article +learn-about-oms False {en, de-DE, es-ES, pt... {79ECF4DF-9DB7-430F-9BFF-D164978C2333} Link +``` + +### EXAMPLE 2 + +```powershell +PS master:\>Get-Item master:\content\home | Get-ItemReferrer -ItemLink + +SourceItemLanguage : en +SourceItemVersion : 1 +TargetItemLanguage : +TargetItemVersion : 0 +SourceDatabaseName : master +SourceFieldID : {F685964D-02E1-4DB6-A0A2-BFA59F5F9806} +SourceItemID : {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} +TargetDatabaseName : master +TargetItemID : {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} +TargetPath : /sitecore/content/Home +``` + +## Related Topics + +* [Get-ItemReference](get-itemreference.md) +* [Update-ItemReferrer](update-itemreferrer.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/get-itemtemplate.md b/appendix/common/get-itemtemplate.md new file mode 100644 index 00000000..b31c1311 --- /dev/null +++ b/appendix/common/get-itemtemplate.md @@ -0,0 +1,152 @@ +# Get-ItemTemplate + +Returns the item template and its base templates. + +## Syntax + +Get-ItemTemplate \[-Item\] <Item> \[-Recurse\] + +Get-ItemTemplate \[-Path\] <String> \[-Recurse\] + +Get-ItemTemplate -Id <String> \[-Database <String>\] \[-Recurse\] + +## Detailed Description + +The Get-ItemTemplate command returns the item template and its base templates. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Recurse <SwitchParameter> + +Return the template the item is based on and all of its base templates. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be analysed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be analysed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be analysed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be analysed - required if item is specified with Id. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Data.Items.TemplateItem + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Get template of /sitecore/conent/home item + +```powershell +PS master:\> Get-ItemTemplate -Path master:\content\home + + BaseTemplates : {Standard template} + Fields : {__Context Menu, __Display name, __Editor, __Editors...} + FullName : Sample/Sample Item + Key : sample item + OwnFields : {Title, Text, Image, State...} + StandardValues : Sitecore.Data.Items.Item + Database : master + DisplayName : Sample Item + Icon : Applications/16x16/document.png + ID : {76036F5E-CBCE-46D1-AF0A-4143F9B557AA} + InnerItem : Sitecore.Data.Items.Item + Name : Sample Item +``` + +### EXAMPLE 2 + +Get template of /sitecore/conent/home item and all of the templates its template is based on then format it to only show the template name, path and Key + +```powershell +PS master:\> Get-Item -Path master:/content/Home | Get-ItemTemplate -Recurse | ft Name, FullName, Key -auto + + Name FullName Key + ---- -------- --- + Sample Item Sample/Sample Item sample item + Standard template System/Templates/Standard template standard template + Advanced System/Templates/Sections/Advanced advanced + Appearance System/Templates/Sections/Appearance appearance + Help System/Templates/Sections/Help help + Layout System/Templates/Sections/Layout layout + Lifetime System/Templates/Sections/Lifetime lifetime + Insert Options System/Templates/Sections/Insert Options insert options + Publishing System/Templates/Sections/Publishing publishing + Security System/Templates/Sections/Security security + Statistics System/Templates/Sections/Statistics statistics + Tasks System/Templates/Sections/Tasks tasks + Validators System/Templates/Sections/Validators validators + Workflow System/Templates/Sections/Workflow workflow +``` + +## Related Topics + +* [Get-ItemField](get-itemfield.md) +* [Set-ItemTemplate](set-itemtemplate.md) +* [Add-BaseTemplate](add-basetemplate.md) +* [Remove-BaseTemplate](remove-basetemplate.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/get-itemworkflowevent.md b/appendix/common/get-itemworkflowevent.md new file mode 100644 index 00000000..e5956c52 --- /dev/null +++ b/appendix/common/get-itemworkflowevent.md @@ -0,0 +1,133 @@ +# Get-ItemWorkflowEvent + +Returns entries from the history store notifying of workflow state change for the specified item. + +## Syntax + +Get-ItemWorkflowEvent \[-Item\] <Item> \[-Identity <String>\] \[-Language <String\[\]>\] + +Get-ItemWorkflowEvent \[-Path\] <String> \[-Identity <String>\] \[-Language <String\[\]>\] + +Get-ItemWorkflowEvent -Id <String> \[-Database <String>\] \[-Identity <String>\] \[-Language <String\[\]>\] + +## Detailed Description + +The Get-ItemWorkflowEvent command returns entries from the history store notifying of workflow state change for the specified item. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Identity <String> + +User that has been associated with the enteries. Wildcards are supported. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard supported. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to have its history items returned. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to have its history items returned - additionally specify Language parameter to fetch different item language than the current user language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the the item to have its history items returned - additionally specify Language parameter to fetch different item language than the current user language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to have its history items returned - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Workflows.WorkflowEvent + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> Get-ItemWorkflowEvent -Path master:\content\home +Date : 2014-07-27 14:23:33 +NewState : {190B1C84-F1BE-47ED-AA41-F42193D9C8FC} +OldState : {46DA5376-10DC-4B66-B464-AFDAA29DE84F} +Text : Automated +User : sitecore\admin + +Date : 2014-08-01 15:43:29 +NewState : {190B1C84-F1BE-47ED-AA41-F42193D9C8FC} +OldState : {190B1C84-F1BE-47ED-AA41-F42193D9C8FC} +Text : Just leaving a note +User : sitecore\admin +``` + +## Related Topics + +* [New-ItemWorkflowEvent](new-itemworkflowevent.md) +* Execute-Workflow +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/get-sitecorejob.md b/appendix/common/get-sitecorejob.md new file mode 100644 index 00000000..dc14f989 --- /dev/null +++ b/appendix/common/get-sitecorejob.md @@ -0,0 +1,102 @@ +# Get-SitecoreJob + +Returns list of the current sitecore jobs + +## Syntax + +Get-SitecoreJob + +## Detailed Description + +The Get-SitecoreJob command returns the list of the currently running jobs of Sitecore. + +© 2010-2019 Implemented by Vangasewinkel Benjamin using the Adam Najmanowicz, Michael West Sitecore PowerShell Extensions. All rights reserved. + +## Parameters + +None + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Jobs.Job + +## Notes + +Help Author: Vangansewinkel Benjamin + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\> Get-SitecoreJob + +Category : PowerShell +Handle : b62d9129-298a-4630-bb37-d725e5ce3bbf;DCI5CG6011F3Y-sc81u3contact +IsDone : True +Name : PowerShell-ca2a0179-78c5-02a4-5970-17e4909752b0-{347EBAF8-6BE2-4ABC-91D0-36B36FCF414B} +Options : Sitecore.Jobs.JobOptions +Status : Sitecore.Jobs.JobStatus +WaitHandle : System.Threading.ManualResetEvent +QueueTime : 11/13/2017 1:03:18 PM +MessageQueue : Sitecore.Jobs.AsyncUI.MessageQueue + +Category : Indexing +Handle : dca83fc7-def7-4564-ac44-987e79ffc3cd;DCI5CG6011F3Y-sc81u3contact +IsDone : True +Name : Index_Update_IndexName=sitecore_analytics_index +Options : Sitecore.Jobs.JobOptions +Status : Sitecore.Jobs.JobStatus +WaitHandle : System.Threading.ManualResetEvent +QueueTime : 11/13/2017 1:03:29 PM +MessageQueue : Sitecore.Jobs.AsyncUI.MessageQueue + +Category : PowerShell +Handle : de0a1dce-45f7-44fb-81b5-02b402c1f614;DCI5CG6011F3Y-sc81u3contact +IsDone : False +Name : PowerShell-ca2a0179-78c5-02a4-5970-17e4909752b0-{47666A58-890B-4D13-8F15-3348643750E4} +Options : Sitecore.Jobs.JobOptions +Status : Sitecore.Jobs.JobStatus +WaitHandle : System.Threading.ManualResetEvent +QueueTime : 11/13/2017 1:03:29 PM +MessageQueue : Sitecore.Jobs.AsyncUI.MessageQueue +``` + +### EXAMPLE 2 + +```powershell +PS master:\> $jobs = Get-SitecoreJob +PS master:\> $jobs[0].Status + +Category : PowerShell +Handle : c9215f66-ce60-49e5-9620-bf1ec51b6ef4;DCI5CG6011F3Y-sc81u3contact +IsDone : False +Name : PowerShell-ca2a0179-78c5-02a4-5970-17e4909752b0-{DF4895A6-3EBB-4A2A-9756-3A0EF4B96396} +Options : Sitecore.Jobs.JobOptions +Status : Sitecore.Jobs.JobStatus +WaitHandle : System.Threading.ManualResetEvent +QueueTime : 11/13/2017 1:05:54 PM +MessageQueue : Sitecore.Jobs.AsyncUI.MessageQueue +``` + +### EXAMPLE 3 + +```powershell +PS master:\> Get-SitecoreJob | Show-ListView -Property "Category", "IsDone", "Name", "QueueTime", ` + @{Label="Status Expiry"; Expression={$_.Status.Expiry} }, + @{Label="Status Failed"; Expression={$_.Status.Failed} }, + @{Label="Status State"; Expression={$_.Status.State} }, + @{Label="Status Processed"; Expression={$_.Status.Processed} }, + @{Label="Status Total"; Expression={$_.Status.Total} }, + @{Label="Status Message"; Expression={$_.Status.Messages} } +``` + +![Example 3](../../.gitbook/assets/get-sitecorejobs-listview.png) + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [https://www.youtube.com/watch?v=N3xgZcU9FqQ&list=PLph7ZchYd\_nCypVZSNkudGwPFRqf1na0b&index=9](https://www.youtube.com/watch?v=N3xgZcU9FqQ&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=9) + diff --git a/appendix/common/get-spemodule.md b/appendix/common/get-spemodule.md new file mode 100644 index 00000000..5d3e01f5 --- /dev/null +++ b/appendix/common/get-spemodule.md @@ -0,0 +1,134 @@ +# Get-SpeModule + +Returns the object that describes a Sitecore PowerShell Extensions Module + +## Syntax + +Get-SpeModule -Item <Item> + +Get-SpeModule -Path <String> + +Get-SpeModule -Id <String> -Database <String> + +Get-SpeModule -Database <String> + +Get-SpeModule \[-Database <String>\] -Name <String> + +## Detailed Description + +The Get-SpeModule command returns the object that describes a Sitecore PowerShell Extensions Module. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Item <Item> + +A script or library item that is defined within the module to be returned. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to a script or library item that is defined within the module to be returned. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of a script or library item that is defined within the module to be returned. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the module to be returned. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Name <String> + +Name fo the module to return. Supports wildcards. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + + System.String + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Spe.Core.Modules.Module + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Return all modules defined in the provided database + +```powershell +PS master:\> Get-SpeModule -Database (Get-Database "master") +``` + +### EXAMPLE 2 + +Return all modules defined in the master database Matching the "Content\*" wildcard + +```powershell +PS master:\> Get-SpeModule -Database (Get-Database "master") +``` + +### EXAMPLE 3 + +Return the module the piped script belongs to + +```powershell +PS master:\> Get-item "master:\system\Modules\PowerShell\Script Library\Copy Renderings\Content Editor\Context Menu\Layout\Copy Renderings" | Get-SpeModule +``` + +## Related Topics + +* [Get-SpeModuleFeatureRoot](get-spemodulefeatureroot.md) +* [https://blog.najmanowicz.com/2014/11/01/sitecore-powershell-extensions-3-0-modules-proposal/](https://blog.najmanowicz.com/2014/11/01/sitecore-powershell-extensions-3-0-modules-proposal/) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/get-spemodulefeatureroot.md b/appendix/common/get-spemodulefeatureroot.md new file mode 100644 index 00000000..ff8a1183 --- /dev/null +++ b/appendix/common/get-spemodulefeatureroot.md @@ -0,0 +1,113 @@ +# 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 <Module>\] \[-ReturnPath\] \[-Feature\] <String> + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Module <Module> + +Module for which the feature root library should be returned. If not provided the feature root will be returned for all modules. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -ReturnPath <SwitchParameter> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Feature <String> + +Feature for which the root library should be provided. If root item does not exist and -ReturnPath parameter is not specified - nothing will be returned, If -ReturnPath parameter is provided the path in which the feature root should be located will be returned + +Valid features: + +* contentEditorContextMenu +* contentEditorGutters +* contentEditorRibbon +* controlPanel +* functions +* listViewExport +* listViewRibbon +* pipelineLoggedIn +* pipelineLoggingIn +* pipelineLogout +* toolbox +* startMenuReports +* eventHandlers +* webAPI +* pageEditorNotification +* isePlugi + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Data.Items.Item + + System.String + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Return the library item for "Content Editor Context Menu" + +```powershell +$module = Get-SpeModule -Name "Copy Renderings" +Get-SpeModuleFeatureRoot -Feature contentEditorContextMenu -Module $module +``` + +### EXAMPLE 2 + +Return the Path to where "List View Export" scripts would be located if this feature was defined + +```powershell +$module = Get-SpeModule -Name "Copy Renderings" +Get-SpeModuleFeatureRoot -Module $module -Feature listViewExport -ReturnPath +``` + +## Related Topics + +* [Get-SpeModule](get-spemodule.md) +* [https://blog.najmanowicz.com/2014/11/01/sitecore-powershell-extensions-3-0-modules-proposal/](https://blog.najmanowicz.com/2014/11/01/sitecore-powershell-extensions-3-0-modules-proposal/) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/commands/Get-TaskSchedule.md b/appendix/common/get-taskschedule.md similarity index 51% rename from appendix/commands/Get-TaskSchedule.md rename to appendix/common/get-taskschedule.md index c58b4ccf..4c1ad7a4 100644 --- a/appendix/commands/Get-TaskSchedule.md +++ b/appendix/common/get-taskschedule.md @@ -1,184 +1,92 @@ -# Get-TaskSchedule - -Returns one or more task schedule items using the specified criteria. - -## Syntax - -Get-TaskSchedule -Item <Item> - -Get-TaskSchedule -Path <String> - -Get-TaskSchedule [[-Database] <Database>] [[-Name] <String>] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Item  <Item> - -Task item to be converted. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be returned as Task Schedule. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Database  <Database> - -Database containing the task items to be returned. If not provided all databases will be considered for filtering using the "Name" parameter. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?2
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Name  <String> - -Task filter - supports wildcards. Works with "Database" parameter to narrow tassk to only single database. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Tasks.ScheduleItem - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - - - -```powershell - +# Get-TaskSchedule + +Returns one or more task schedule items using the specified criteria. + +## Syntax + +Get-TaskSchedule -Item <Item> + +Get-TaskSchedule -Path <String> + +Get-TaskSchedule \[\[-Database\] <Database>\] \[\[-Name\] <String>\] + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Item <Item> + +Task item to be converted. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be returned as Task Schedule. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Database <Database> + +Database containing the task items to be returned. If not provided all databases will be considered for filtering using the "Name" parameter. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 2 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Name <String> + +Task filter - supports wildcards. Works with "Database" parameter to narrow tassk to only single database. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Tasks.ScheduleItem + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell PS master:\> Get-TaskSchedule Name Database Active Auto Remove Is Due Expired Completed Last Run Next Run ---- -------- ------ ----------- ------ ------- --------- -------- -------- @@ -195,40 +103,34 @@ Check DSN Messages web True False True Clean Confirmation IDs web True False False False False 2013-11-04 08:36:22 2013-11-04 21:36:22 Clean Message History web True False True False False 2013-11-04 08:36:22 2013-11-04 21:06:22 Close Outdated Connections web True False True False False 2013-11-04 09:36:23 2013-11-04 10:36:23 -Test-PowerShell web True False True False False 2013-11-04 09:46:29 2013-11-04 09:46:30 - -``` - -### EXAMPLE 2 - - - -```powershell - +Test-PowerShell web True False True False False 2013-11-04 09:46:29 2013-11-04 09:46:30 +``` + +### EXAMPLE 2 + +```powershell PS master:\> Get-TaskSchedule -Name "*Check*" Name Database Active Auto Remove Is Due Expired Completed Last Run Next Run ---- -------- ------ ----------- ------ ------- --------- -------- -------- Check Bounced Messages master True False False False False 2014-07-29 10:18:43 2014-07-29 22:48:43 Check DSN Messages master True False False False False 2014-07-29 10:19:18 2014-07-29 22:49:18 Check Bounced Messages web True False True False False 2013-11-04 08:36:22 2013-11-04 21:06:22 -Check DSN Messages web True False True False False 2013-11-04 08:36:22 2013-11-04 21:06:22 - -``` - -### EXAMPLE 3 - - - -```powershell - +Check DSN Messages web True False True False False 2013-11-04 08:36:22 2013-11-04 21:06:22 +``` + +### EXAMPLE 3 + +```powershell PS master:\> Get-TaskSchedule -Name "*Check*" -Database "master" Name Database Active Auto Remove Is Due Expired Completed Last Run Next Run ---- -------- ------ ----------- ------ ------- --------- -------- -------- Check Bounced Messages master True False False False False 2014-07-29 10:18:43 2014-07-29 22:48:43 -Check DSN Messages master True False False False False 2014-07-29 10:19:18 2014-07-29 22:49:18 - -``` - -## Related Topics - - * [Start-TaskSchedule](/appendix/commands/Start-TaskSchedule.md) * https://github.com/SitecorePowerShell/Console/
* https://www.youtube.com/watch?v=N3xgZcU9FqQ&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=9
+Check DSN Messages master True False False False False 2014-07-29 10:19:18 2014-07-29 22:49:18 +``` + +## Related Topics + +* [Start-TaskSchedule](start-taskschedule.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [https://www.youtube.com/watch?v=N3xgZcU9FqQ&list=PLph7ZchYd\_nCypVZSNkudGwPFRqf1na0b&index=9](https://www.youtube.com/watch?v=N3xgZcU9FqQ&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=9) + diff --git a/appendix/common/get-useragent.md b/appendix/common/get-useragent.md new file mode 100644 index 00000000..3f6d36eb --- /dev/null +++ b/appendix/common/get-useragent.md @@ -0,0 +1,38 @@ +# 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-2019 Adam Najmanowicz, 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 + +```powershell +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/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/import-function.md b/appendix/common/import-function.md new file mode 100644 index 00000000..7924573c --- /dev/null +++ b/appendix/common/import-function.md @@ -0,0 +1,83 @@ +# Import-Function + +Imports a function script from the script library's "Functions" folder. + +## Syntax + +Import-Function \[-Name\] <String> \[-Library <String>\] \[-Module <String>\] + +## Detailed Description + +The Import-Function command imports a function script from the script library's "Functions" folder. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Name <String> + +Name of the script in the "Functions" library or one of its sub-libraries. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Library <String> + +Name of the library withing the "Functions" library. Provide this name to disambiguate a script from other scripts of the same name that might exist in multiple sub-librarties of the Functions library. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Module <String> + +Name of the module "Functions" are going to be taken from. Provide this name to disambiguate a script from other scripts of the same name that might exist in multiple Modules. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* System.Object + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +The following imports a Resolve-Error function that you may later use to get a deeper understanding of a problem with script should one occur by xecuting the "Resolve-Error" command that was imported as a result of the execution of the following line + +```powershell +PS master:\> Import-Function -Name Resolve-Error +``` + +## Related Topics + +* [Invoke-Script](invoke-script.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/invoke-javascript.md b/appendix/common/invoke-javascript.md new file mode 100644 index 00000000..ca8ca8f7 --- /dev/null +++ b/appendix/common/invoke-javascript.md @@ -0,0 +1,22 @@ +# Invoke-JavaScript + +## Syntax + +Invoke-JavaScript \[-Script\] <String> + +## Detailed Description + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Script  <String> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + diff --git a/appendix/common/invoke-script.md b/appendix/common/invoke-script.md new file mode 100644 index 00000000..5a51835c --- /dev/null +++ b/appendix/common/invoke-script.md @@ -0,0 +1,111 @@ +# 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\] <Item> \[-ArgumentList <Object\[\]>\] + +Invoke-Script \[-Path\] <String> \[-ArgumentList <Object\[\]>\] + +## Detailed Description + +Executes a script from Sitecore PowerShell Extensions Script Library. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Aliases + +The following abbreviations are aliases for this cmdlet: + +* Execute-Script + +## Parameters + +### -Item <Item> + +The script item to be executed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the script item to be executed. Path can be absolute or Relavie to Script library root. e.g. the following two commands are equivalent: + +PS master:\> Invoke-Script 'master:\system\Modules\PowerShell\Script Library\Examples\Script Testing\Long Running Script with Progress Demo' PS master:\> Invoke-Script 'Examples\Script Testing\Long Running Script with Progress Demo' + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ArgumentList <Object\[\]> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* System.Object + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +Invoke-Script 'Examples\Script Testing\Long Running Script with Progress Demo' +``` + +### EXAMPLE 2 + +Run a script with arguments passed in. + +```powershell +$scriptItem = Get-Item -Path "master:" -ID "{35311878-54EF-4E7A-9B95-3B63F5DEE97D}" + +$arguments = @{ + TemplateId = "{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}" +} +$scriptItem | Invoke-Script -ArgumentList $arguments +``` + +The arguments are passed and used in the called script like below: + +```powershell +param($params) +$templateId = $params.templateId + +Get-ItemReferrer -ID $templateId +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Import-Function](import-function.md) + diff --git a/appendix/common/invoke-shellcommand.md b/appendix/common/invoke-shellcommand.md new file mode 100644 index 00000000..277f27ec --- /dev/null +++ b/appendix/common/invoke-shellcommand.md @@ -0,0 +1,144 @@ +# 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 \[-Item\] <Item> \[-Name\] <String> \[-Language <String\[\]>\] + +Invoke-ShellCommand \[-Path\] <String> \[-Name\] <String> \[-Language <String\[\]>\] + +Invoke-ShellCommand -Id <String> \[-Database <String>\] \[-Name\] <String> \[-Language <String\[\]>\] + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Aliases + +The following abbreviations are aliases for this cmdlet: + +* Execute-ShellCommand + +## Parameters + +### -Name <String> + +Name of the sitecore command e.g. "item:publishingviewer" + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard supported. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be sent to the command. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be sent to the command - additionally specify Language parameter to fetch different item language than the current user language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the the item to be sent to the command - additionally specify Language parameter to fetch different item language than the current user language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be sent to the command - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Launch Publishing Viewer for /sitecore/content/home item. + +```powershell +PS master:\> Get-Item master:\content\home\ | Invoke-ShellCommand "item:publishingviewer" +``` + +### EXAMPLE 2 + +Initiate /sitecore/content/home item duplication. + +```powershell +PS master:\> Get-Item master:/content/home | Invoke-ShellCommand "item:duplicate" +``` + +### EXAMPLE 3 + +Show properties of the /sitecore/content/home item. + +```powershell +PS master:\> Get-Item master:/content/home | Invoke-ShellCommand "contenteditor:properties" +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/invoke-workflow.md b/appendix/common/invoke-workflow.md new file mode 100644 index 00000000..639b8231 --- /dev/null +++ b/appendix/common/invoke-workflow.md @@ -0,0 +1,142 @@ +# 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 \[-Item\] <Item> \[-CommandName <String>\] \[-Comments <String>\] \[-Language <String\[\]>\] + +Invoke-Workflow \[-Path\] <String> \[-CommandName <String>\] \[-Comments <String>\] \[-Language <String\[\]>\] + +Invoke-Workflow -Id <String> \[-Database <String>\] \[-CommandName <String>\] \[-Comments <String>\] \[-Language <String\[\]>\] + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Aliases + +The following abbreviations are aliases for this cmdlet: + +* Execute-Workflow + +## Parameters + +### -CommandName <String> + +Namer of the workflow command. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Comments <String> + +Comment to be saved in the history table for the action. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard supported. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to have the workflow action executed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to have the workflow action executed - additionally specify Language parameter to fetch different item language than the current user language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the the item to have the workflow action executed - additionally specify Language parameter to fetch different item language than the current user language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to have the workflow action executed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Submit item to approval, item gotten from path + +```powershell +PS master:\> Invoke-Workflow -Path master:/content/home -CommandName "Submit" -Comments "Automated" +``` + +### EXAMPLE 2 + +Reject item, item gotten from pipeline + +```powershell +PS master:\> Get-Item master:/content/home | Invoke-Workflow -CommandName "Reject" -Comments "Automated" +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/new-itemclone.md b/appendix/common/new-itemclone.md new file mode 100644 index 00000000..5c61209e --- /dev/null +++ b/appendix/common/new-itemclone.md @@ -0,0 +1,139 @@ +# New-ItemClone + +Creates a new item clone based on the item provided. + +## Syntax + +New-ItemClone \[-Item\] <Item> -Destination <Item> \[-Name <String>\] \[-Recurse\] + +New-ItemClone \[-Path\] <String> -Destination <Item> \[-Name <String>\] \[-Recurse\] + +New-ItemClone -Id <String> \[-Database <String>\] -Destination <Item> \[-Name <String>\] \[-Recurse\] + +## Detailed Description + +Creates a new item clone based on the item provided. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Destination <Item> + +Parent item under which the clone should be created. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Name <String> + +Name of the item clone. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Recurse <SwitchParameter> + +Add the parameter to clone thw whole branch rather than a single item. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be cloned. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be cloned. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be cloned + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database of the item to be cloned if item is specified through its ID. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +Clone /sitecore/content/home/ under /sitecore/content/new-target/ with the "New Home" name. + +```powershell +PS master:\> $newTarget = Get-Item master:\content\new-target\ +PS master:\> New-ItemClone -Path master:\content\home -Destination $newTarget -Name "New Home" +``` + +## Related Topics + +* [Get-ItemClone](get-itemclone.md) +* [ConvertFrom-ItemClone](convertfrom-itemclone.md) +* New-Item +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [https://github.com/SitecorePowerShell/Console/issues/218](https://github.com/SitecorePowerShell/Console/issues/218) + diff --git a/appendix/common/new-itemworkflowevent.md b/appendix/common/new-itemworkflowevent.md new file mode 100644 index 00000000..172468b4 --- /dev/null +++ b/appendix/common/new-itemworkflowevent.md @@ -0,0 +1,140 @@ +# New-ItemWorkflowEvent + +Creates new entry in the history store notifying of workflow state change. + +## Syntax + +New-ItemWorkflowEvent \[-Item\] <Item> \[-OldState <String>\] \[-NewState <String>\] \[-Text <String>\] \[-Language <String\[\]>\] + +New-ItemWorkflowEvent \[-Path\] <String> \[-OldState <String>\] \[-NewState <String>\] \[-Text <String>\] \[-Language <String\[\]>\] + +New-ItemWorkflowEvent -Id <String> \[-Database <String>\] \[-OldState <String>\] \[-NewState <String>\] \[-Text <String>\] \[-Language <String\[\]>\] + +## Detailed Description + +Creates new entry in the history store notifying of workflow state change. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -OldState <String> + +Id of the old state. If not provided - current item workflow state will be used. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -NewState <String> + +Id of the old state. If not provided - current item workflow state will be used. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Text <String> + +Action comment. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard supported. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to have the history event attached. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to have the history event attached - additionally specify Language parameter to fetch different item language than the current user language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the the item to have the history event attached - additionally specify Language parameter to fetch different item language than the current user language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to have the history event attached - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> New-ItemWorkflowEvent -Path master:\content\home -lanuage "en" -Text "Just leaving a note" +``` + +## Related Topics + +* [Get-ItemWorkflowEvent](get-itemworkflowevent.md) +* Execute-Workflow +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/new-usingblock.md b/appendix/common/new-usingblock.md new file mode 100644 index 00000000..326744f9 --- /dev/null +++ b/appendix/common/new-usingblock.md @@ -0,0 +1,95 @@ +# New-UsingBlock + +New-UsingBlock. + +## Syntax + +New-UsingBlock \[-InputObject\] <IDisposable> \[-ScriptBlock\] <ScriptBlock> + +## Detailed Description + +The `New-UsingBlock` command disposes of the provided input object after the specified scriptblock completes execution. You may find the data returned by the scriptblock is contained within the following object `System.Collections.ObjectModel.Collection`1[[System.Management.Automation.PSObject, System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]`. This helps when multiple objects are returned and is [known behavior](https://stackoverflow.com/questions/9028804/why-does-invoking-a-powershell-script-block-with-invoke-return-a-collection). + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -InputObject <IDisposable> + +Object that should be disposed after the Script block is executed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ScriptBlock <ScriptBlock> + +Script to be executed within the "Using" context. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 2 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.IDisposable + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* void + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Assuming all items under /sitecore/content/home have both 'Title' and 'MetaTitle' fields... Using New-UsingBlock to bulk update items under /sitecore/Content/ to have their 'MetaTitle' field to be equal to the 'Title' field + +```powershell +New-UsingBlock (New-Object Sitecore.Data.BulkUpdateContext) { +foreach ( $item in (Get-ChildItem -Path master:\Content\Home -Recurse -WithParent) ) { + $item."MetaTitle" = $item.Title + } +} +``` + +### EXAMPLE 2 + +Using New-UsingBlock to perform a test with UserSwitcher - checking whether an anonymous user can change a field The test should end up showing the error as below and the Title should not be changed! + +```powershell +$anonymous = Get-User -Identity "extranet\Anonymous" +$testItem = Get-Item -Path master:\Content\Home + +New-UsingBlock (New-Object Sitecore.Security.Accounts.UserSwitcher $anonymous) { + $testItem.Title = "If you can see this title it means that anonymous users can change this item!" +} + + +New-UsingBlock : Exception setting "Title": "Exception calling "Modify" with "3" argument(s): "The current user does not have write access to this item. User: extranet\Anonymous, Item: Home ({110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9})"" +At line:3 char:1 ++ New-UsingBlock (New-Object Sitecore.Security.Accounts.UserSwitcher $a ... ++ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + CategoryInfo : NotSpecified: (:) [New-UsingBlock], SetValueInvocationException + + FullyQualifiedErrorId : ScriptSetValueRuntimeException,Spe.Commands.Data.NewUsingBlockCommand +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/out-download.md b/appendix/common/out-download.md new file mode 100644 index 00000000..d429f22b --- /dev/null +++ b/appendix/common/out-download.md @@ -0,0 +1,123 @@ +# Out-Download + +Send an object content to the client + +## Syntax + +Out-Download -InputObject <Object> \[-ContentType <String>\] \[-Name <String>\] + +## Detailed Description + +The cmdlet allows to send content of an object \(FileInfo, Stream, String, String\[\] or Byte\[\]\) to the client. This is used for example by report scripts to send the report in HTML, Json or Excel without saving the content of the object to the disk drive. You can specify an object type and file name to make sure the downloaded file is interpreted properly by the browser. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -InputObject <Object> + +Object content to be sent to the client. Object must be of one of the following types: + +* FileInfo, +* Stream, +* String, +* String\[\], +* Byte\[\] + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -ContentType <String> + +The MIME content type of the object. In most cases you can skip this parameter and still have the content type be deduced by the browser from the + +Common examples \(after Wikipedia\) + +* application/json +* application/x-www-form-urlencoded +* application/pdf +* application/octet-stream +* multipart/form-data +* text/html +* image/png +* image/jpg + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Name <String> + +Name of the file you want the user browser to save the object as. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByPropertyName\) | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.Object + +## 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 + +Send first log file to the user + +```powershell +Get-Item "$SitecoreLogFolder\*.*" | select -first 1 | Out-Download +``` + +### EXAMPLE 2 + +Send Hello World text file to the user + +```powershell +"Hello World!" | Out-Download -Name hello-world.txt +``` + +### EXAMPLE 3 + +Get a list of sitecore branches under root item in the master database and send the list to user as excel file + +```powershell +Import-Function -Name ConvertTo-Xlsx + +[byte[]]$outobject = Get-ChildItem master:\ | + Select-Object -Property Name, ProviderPath, Language, Varsion | + ConvertTo-Xlsx + +Out-Download -Name "report-$datetime.xlsx" -InputObject $outobject +``` + +## Related Topics + +* [Send-File](send-file.md) +* [Receive-File](receive-file.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/publish-item.md b/appendix/common/publish-item.md new file mode 100644 index 00000000..437159df --- /dev/null +++ b/appendix/common/publish-item.md @@ -0,0 +1,224 @@ +# Publish-Item + +Publishes a Sitecore item. + +## Syntax + +Publish-Item \[-Item\] <Item> \[-Recurse\] \[-Target <String\[\]>\] \[-PublishMode <Unknown \| Full \| Incremental \| SingleItem \| Smart>\] \[-PublishRelatedItems\] \[-RepublishAll\] \[-CompareRevisions\] \[-FromDate <DateTime>\] \[-AsJob\] \[-Language <String\[\]>\] + +Publish-Item \[-Path\] <String> \[-Recurse\] \[-Target <String\[\]>\] \[-PublishMode <Unknown \| Full \| Incremental \| SingleItem \| Smart>\] \[-PublishRelatedItems\] \[-RepublishAll\] \[-CompareRevisions\] \[-FromDate <DateTime>\] \[-AsJob\] \[-Language <String\[\]>\] + +Publish-Item -Id <String> \[-Database <String>\] \[-Recurse\] \[-Target <String\[\]>\] \[-PublishMode <Unknown \| Full \| Incremental \| SingleItem \| Smart>\] \[-PublishRelatedItems\] \[-RepublishAll\] \[-CompareRevisions\] \[-FromDate <DateTime>\] \[-AsJob\] \[-Language <String\[\]>\] + +## Detailed Description + +The Publish-Item command publishes the Sitecore item and optionally subitems. Allowing for granular control over languages and modes of publishing. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Recurse <SwitchParameter> + +Specifies that subitems should also get published with the root item. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Target <String\[\]> + +Specifies one or many publishing targets. The default target database is "web". + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -PublishMode <PublishMode> + +Specified the Publish mode. Valid values are: + +* Full +* Incremental +* SingleItem +* Smart + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -PublishRelatedItems <SwitchParameter> + +Turns publishing of related items on. Works only on Sitecore 7.2 or newer + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -RepublishAll <SwitchParameter> + +Republishes all items provided to the publishing job. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -CompareRevisions <SwitchParameter> + +Turns revision comparison on. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -FromDate <DateTime> + +Publishes items newer than the date provided only. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -AsJob <SwitchParameter> + +The Sitecore API called to perform the publish is different with this switch. You may find that events fire as expected using this. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +Language of the item that should be published. Supports globbing/wildcards. Allows for more than one language to be provided at once. e.g. "en\*", "pl-pl" + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item that should be published - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item that should be published - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* None. + +## Notes + +Help Author: Michael West, Adam Najmanowicz + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\> Publish-Item -Path master:\content\home -Target Internet +``` + +### EXAMPLE 2 + +```powershell +PS master:\> Get-Item -Path master:\content\home | Publish-Item -Recurse -PublishMode Incremental +``` + +### EXAMPLE 3 + +```powershell +PS master:\> Get-Item -Path master:\content\home | Publish-Item -Recurse -Language "en*" +``` + +### EXAMPLE 4 +Publish to many databases +```text +PS master:\> $targets = [string[]]@('web','internet') +PS master:\> Publish-Item -Path master:\content\home -Target $targets +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/read-variable.md b/appendix/common/read-variable.md new file mode 100644 index 00000000..7b099941 --- /dev/null +++ b/appendix/common/read-variable.md @@ -0,0 +1,252 @@ +# Read-Variable + +Prompts user to provide values for variables required by the script to perform its operation. + +## Syntax + +```powershell +Read-Variable [-Parameters ] [-Description ] [-CancelButtonName ] [-OkButtonName ] [-ShowHints] [-Validator ] [-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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Parameters <Object\[\]> + +Specifies the variables that value should be provided by the user. Each variable definition can have the following structure: + +* Name - the name of the PowerShell variable - without the $ sign +* Value - the initial value of the variable - if the variable have not been created prior to launching the dialog - this will be its value unless the user changes it. if Value is not specified - the existing variable name will be used. +* Title - The title for the variable shown above the variable editor. +* Tooltip - The hint describing the parameter further - if the -ShowHints parameter is provided this value will show between the Variable Title and the variable editor. +* Editor - If the default editor selected does not provide the functionality expected - you can specify this value to customize it \(see examples\) +* Tab - if this parameter is specified on any Variable the multi-tab dialog will be used instead of a simple one. Provide the tab name on which the variable editor should appear. + +Variable type specific: + +* Root - for some Item selecting editors you can provide this to limit the selection to only part of the tree +* Source - for some Item selecting editors you can provide this to parametrize the item selection editor. \(Refer to examples for some sample usages\) +* Lines - for String variable you can select this parameter if you want to present the user with the multiline editor. The for this parameter is the number of lines that the editor will be configured with. +* Domain - for user and role selectors you can limit the users & roles presented to only the domain - specified\) + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Description <String> + +Dialog description displayed below the dialog title. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -CancelButtonName <String> + +Text shown on the cancel button. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -OkButtonName <String> + +Text shown on the OK button. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ShowHints <SwitchParameter> + +Specifies whether the variable hints should be displayed. Hints are shown below each the variable title but above the variable editing control. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Validator <ScriptBlock> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Title <String> + +Dialog title - shown at the top of the dialog. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Width <Int32> + +Dialog width. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Height <Int32> + +Dialog width. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +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 + +The following provides a dialog with a dropdown of options, and how to read the selected value. + +```powershell +$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 +} + +$result = Read-Variable @props + +if($result -eq "ok") +{ + Write-Host "You chose: $($selectedOption)" +} +``` + +### 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 + +```powershell +$item = Get-Item master:\content\home +$result = Read-Variable -Parameters ` + @{ Name = "someText"; Value="Some Text"; Title="Single Line Text"; Tooltip="Tooltip for singleline"; Placeholder="You see this when text box is empty"}, + @{ Name = "multiText"; Value="Multiline Text"; Title="Multi Line Text"; lines=3; Tooltip="Tooltip for multiline"; Placeholder="You will see this when text box is empty"}, + @{ Name = "from"; Value=[System.DateTime]::Now.AddDays(-5); Title="Start Date"; Tooltip="Date since when you want the report to run"; Editor="date time"}, + @{ Name = "user"; Value=$me; Title="Select User"; Tooltip="Tooltip for user"; Editor="user multiple"}, + @{ Name = "item"; Title="Start Item"; Root="/sitecore/content/"} ` + -Description "This Dialog shows less editors, it doesn't need tabs as there is less of the edited variables" ` + -Title "Initialise various variable types (without tabs)" -Width 500 -Height 480 -OkButtonName "Proceed" -CancelButtonName "Abort" +``` + +### 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 inferred from the variable type \(like the $item variable or DateTime\) The editors for some other are set by providing the "editor" value + +```powershell +$item = Get-Item master:\content\home +$result = Read-Variable -Parameters ` + @{ Name = "silent"; Value=$true; Title="Proceed Silently"; Tooltip="Check this if you don't want to be interrupted"; Tab="Simple"}, + @{ Name = "someText"; Value="Some Text"; Title="Text"; Tooltip="Just a single line of Text"; Tab="Simple"; Placeholder="You see this when text box is empty"}, + @{ Name = "multiText"; Value="Multiline Text"; Title="Longer Text"; lines=3; Tooltip="You can put multi line text here"; Tab="Simple"; Placeholder="You see this when text box is empty"}, + @{ Name = "number"; Value=110; Title="Integer"; Tooltip="I need this number too"; Tab="Simple"}, + @{ Name = "fraction"; Value=1.1; Title="Float"; Tooltip="I'm just a bit over 1"; Tab="Simple"}, + @{ Name = "from"; Value=[System.DateTime]::Now.AddDays(-5); Title="Start Date"; Tooltip="Date since when you want the report to run"; Editor="date time"; Tab="Time"}, + @{ Name = "fromDate"; Value=[System.DateTime]::Now.AddDays(-5); Title="Start Date"; Tooltip="Date since when you want the report to run"; Editor="date"; Tab="Time"}, + @{ 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&IncludeTemplatesForSelection=Template"; + editor="treelist"; Tab="Items"}, + @{ Name = "items2"; Title="Bunch of Templates"; + Source="DataSource=/sitecore/templates&DatabaseName=master&IncludeTemplatesForDisplay=Node,Folder,Template,Template Folder&IncludeTemplatesForSelection=Template"; + editor="multilist"; Tab="More Items"}, + @{ Name = "items3"; Title="Pick One Template"; + Source="DataSource=/sitecore/templates&DatabaseName=master&IncludeTemplatesForDisplay=Node,Folder,Template,Template Folder&IncludeTemplatesForSelection=Template"; + 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="sitecore"; Tab="Rights" } ` + -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 "Abort" -ShowHints +if($result -ne "ok") +{ + Exit +} +``` + +## Related Topics + +* [Show-Alert](show-alert.md) +* [Show-Application](show-application.md) +* [Show-Confirm](show-confirm.md) +* [Show-FieldEditor](show-fieldeditor.md) +* [Show-Input](show-input.md) +* [Show-ListView](show-listview.md) +* [Show-ModalDialog](show-modaldialog.md) +* [Show-YesNoCancel](show-yesnocancel.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/receive-file.md b/appendix/common/receive-file.md new file mode 100644 index 00000000..baf8b163 --- /dev/null +++ b/appendix/common/receive-file.md @@ -0,0 +1,244 @@ +# 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 <String>\] \[-ParentItem\] <Item> \[-Title <String>\] \[-CancelButtonName <String>\] \[-OkButtonName <String>\] \[-Versioned\] \[-Language <String>\] \[-Overwrite\] \[-Unpack\] \[-Width <Int32>\] \[-Height <Int32>\] + +Receive-File \[-Description <String>\] \[-Path\] <String> \[-Title <String>\] \[-CancelButtonName <String>\] \[-OkButtonName <String>\] \[-Overwrite\] \[-Unpack\] \[-Width <Int32>\] \[-Height <Int32>\] + +Receive-File \[-ParentItem\] <Item> -AdvancedDialog \[-Width <Int32>\] \[-Height <Int32>\] + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Description <String> + +Dialog description displayed below the dialog title. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ParentItem <Item> + +The item under which the uploaded media items should be stored. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the folder where uploaded file should be stored. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Title <String> + +Dialog title - shown at the top of the dialog. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -CancelButtonName <String> + +Text shown on the cancel button. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -OkButtonName <String> + +Text shown on the OK button. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Versioned <SwitchParameter> + +Indicates that the Media item should be created as a Versioned media item. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String> + +Specifies the language in which the media item should be created. if not specified - context language is selected. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Overwrite <SwitchParameter> + +indicates that the upload should overwrite a file or a media item if that one exists. Otherwise a file with a non-confilicting name or a sibling media item is created. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Unpack <SwitchParameter> + +Indicates that the uplaod is expected to be a ZIP file which should be unpacked when it's received. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -AdvancedDialog <SwitchParameter> + +Shows advanced dialog where user can upload multiple media items and select if the uploaded items are versioned, overwritten and unpacked. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Width <Int32> + +Dialog width. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Height <Int32> + +Dialog width. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + + System.String + +## Outputs + +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 + +```powershell +PS master:\> Receive-File -Path "C:\temp\upload" +C:\temp\upload\text_029.txt +``` + +### EXAMPLE 2 + +Upload text.txt file to media library under the 'master:\media library\Files' item A new media item is created and returned + +```powershell +PS master:\> Receive-File -ParentItem (get-item "master:\media library\Files") +Name Children Languages Id TemplateName +---- -------- --------- -- ------------ +text False {en} {7B11CE12-C0FC-4650-916C-2FC76F3DCAAF} File +``` + +### EXAMPLE 3 + +Upload text.txt file to media library under the 'master:\media library\Files' item using advanced dialog. A new media item is created but "undetermined" is returned as the dialog does not return the results. + +```powershell +PS master:\> Receive-File (get-item "master:\media library\Files") -AdvancedDialog +undetermined +``` + +### EXAMPLE 4 + +Upload text.txt file to media library under the 'master:\media library\Files' item. A new versioned media item in Danish language is created and returned. If the media item existed - it will be overwritten. + +```powershell +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 + +* [Send-File](send-file.md) +* [Out-Download](out-download.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/receive-itemclonenotification.md b/appendix/common/receive-itemclonenotification.md new file mode 100644 index 00000000..0b1e3f42 --- /dev/null +++ b/appendix/common/receive-itemclonenotification.md @@ -0,0 +1,116 @@ +# Receive-ItemCloneNotification + +## Syntax + +```powershell +Receive-ItemCloneNotification [-Notification ] -Notification -Action [-NotificationType ] [-Language ] +Receive-ItemCloneNotification [-Item] -Notification -Action [-NotificationType ] [-Language ] +Receive-ItemCloneNotification [-Path] -Notification -Action [-NotificationType ] [-Language ] +Receive-ItemCloneNotification -Id [-Database ] -Notification -Action [-NotificationType ] [-Language ] +``` + +## Detailed Description + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Notification  <Notification> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Action  <NotificationAction> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -NotificationType  <NotificationType> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language  <String\[\]> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item  <Item> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path  <String> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id  <String> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database  <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Examples + +### EXAMPLE 1 + +The following gets the cloned `Item`, returns the available notifications, and finally accepts the notifications. + +```powershell +$clonedItem = Get-Item -Path "master:" -ID "{9F158637-52C2-4005-8329-21527685CB71}" +$clonedItem | Get-ItemCloneNotification | Receive-ItemCloneNotification -Action Accept +``` + +### EXAMPLE 2 + +The following gets the cloned `Item`, returns the available notifications, and finally rejects the notifications. + +```powershell +$clonedItem = Get-Item -Path "master:" -ID "{9F158637-52C2-4005-8329-21527685CB71}" +$clonedItem | Get-ItemCloneNotification | Receive-ItemCloneNotification -Action Reject +``` diff --git a/appendix/common/remove-archiveitem.md b/appendix/common/remove-archiveitem.md new file mode 100644 index 00000000..d9e1c204 --- /dev/null +++ b/appendix/common/remove-archiveitem.md @@ -0,0 +1,125 @@ +# Remove-ArchiveItem + +Removes items permanently from the specified archive. + +## Syntax + +```powershell +Remove-ArchiveItem -Archive [-ItemId ] +Remove-ArchiveItem -Archive [-Identity ] +Remove-ArchiveItem -Archive [-ArchiveItem ] +``` + +## Detailed Description + +The Remove-ArchiveItem command permanently removes entries from specified archive. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Archive <Archive> + +Specifies the archive to use when determining which ArchiveEntry items to remove. Use Get-Archive to find the appropriate archive. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false| +| Accept Wildcard Characters? | false | + +### -ItemId <ID> + +Specifies the ID for the original item that should be processed. This is NOT the ArchivalId. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Identity <AccountIdentity> + +Specifies the user responsible for moving the item to the archive. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -ArchiveItem <ArchiveEntry\[\]> + +Specific items from the archive may be deleted when using this parameter. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +## Inputs + +* AccountIdentity +* Sitecore.Data.Archiving.ArchiveEntry + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* None. + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +The following removes items matching the ItemId found in the specified archive. + +```powershell +$database = Get-Database -Name "master" +$archiveName = "recyclebin" +$archive = Get-Archive -Database $database -Name $archiveName +Remove-ArchiveItem -Archive $archive -ItemId "{1BB32980-66B4-4ADA-9170-10A9D3336613}" +``` + +### EXAMPLE 2 + +The following removes items from the recycle bin by the user found in the specified archive. + +```powershell +$database = Get-Database -Name "master" +$archiveName = "recyclebin" +$archive = Get-Archive -Database $database -Name $archiveName +Remove-ArchiveItem -Archive $archive -Identity "sitecore\admin" +``` + +### EXAMPLE 3 + +The following removes all items from the recycle bin found in the specified archive. + +```powershell +$database = Get-Database -Name "master" +$archiveName = "recyclebin" +$archive = Get-Archive -Database $database -Name $archiveName +Get-ArchiveItem -Archive $archive | Remove-ArchiveItem +``` + +## Related Topics + +* Get-ArchiveItem +* Restore-ArchiveItem +* Remove-Item +* Remove-ItemVersion +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) \ No newline at end of file diff --git a/appendix/common/remove-basetemplate.md b/appendix/common/remove-basetemplate.md new file mode 100644 index 00000000..6d872f9f --- /dev/null +++ b/appendix/common/remove-basetemplate.md @@ -0,0 +1,137 @@ +# Remove-BaseTemplate + +Remove one or more base templates from a template item. + +## Syntax + +Remove-BaseTemplate -Item <Item> -TemplateItem <TemplateItem\[\]> + +Remove-BaseTemplate -Item <Item> -Template <String\[\]> + +Remove-BaseTemplate -Path <String> -TemplateItem <TemplateItem\[\]> + +Remove-BaseTemplate -Path <String> -Template <String\[\]> + +Remove-BaseTemplate -Id <String> -TemplateItem <TemplateItem\[\]> + +Remove-BaseTemplate -Id <String> -Template <String\[\]> + +Remove-BaseTemplate \[-Database <String>\] + +## Detailed Description + +The Remove-BaseTemplate command removes one or more base templates from a template item. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Item <Item> + +The item to remove the base template from. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to remove the base template from. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to remove the base template from. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -TemplateItem <TemplateItem\[\]> + +Sitecore item or list of items of base templates to remove. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Template <String\[\]> + +Path representing the template item to remove as a base template. This must be of the same database as the item to be altered. Note that this parameter only supports a single template. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to remove the base template from - required if item is specified with Id. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West, Alex Washtell + +## Examples + +### EXAMPLE 1 + +Remove base template of /sitecore/templates/User Defined/BaseTemplate from a template, using a path. + +```powershell +PS master:\> Remove-BaseTemplate -Path "master:/sitecore/content/User Defined/Page" -Template "/sitecore/templates/User Defined/BaseTemplate" +``` + +### EXAMPLE 2 + +Remove multiple base templates from a template, using items. + +```powershell +PS master:\> $baseA = Get-Item -Path master:/sitecore/content/User Defined/BaseTemplateA + PS master:\> $baseB = Get-Item -Path master:/sitecore/content/User Defined/BaseTemplateB + PS master:\> Remove-BaseTemplate -Path "master:/sitecore/content/User Defined/Page" -TemplateItem @($baseA, $baseB) +``` + +## Related Topics + +* [Add-BaseTemplate](add-basetemplate.md) +* [Get-ItemTemplate](get-itemtemplate.md) +* [Set-ItemTemplate](set-itemtemplate.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/remove-itemversion.md b/appendix/common/remove-itemversion.md new file mode 100644 index 00000000..ca5f4266 --- /dev/null +++ b/appendix/common/remove-itemversion.md @@ -0,0 +1,209 @@ +# Remove-ItemVersion + +Removes Language/Version from a single item or a branch of items + +## Syntax + +```powershell +Remove-ItemVersion -Language [-Version ] [-ExcludeLanguage ] [-Path] [-Recurse] [-MaxRecentVersions ] + +Remove-ItemVersion -Language [-Version ] [-ExcludeLanguage ] -Id [-Database ] [-Recurse] [-MaxRecentVersions ] + +Remove-ItemVersion [-Language ] [-Version ] [-ExcludeLanguage ] [-Item] [-Recurse] [-MaxRecentVersions ] +``` + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Aliases + +The following abbreviations are aliases for this cmdlet: + +* Remove-ItemLanguage + +## Parameters + +### -Recurse <SwitchParameter> + +Deleted language versions from the item and all of its children. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +Language\(s\) that should be deleted form the provided item\(s\). A single language or a list of languages can be defined using the parameter. Language parameter supports globbing so you can delete whole language groups using wildcards. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Version <String\[\]> + +Version\(s\) that should be deleted form the provided item\(s\). A single version or a list of versions can be defined using the parameter. Version parameter supports globbing so you can delete whole version groups using wildcards. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ExcludeLanguage <String\[\]> + +Language\(s\) that should NOT be deleted form the provided item\(s\). A single language or a list of languages can be defined using the parameter. Language parameter supports globbing so you can delete whole language groups using wildcards. + +If Language parameter is not is not specified but ExcludeLanguage is provided, the default value of "\*" is assumed for Language parameter. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -MaxRecentVersions <Int32> + +If provided - trims the selected language to value specified by this parameter. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item/version to be processed. You can pipe a specific version of the item for it to be removed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Archive <SwitchParameter> + +Specifying this switch will move the items to the archive rather than recycle bin. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Remove Polish and Spanish language from /sitecore/content/home item in the master database + +```powershell +Remove-ItemVersion -Path master:\content\home -Language "pl-pl", "es-es" +``` + +### EXAMPLE 2 + +Remove all english based languages defined in /sitecore/content/home item and all of its children in the master database + +```powershell +Remove-ItemVersion -Path master:\content\home -Language "en-*" -Recurse +``` + +### EXAMPLE 3 + +Remove all languages except those that are "en" based defined in /sitecore/content/home item and all of its children in the master database + +```powershell +Remove-ItemVersion -Path master:\content\home -ExcludeLanguage "en*" -Recurse +``` + +### EXAMPLE 4 + +Trim all languages to 3 latest versions for /sitecore/content/home item and all of its children in the master database + +```powershell +Remove-ItemVersion -Path master:\content\home -Language * -MaxRecentVersions 3 -Recurse +``` + +### EXAMPLE 5 + +The following moves the specified item version to the archive. + +```powershell +$itemId = "{72EB19F8-E62A-4B99-80A3-63E03F4FD036}" +Get-Item -Path "master:" -ID $itemId -Version 2 | Remove-ItemVersion -Archive +``` + +## Related Topics + +* [Add-ItemVersion](add-itemversion.md) +* Remove-Item +* [https://gist.github.com/AdamNaj/b36ea095e3668c22c07e](https://gist.github.com/AdamNaj/b36ea095e3668c22c07e) + diff --git a/appendix/common/reset-itemfield.md b/appendix/common/reset-itemfield.md new file mode 100644 index 00000000..f7af075f --- /dev/null +++ b/appendix/common/reset-itemfield.md @@ -0,0 +1,149 @@ +# Reset-ItemField + +Resets item fields, specified as either names, fields or template fields. + +## Syntax + +```powershell +Reset-ItemField [-Item] [-IncludeStandardFields] [-Name ] +Reset-ItemField [-Path] [-IncludeStandardFields] [-Name ] +Reset-ItemField -Id [-Database ] [-IncludeStandardFields] [-Name ] +``` + +## Detailed Description + +Resets item fields, specified as either names, fields or template fields. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -IncludeStandardFields <SwitchParameter> + +Includes fields that are defined on "Standard template" + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Name <String\[\]> + +Array of field names to include - supports wildcards. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be analysed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be analysed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be analysed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be reset - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* None + +## Notes + +Help Author: Adam Najmanowicz, Michael West, Alex Washtell + +## Examples + +### EXAMPLE 1 + +Reset all item fields, excluding standard fields. + +```powershell +PS master:\> Reset-ItemField -Path master:\content\home +``` + +### EXAMPLE 2 + +Reset all item fields, including standard fields. + +```powershell +PS master:\> Reset-ItemField -Path master:\content\home -IncludeStandardFields +``` + +### EXAMPLE 3 + +Reset all item fields with names beginning with "a", excluding standard fields. + +```powershell +PS master:\> Get-Item master:\content\home | Reset-ItemField -Name "a*" +``` + +### EXAMPLE 4 + +The following resets one of the Standard Values fields for all versions and languages. + +```powershell +Get-ChildItem -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" -Version * -Language * -Recurse | + Reset-ItemField -Name "__Workflow State" -IncludeStandardFields +``` + +## Related Topics + +* [Get-ItemTemplate](get-itemtemplate.md) +* [Get-ItemField](get-itemfield.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/restart-application.md b/appendix/common/restart-application.md new file mode 100644 index 00000000..987af5d0 --- /dev/null +++ b/appendix/common/restart-application.md @@ -0,0 +1,30 @@ +# Restart-Application + +Restarts the Sitecore Application pool. + +## Syntax + +## Detailed Description + +Restarts the Sitecore Application pool. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> Restart-Application +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/restore-archiveitem.md b/appendix/common/restore-archiveitem.md new file mode 100644 index 00000000..3b3b0609 --- /dev/null +++ b/appendix/common/restore-archiveitem.md @@ -0,0 +1,126 @@ +# Remove-ArchiveItem + +Restores items to the original database from the specified archive. + +## Syntax + +```powershell +Restore-ArchiveItem -Archive [-WhatIf] [-Confirm] [] +Restore-ArchiveItem -Archive [-ItemId ] [-WhatIf] [-Confirm] [] +Restore-ArchiveItem -Archive [-Identity ] [-WhatIf] [-Confirm] [] +Restore-ArchiveItem -ArchiveItem [-WhatIf] [-Confirm] [] +``` + +## Detailed Description + +The Restore-ArchiveItem command restores entries from specified archive back to the original database. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Archive <Archive> + +Specifies the archive to use when determining which ArchiveEntry items to process. Use Get-Archive to find the appropriate archive. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false| +| Accept Wildcard Characters? | false | + +### -ItemId <ID> + +Specifies the ID for the original item that should be processed. This is NOT the ArchivalId. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Identity <AccountIdentity> + +Specifies the user responsible for moving the item to the archive. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -ArchiveItem <ArchiveEntry\[\]> + +Specific items from the archive may be restored when using this parameter. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +## Inputs + +* AccountIdentity +* Sitecore.Data.Archiving.ArchiveEntry + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* None. + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +The following restores items matching the ItemId found in the specified archive. + +```powershell +$database = Get-Database -Name "master" +$archiveName = "recyclebin" +$archive = Get-Archive -Database $database -Name $archiveName +Restore-ArchiveItem -Archive $archive -ItemId "{1BB32980-66B4-4ADA-9170-10A9D3336613}" +``` + +### EXAMPLE 2 + +The following restores items from the recycle bin by the user found in the specified archive. + +```powershell +$database = Get-Database -Name "master" +$archiveName = "recyclebin" +$archive = Get-Archive -Database $database -Name $archiveName +Restore-ArchiveItem -Archive $archive -Identity "sitecore\admin" +``` + +### EXAMPLE 3 + +The following restores all items from the recycle bin found in the specified archive. + +```powershell +$database = Get-Database -Name "master" +$archiveName = "recyclebin" +$archive = Get-Archive -Database $database -Name $archiveName +Get-ArchiveItem -Archive $archive | Restore-ArchiveItem +``` + +## Related Topics + +* Get-ArchiveItem +* Restore-ArchiveItem +* Remove-Item +* Remove-ItemVersion +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) diff --git a/appendix/common/send-file.md b/appendix/common/send-file.md new file mode 100644 index 00000000..52021e9b --- /dev/null +++ b/appendix/common/send-file.md @@ -0,0 +1,160 @@ +# Send-File + +Allows users to download files from server and file items from media library. + +## Syntax + +Send-File \[-Path\] <String> \[-Message <String>\] \[-NoDialog\] \[-ShowFullPath\] \[-Title <String>\] \[-Width <Int32>\] \[-Height <Int32>\] + +Send-File \[-Item\] <Item> \[-Message <String>\] \[-NoDialog\] \[-ShowFullPath\] \[-Title <String>\] \[-Width <Int32>\] \[-Height <Int32>\] + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Aliases + +The following abbreviations are aliases for this cmdlet: + +* Download-File + +## Parameters + +### -Path <String> + +Path to the file to be downloaded. The file has to exist in the Data folder. Files from outside the Data folder are not downloadable. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Message <String> + +Message to show the user in the download dialog. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be downloaded. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -NoDialog <SwitchParameter> + +If this parameter is used the Dialog will not be shown but instead the file download will begin immediately. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ShowFullPath <SwitchParameter> + +If this parameter is used the Dialog will display full path to the file downloaded in the dialog, otherwise only the file name will be shown. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Title <String> + +Download dialog title. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Width <Int32> + +Download dialog width. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Height <Int32> + +Download dialog height. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* System.String + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Download File from server disk drive + +```powershell +PS master:\> Send-File -Path "C:\Projects\ZenGarden\Data\packages\Sitecore PowerShell Extensions-6.0.zip" +``` + +### EXAMPLE 2 + +Download item from media library + +```powershell +PS master:\> Get-Item "master:/media library/Showcase/awesome_logo" | Send-File -Message "Awesome Logo" +``` + +## Related Topics + +* [Receive-File](receive-file.md) +* [Out-Download](out-download.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/send-sheermessage.md b/appendix/common/send-sheermessage.md new file mode 100644 index 00000000..ea51ca6d --- /dev/null +++ b/appendix/common/send-sheermessage.md @@ -0,0 +1,66 @@ +# Send-SheerMessage + +Sends a sheer message to the app in which context the script is executing. + +## Syntax + +Send-SheerMessage \[-Name\] <String> \[-GetResult\] \[-Parameters <Hashtable>\] + +## Detailed Description + +Sends a sheer message to the app in which context the script is executing. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Name <String> + +Name of the Sheer message to execute. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -GetResult <SwitchParameter> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Parameters <Hashtable> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +If you execute the following script in the PowerShell ISE the Save dialog will popup + +```powershell +Send-SheerMessage -Name 'ise:save' +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/set-hostproperty.md b/appendix/common/set-hostproperty.md new file mode 100644 index 00000000..203c70bd --- /dev/null +++ b/appendix/common/set-hostproperty.md @@ -0,0 +1,90 @@ +# Set-HostProperty + +Sets the current host property. + +## Syntax + +Set-HostProperty \[-ForegroundColor <Black \| DarkBlue \| DarkGreen \| DarkCyan \| DarkRed \| DarkMagenta \| DarkYellow \| Gray \| DarkGray \| Blue \| Green \| Cyan \| Red \| Magenta \| Yellow \| White>\] \[-BackgroundColor <Black \| DarkBlue \| DarkGreen \| DarkCyan \| DarkRed \| DarkMagenta \| DarkYellow \| Gray \| DarkGray \| Blue \| Green \| Cyan \| Red \| Magenta \| Yellow \| White>\] \[-HostWidth <Int32>\] \[-Persist\] + +## Detailed Description + +Sets the current host property and perssits them for the future if used with -Persist parameter. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -ForegroundColor <ConsoleColor> + +Color of the console text. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -BackgroundColor <ConsoleColor> + +Color of the console background. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -HostWidth <Int32> + +Width of the text buffer \(texts longer than the number provided will wrap to the next line. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Persist <SwitchParameter> + +Persist the console setting provided + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Set width of the console buffer to 80 and persist it for the future instances + +```powershell +PS master:\> Set-HostProperty -HostWidth 80 -Persist +``` + +### EXAMPLE 2 + +Set color of the console text to cyan. Next instance of the console will revert to default \(white\). + +```powershell +PS master:\> Set-HostProperty -ForegroundColor Cyan +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/set-itemtemplate.md b/appendix/common/set-itemtemplate.md new file mode 100644 index 00000000..0ec07455 --- /dev/null +++ b/appendix/common/set-itemtemplate.md @@ -0,0 +1,156 @@ +# Set-ItemTemplate + +Sets the item template. + +## Syntax + +```powershell +Set-ItemTemplate -Item -TemplateItem [-FieldsToCopy ] +Set-ItemTemplate -Item -Template [-FieldsToCopy ] +Set-ItemTemplate -Path -TemplateItem [-FieldsToCopy ] +Set-ItemTemplate -Path -Template [-FieldsToCopy ] +Set-ItemTemplate -Id -TemplateItem [-FieldsToCopy ] +Set-ItemTemplate -Id -Template [-FieldsToCopy ] +Set-ItemTemplate [-Database ] [-FieldsToCopy ] +``` + +## Detailed Description + +The Set-ItemTemplate command sets the template for an item. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Item <Item> + +The item to set the template for. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to set the template for. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to set the template for. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -TemplateItem <TemplateItem> + +Sitecore item representing the template. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Template <String> + +Path representing the template item. This must be of the same database as the item to be altered. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -FieldsToCopy <Hashtable> + +Hashtable of key value pairs mapping the old template field to a new template field. + +@{"Title"="Headline";"Text"="Copy"} + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to set the template for - required if item is specified with Id. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West, Alex Washtell + +## Examples + +### EXAMPLE 1 + +Set template of /sitecore/content/home item using a Template path. + +```powershell +Set-ItemTemplate -Path master:/sitecore/content/home -Template "/sitecore/templates/User Defined/Page" +``` + +### EXAMPLE 2 + +Set template of /sitecore/content/home item using a TemplateItem. + +```powershell +$template = Get-ItemTemplate -Path master:\content\home\page1 +Set-ItemTemplate -Path master:\content\home\page2 -TemplateItem $template +``` + +### EXAMPLE 3 + +Set the template and remap fields to their new name. + +```powershell +Set-ItemTemplate -Path "master:\content\home\Page1" ` + -Template "User Defined/Target" ` + -FieldsToCopy @{Field1="Field4"; Field2="Field5"; Field3="Field6"} +``` + +## Related Topics + +* [Get-ItemTemplate](get-itemtemplate.md) +* [Add-BaseTemplate](add-basetemplate.md) +* [Remove-BaseTemplate](remove-basetemplate.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/show-alert.md b/appendix/common/show-alert.md new file mode 100644 index 00000000..3bfd5608 --- /dev/null +++ b/appendix/common/show-alert.md @@ -0,0 +1,53 @@ +# Show-Alert + +Pauses the script and shows an alert to the user. + +## Syntax + +Show-Alert \[-Title\] <String> + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Title <String> + +Text to show the user in the alert dialog. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> Show-Alert "Hello world." +``` + +## Related Topics + +* [Read-Variable](read-variable.md) +* [Show-Application](show-application.md) +* [Show-Confirm](show-confirm.md) +* [Show-FieldEditor](show-fieldeditor.md) +* [Show-Input](show-input.md) +* [Show-ListView](show-listview.md) +* [Show-ModalDialog](show-modaldialog.md) +* [Show-Result](show-result.md) +* [Show-YesNoCancel](show-yesnocancel.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/show-application.md b/appendix/common/show-application.md new file mode 100644 index 00000000..2ba4a42a --- /dev/null +++ b/appendix/common/show-application.md @@ -0,0 +1,150 @@ +# Show-Application + +Executes Sitecore Sheer application. + +## Syntax + +Show-Application \[-Application\] <String> \[\[-Parameter\] <Hashtable>\] \[-Icon <String>\] \[-Modal\] \[-Title <String>\] \[-Width <Int32>\] \[-Height <Int32>\] + +## Detailed Description + +Executes Sitecore Sheer application, allows for passing additional parameters, launching it on desktop in cooperative or in Modal mode. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Application <String> + +Name of the Application to be executed. Application must be defined in the Core databse. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Parameter <Hashtable> + +Additional parameters passed to the application. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 2 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Icon <String> + +Icon of the executed application \(used for titlebar and in the Sitecore taskbar on the desktop\) + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Modal <SwitchParameter> + +Causes the application to show in new browser modal window or modal overlay if used in Sitecore 7.2 or later. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Title <String> + +Title of the window the app opens in. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Width <Int32> + +Width of the modal window. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Height <Int32> + +Height of the modal window. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Show Content Editor in new window \(or as an overlay in modal mode in Sitecore 7.2+\) with "/sitecore/templates" item selected. + +```powershell +$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="$($item.Database.Name)"} ` + -Modal -Width 1600 -Height 800 +``` + +### EXAMPLE 2 + +Show Content Editor as a new application on desktop with "/sitecore/content/home" item selected. + +```powershell +$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="$($item.Database.Name)"} ` +``` + +## Related Topics + +* [Read-Variable](read-variable.md) +* [Show-Alert](show-alert.md) +* [Show-Confirm](show-confirm.md) +* [Show-FieldEditor](show-fieldeditor.md) +* [Show-Input](show-input.md) +* [Show-ListView](show-listview.md) +* [Show-ModalDialog](show-modaldialog.md) +* [Show-Result](show-result.md) +* [Show-YesNoCancel](show-yesnocancel.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/show-confirm.md b/appendix/common/show-confirm.md new file mode 100644 index 00000000..4ba05ee9 --- /dev/null +++ b/appendix/common/show-confirm.md @@ -0,0 +1,61 @@ +# Show-Confirm + +Shows a user a confirmation request message box. + +## Syntax + +Show-Confirm \[-Title\] <String> + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Title <String> + +Text to show the user in the dialog. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* System.String + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> Show-Confirm -Title "Do you like Sitecore PowerShell Extensions?" + +yes +``` + +## Related Topics + +* [Read-Variable](read-variable.md) +* [Show-Alert](show-alert.md) +* [Show-Application](show-application.md) +* [Show-FieldEditor](show-fieldeditor.md) +* [Show-Input](show-input.md) +* [Show-ListView](show-listview.md) +* [Show-ModalDialog](show-modaldialog.md) +* [Show-Result](show-result.md) +* [Show-YesNoCancel](show-yesnocancel.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/show-fieldeditor.md b/appendix/common/show-fieldeditor.md new file mode 100644 index 00000000..dde0bea0 --- /dev/null +++ b/appendix/common/show-fieldeditor.md @@ -0,0 +1,231 @@ +# Show-FieldEditor + +Shows Field editor for a provided item. + +## Syntax + +Show-FieldEditor -Item <Item> -PreserveSections \[-Name <String\[\]>\] \[-Title <String>\] \[-Width <Int32>\] \[-Height <Int32>\] \[-IncludeStandardFields\] + +Show-FieldEditor -Item <Item> \[-SectionTitle <String>\] \[-SectionIcon <String>\] \[-Name <String\[\]>\] \[-Title <String>\] \[-Width <Int32>\] \[-Height <Int32>\] \[-IncludeStandardFields\] + +Show-FieldEditor -Path <String> \[-Language <String\[\]>\] -PreserveSections \[-Name <String\[\]>\] \[-Title <String>\] \[-Width <Int32>\] \[-Height <Int32>\] \[-IncludeStandardFields\] + +Show-FieldEditor -Path <String> \[-Language <String\[\]>\] \[-SectionTitle <String>\] \[-SectionIcon <String>\] \[-Name <String\[\]>\] \[-Title <String>\] \[-Width <Int32>\] \[-Height <Int32>\] \[-IncludeStandardFields\] + +Show-FieldEditor -Id <String> \[-Database <String>\] \[-Language <String\[\]>\] -PreserveSections \[-Name <String\[\]>\] \[-Title <String>\] \[-Width <Int32>\] \[-Height <Int32>\] \[-IncludeStandardFields\] + +Show-FieldEditor -Id <String> \[-Database <String>\] \[-Language <String\[\]>\] \[-SectionTitle <String>\] \[-SectionIcon <String>\] \[-Name <String\[\]>\] \[-Title <String>\] \[-Width <Int32>\] \[-Height <Int32>\] \[-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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Name <String\[\]> + +Array of names of the fields to be edited. + +This parameter supports globbing so you can simply use "_" to allow editing of all fields. If a field is prefixed with a dash - this field will be excluded from the list of fields. e.g. the following will display all fields except title from Show-FieldEditor -Path "master:\content\home" -Name "_", "-Title" + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Title <String> + +Title of the dialog containing the field editor. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Width <Int32> + +Width of the dialog containing the field editor. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Height <Int32> + +Height of the dialog containing the field editor. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -IncludeStandardFields <SwitchParameter> + +Add this parameter to add standard fields to the list that is being considered to be displayed + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be edited. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be edited - additionally specify Language parameter to fetch different item language than the current user language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the the item to be edited - additionally specify Language parameter to fetch different item language than the current user language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be edited - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +Language that will be edited. If not specified the current user language will be used. Globbing/wildcard supported. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -PreserveSections <SwitchParameter> + +If added this parameter tells editor to preserve the original item field sections, otherwise all fields are placed in a single section Named by SectionTitle parameter and having the SectionIcon icon. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -SectionTitle <String> + +If PreserveSections is not added to parameters - this parameter provides a title for the global section all fields are placed under. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -SectionIcon <String> + +If PreserveSections is not added to parameters - this parameter provides a iconfor the global section all fields are placed under. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* System.String + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Show field editor that shows all non-standard fields on sitecore/content/home item except for field "title" The dialog will be titled "My Home Item" all fields inside will be in single section. + +```powershell +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. + +```powershell +PS master:\> Get-Item "master:\content\home" | Show-FieldEditor -Name "*" -IncludeStandardFields -PreserveSections +``` + +## Related Topics + +* [Read-Variable](read-variable.md) +* [Show-Alert](show-alert.md) +* [Show-Application](show-application.md) +* [Show-Confirm](show-confirm.md) +* [Show-Input](show-input.md) +* [Show-ListView](show-listview.md) +* [Show-ModalDialog](show-modaldialog.md) +* [Show-Result](show-result.md) +* [Show-YesNoCancel](show-yesnocancel.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/show-input.md b/appendix/common/show-input.md new file mode 100644 index 00000000..ecce9bac --- /dev/null +++ b/appendix/common/show-input.md @@ -0,0 +1,129 @@ +# Show-Input + +Shows prompt message box asking user to provide a text string. + +## Syntax + +Show-Input \[-Prompt\] <String> \[-DefaultValue <String>\] \[-Validation <String>\] \[-ErrorMessage <String>\] \[-MaxLength <Int32>\] + +## Detailed Description + +Shows prompt message box asking user to provide a text string. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Prompt <String> + +Prompt message to show in the message box shown to a user. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -DefaultValue <String> + +Default value to be provided for the text box. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Validation <String> + +Regex for value validation. If user enters a value that does not validate - en error message defined with the "ErrorMessage" parameter will be shown and user will be asked to enter the value again. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ErrorMessage <String> + +Error message to show when regex validation fails. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -MaxLength <Int32> + +Maximum length of the string returned. If user enters a longer value - en error message will be shown and user will be asked to enter the value again. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* System.String + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Requests that the user provides an email, validates it against a regular expression snd whows an allert if the format is not valid + +```powershell +PS master:\> Show-Input "Please provide your email" -DefaultValue "my@email.com" -Validation "^[a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$" -ErrorMessage "Not a proper email!" +``` + +### 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\) + +```powershell +PS master:\> $contentItem = get-item master:\content +PS master:\> $newName = Show-Input "Please provide the new name for the '$($contentItem.Name)' Item" -DefaultValue $contentItem.Name -Validation "^[\w\*\$][\w\s\-\$]*(\(\d{1,}\)){0,1}$" -ErrorMessage "Invalid characters in the name" + +#print new name +PS master:\> Write-Host "The new name you've chosen is '$($newName)'" +``` + +### EXAMPLE 3 + +Requests that the user provides a string of at most 5 characters + +```powershell +Show-Input "Please provide 5 characters at most" -MaxLength 5 +``` + +## Related Topics + +* [Read-Variable](read-variable.md) +* [Show-Alert](show-alert.md) +* [Show-Application](show-application.md) +* [Show-Confirm](show-confirm.md) +* [Show-FieldEditor](show-fieldeditor.md) +* [Show-ListView](show-listview.md) +* [Show-ModalDialog](show-modaldialog.md) +* [Show-Result](show-result.md) +* [Show-YesNoCancel](show-yesnocancel.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/show-listview.md b/appendix/common/show-listview.md new file mode 100644 index 00000000..e98004b2 --- /dev/null +++ b/appendix/common/show-listview.md @@ -0,0 +1,276 @@ +# Show-ListView + +Sends output to an interactive table in a separate window. + +## Syntax + +Show-ListView \[-PageSize <Int32>\] \[-Modal\] \[-ActionData <Object>\] \[-ViewName <String>\] \[-ActionsInSession\] \[-Show <None \| SharedExport \| Filter \| PagingAlways \| SharedActions \| StatusBar \| All>\] \[-InfoTitle <String>\] \[-InfoDescription <String>\] \[-MissingDataMessage <String>\] \[-Icon <String>\] -Data <Object> \[-Property <Object\[\]>\] \[-Title <String>\] \[-Width <Int32>\] \[-Height <Int32>\] + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -PageSize <Int32> + +Number of results shown per page. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Modal <SwitchParameter> + +If this parameter is provided Results will show in a new window \(in Sitecore 6.x up till Sitecore 7.1\) or in a modal overlay \(Sitecore 7.2+\) + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ActionData <Object> + +Additional data what will be passed to the view. All actions that are executed from that view window will have that data accessible to them as $actionData variable. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ViewName <String> + +View signature name - this can be used by action commands to determine whether to show an action or not using the Show/Enable rules. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ActionsInSession <SwitchParameter> + +If this parameter is specified actions will be executed in the same session as the one in which the command is executed. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Show <ShowListViewFeatures> + +Shows UI elements selectively in the results dialog -- All - shows all UI elements automatically - default value -- SharedExport - shows export filters that are not specific to this very `-ViewName report (left-most ribbon panel) -- Filter - shows filter panel -- PagingAlways - shows paging when list is shorter than the page specified -- SharedActions - shows actions that are not specific to this very`-ViewName report \(right-most ribbon panel\) -- StatusBar - shows status bar. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -InfoTitle <String> + +Title on the panel that appears below the ribbon in the results window. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -InfoDescription <String> + +Description that appears on the panel below the ribbon in the results window. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -MissingDataMessage <String> + +If no Items were provided for -Data parameter the message provided in this parameter will be shown in the middle of the List View dialog to notify users of the lack of items to display. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Icon <String> + +Icon of the result window. \(Shows in the top/left corner and on the Sitecore taskbar\). + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Data <Object> + +Data to be displayed in the view. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Property <Object\[\]> + +Specifies the object properties that appear in the display and the order in which they appear. Type one or more property names \(separated by commas\), or use a hash table to display a calculated property. + +The value of the Property parameter can be a new calculated property. To create a calculated, property, use a hash table. Valid keys are: -- Name \(or Label\) <string> -- Expression <string> or <script block> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Title <String> + +Title of the results window. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Width <Int32> + +Width of the results window. Only applicable when also using the `-Modal` switch. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Height <Int32> + +Height of the results window. Only applicable when also using the `-Modal` switch. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.Management.Automation.PSObject + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* System.String + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +This command formats information about Sitecore items in a table. The Get-ChildItem command gets objects representing the items. The pipeline operator \(\|\) passes the object to the Show-ListView command. Show-ListView displays the objects in a table. + +```powershell +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. + +```powershell +PS master:\> Get-ItemReferrer -path 'master:\templates\Sample\Sample Item' | + Show-ListView -Property ` + @{Label="Name"; Expression={$_.DisplayName} }, + @{Label="Path"; Expression={$_.Paths.Path} }, + @{Label="Languages"; Expression={$_.Languages | % { $_.Name + ", "} } } +``` + +### EXAMPLE 3 + +The following demonstrates the use of a custom object used in the report. Notice that a custom Icon can be set. + +```powershell +$item = Get-Item -Path "master:\content\home\sample item 1" + +$customItem = [pscustomobject]@{ + "ID"=$Item.ID + "Icon"=$Item.__Icon + "DisplayName"=$Item.DisplayName + "ItemPath"=$Item.ItemPath + "Version"=$Item.Version + "Language"=$Item.Language + "__Updated"=$Item.__Updated + "__Updated by"=$Item."__Updated by" +} + +$customItem | Show-ListView +``` + +## Related Topics + +* [Update-ListView](update-listview.md) +* Out-GridView +* Format-Table +* [Read-Variable](read-variable.md) +* [Show-Alert](show-alert.md) +* [Show-Application](show-application.md) +* [Show-Confirm](show-confirm.md) +* [Show-FieldEditor](show-fieldeditor.md) +* [Show-Input](show-input.md) +* [Show-ModalDialog](show-modaldialog.md) +* [Show-Result](show-result.md) +* [Show-YesNoCancel](show-yesnocancel.md) +* [https://blog.najmanowicz.com/2014/10/25/creating-beautiful-sitecore-reports-easily-with-powershell-extensions/](https://blog.najmanowicz.com/2014/10/25/creating-beautiful-sitecore-reports-easily-with-powershell-extensions/) +* [https://michaellwest.blogspot.com/2014/04/reports-with-sitecore-powershell.html](https://michaellwest.blogspot.com/2014/04/reports-with-sitecore-powershell.html) +* [https://sitecorejunkie.com/2014/05/28/create-a-custom-report-in-sitecore-powershell-extensions/](https://sitecorejunkie.com/2014/05/28/create-a-custom-report-in-sitecore-powershell-extensions/) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/show-modaldialog.md b/appendix/common/show-modaldialog.md new file mode 100644 index 00000000..369ad974 --- /dev/null +++ b/appendix/common/show-modaldialog.md @@ -0,0 +1,137 @@ +# Show-ModalDialog + +Shows Sitecore Sheer control as a modal dialog. + +## Syntax + +Show-ModalDialog -Control <String> \[-Parameters <Hashtable>\] \[-HandleParameters <Hashtable>\] \[-Title <String>\] \[-Width <Int32>\] \[-Height <Int32>\] + +Show-ModalDialog -Url <String> \[-HandleParameters <Hashtable>\] \[-Title <String>\] \[-Width <Int32>\] \[-Height <Int32>\] + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Control <String> + +Name of the Sitecore Sheer control to show + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Url <String> + +A fully formed URL that constitutes a control execution request. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Parameters <Hashtable> + +Hashtable of parameters to pass to the control in the url. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -HandleParameters <Hashtable> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Title <String> + +Title of the control dialog. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Width <Int32> + +Width of the control dialog. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Height <Int32> + +Height of the control dialog. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* System.String + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> Show-ModalDialog -Control "ConfirmChoice" -Parameters @{btn_0="Yes (returns btn_0)"; btn_1="No (returns btn_1)"; btn_2="return btn_2"; te="Message Text"; cp="My Caption"} -Height 120 -Width 400 +``` + +## Related Topics + +* [Read-Variable](read-variable.md) +* [Show-Alert](show-alert.md) +* [Show-Application](show-application.md) +* [Show-Confirm](show-confirm.md) +* [Show-FieldEditor](show-fieldeditor.md) +* [Show-Input](show-input.md) +* [Show-ListView](show-listview.md) +* [Show-Result](show-result.md) +* [Show-YesNoCancel](show-yesnocancel.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/show-result.md b/appendix/common/show-result.md new file mode 100644 index 00000000..0a2cd0d1 --- /dev/null +++ b/appendix/common/show-result.md @@ -0,0 +1,158 @@ +# 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 <String> \[-Parameters <String\[\]>\] \[-Title <String>\] \[-Width <Int32>\] \[-Height <Int32>\] + +Show-Result -Url <String> \[-Title <String>\] \[-Width <Int32>\] \[-Height <Int32>\] + +Show-Result \[-Text\] \[-Title <String>\] \[-Width <Int32>\] \[-Height <Int32>\] + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Control <String> + +Name of the Sheer control to execute. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Url <String> + +Url to the Sheer control to execute. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Parameters <String\[\]> + +Parameters to be passed to the executed control when executing with the -Control parameter specified. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Text <SwitchParameter> + +Shows the default text dialog. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Title <String> + +Title of the window containing the control. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Width <Int32> + +Width of the window containing the control. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Height <Int32> + +Height of the window containing the control. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* System.String + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Show results of script executio + +```powershell +PS master:\> Show-Result -Text +``` + +### EXAMPLE 2 + +Show the Control Panel control in a Window of specified size. + +```powershell +PS master:\> Show-Result -Control "ControlPanel" -Width 1024 -Height 640 +``` + +### EXAMPLE 3 + +```powershell +Shows a new instance of ISE +Show-Result -Url "/sitecore/shell/Applications/PowerShell/PowerShellIse" +``` + +## Related Topics + +* [Read-Variable](read-variable.md) +* [Show-Alert](show-alert.md) +* [Show-Application](show-application.md) +* [Show-Confirm](show-confirm.md) +* [Show-FieldEditor](show-fieldeditor.md) +* [Show-Input](show-input.md) +* [Show-ListView](show-listview.md) +* [Show-ModalDialog](show-modaldialog.md) +* [Show-YesNoCancel](show-yesnocancel.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/show-yesnocancel.md b/appendix/common/show-yesnocancel.md new file mode 100644 index 00000000..aebe0a6b --- /dev/null +++ b/appendix/common/show-yesnocancel.md @@ -0,0 +1,92 @@ +# Show-YesNoCancel + +Shows Yes/No/Cancel dialog to the user and returns user choice. + +## Syntax + +Show-YesNoCancel \[-Title <String>\] \[-Width <Int32>\] \[-Height <Int32>\] + +## Detailed Description + +Shows Yes/No/Cancel dialog to the user and returns user choice as a string value. + +Depending on the user response one of the 2 strings is returned: + +* yes +* no +* cancel + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Title <String> + +Question to ask the user in the dialog + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Width <Int32> + +Width of the dialog. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Height <Int32> + +Height of the dialog. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* System.String + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> Show-YesNoCancel "Should we delete those 2 items?" + +cancel +``` + +## Related Topics + +* [Read-Variable](read-variable.md) +* [Show-Alert](show-alert.md) +* [Show-Application](show-application.md) +* [Show-Confirm](show-confirm.md) +* [Show-FieldEditor](show-fieldeditor.md) +* [Show-Input](show-input.md) +* [Show-ListView](show-listview.md) +* [Show-ModalDialog](show-modaldialog.md) +* [Show-Result](show-result.md) +* [Show-YesNoCancel](show-yesnocancel.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/start-taskschedule.md b/appendix/common/start-taskschedule.md new file mode 100644 index 00000000..ad0f7388 --- /dev/null +++ b/appendix/common/start-taskschedule.md @@ -0,0 +1,124 @@ +# Start-TaskSchedule + +Executes a task schedule. + +## Syntax + +Start-TaskSchedule -Schedule <ScheduleItem> + +Start-TaskSchedule \[-Item\] <Item> + +Start-TaskSchedule \[-Path\] <String> + +Start-TaskSchedule -Id <String> \[-Database <String>\] + +## Detailed Description + +Executes a task schedule either passed from Get-Schedule, based on Item or Schedule path. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Schedule <ScheduleItem> + +ScheduleItem most conveniently obtained from Get-Schedule command. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +Schedule item - if Item is of wrong template - an appropriate error will be written to teh host. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the schedule item - if item is of wrong template - an appropriate error will be written to teh host. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Tasks.ScheduleItem + + Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Tasks.ScheduleItem + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\> Start-TaskSchedule -Path "master:/system/Tasks/Schedules/Email Campaign/Clean Message History" + +Name Database Active Auto Remove Is Due Expired Completed Last Run Next Run +---- -------- ------ ----------- ------ ------- --------- -------- -------- +Clean Message History master True False False False False 2014-07-29 16:22:49 2014-07-30 04:52:49 +``` + +### EXAMPLE 2 + +```powershell +PS master:\> Get-TaskSchedule -Name "Check Bounced Messages" -Database "master" | Start-TaskSchedule + +Name Database Active Auto Remove Is Due Expired Completed Last Run Next Run +---- -------- ------ ----------- ------ ------- --------- -------- -------- +Check Bounced Messages master True False False False False 2014-07-29 16:21:33 2014-07-30 04:51:33 +``` + +## Related Topics + +* [Get-TaskSchedule](get-taskschedule.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [https://www.youtube.com/watch?v=N3xgZcU9FqQ&list=PLph7ZchYd\_nCypVZSNkudGwPFRqf1na0b&index=9](https://www.youtube.com/watch?v=N3xgZcU9FqQ&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=9) + diff --git a/appendix/common/test-basetemplate.md b/appendix/common/test-basetemplate.md new file mode 100644 index 00000000..a416cee8 --- /dev/null +++ b/appendix/common/test-basetemplate.md @@ -0,0 +1,97 @@ +# Test-BaseTemplate + +## Syntax + +```powershell +Test-BaseTemplate -Item -TemplateItem +Test-BaseTemplate -Item -Template +Test-BaseTemplate -Path -TemplateItem +Test-BaseTemplate -Path -Template +Test-BaseTemplate -Id -TemplateItem +Test-BaseTemplate -Id -Template +Test-BaseTemplate [-Database ] +``` + +## Detailed Description + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Item  <Item> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Path  <String> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id  <String> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -TemplateItem  <TemplateItem\[\]> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Template  <String\[\]> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database  <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +The following example determines if the item inherits from the specified template. + +```powershell +$item = Get-Item -Path "master:\content\home" +Test-BaseTemplate -Item $item -Template "Sample/Sample Content" + +# Alternatively you can use the Template Id +Test-BaseTemplate -Item $item -Template "{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}" +``` diff --git a/appendix/common/test-rule.md b/appendix/common/test-rule.md new file mode 100644 index 00000000..652436ff --- /dev/null +++ b/appendix/common/test-rule.md @@ -0,0 +1,111 @@ +# Test-Rule + +Tests item against a sitecore serialized rules engine rule set. + +## Syntax + +Test-Rule \[-Rule <String>\] \[-InputObject <PSObject>\] \[-RuleDatabase <String>\] + +## Detailed Description + +Tests item or a stream of items against a sitecore serialized rules engine rule set. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Rule <String> + +Serialized sitecore rules engine rule. Such rules can be read from rule fields or created by user with the Read-Variable cmdlet. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -InputObject <PSObject> + +Item to be tested + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -RuleDatabase <String> + +Name of the database from which rules are pulled. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* System.Boolea + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Specifies a rule as "items that have layout" and runs the rule againste all items under the ome Item + +```powershell +$rule = ' + + + + + +' + +Get-ChildItem master:\content\Home -Recurse | ? { Test-Rule -InputObject $_ -Rule $rule -RuleDatabase master} +``` + +### EXAMPLE 2 + +Asks user for the rule and root under which items should be filtered, and lists all items fulfilling the rule under the selected path + +```powershell +$rule = '' +$root = Get-Item master:\content\home\ + +$result = Read-Variable -Parameters ` +@{Name="root"; title="Items under"; Tooltip="Items under the selected item will be considered for evaluation"}, ` +@{Name="rule"; Editor="rule"; title="Filter rules"; Tooltip="Only items conforming to this rule will be displayed."} ` +-Description "This dialog shows editor how a rule can be taken from an item and edited using the Read-Variable cmdlet." ` +-Title "Sample rule editing" -Width 600 -Height 600 -ShowHints + +if($result -eq "cancel"){ +exit; +} + +Get-ChildItem $root.ProviderPath | ? { Test-Rule -InputObject $_ -Rule $rule -RuleDatabase master} +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/update-itemreferrer.md b/appendix/common/update-itemreferrer.md new file mode 100644 index 00000000..4aa045ce --- /dev/null +++ b/appendix/common/update-itemreferrer.md @@ -0,0 +1,234 @@ +# Update-ItemReferrer + +Updates references to specified item to point to a new provided in the -NewTarget or removes links to the item. + +## Syntax + +Update-ItemReferrer \[-Link\] <ItemLink> \[-NewTarget\] <Item> + +Update-ItemReferrer \[-Link\] <ItemLink> -RemoveLink + +Update-ItemReferrer \[-NewTarget\] <Item> \[-Item\] <Item> + +Update-ItemReferrer -NewTarget <Item> -Path <String> \[-Language <String\[\]>\] + +Update-ItemReferrer -NewTarget <Item> -Id <String> \[-Database <String>\] \[-Language <String\[\]>\] + +Update-ItemReferrer -RemoveLink \[-Item\] <Item> + +Update-ItemReferrer -RemoveLink -Path <String> \[-Language <String\[\]>\] + +Update-ItemReferrer -RemoveLink -Id <String> \[-Database <String>\] \[-Language <String\[\]>\] + +## Detailed Description + +The cmdlet manipulates link to a specific item. The target item can be provided as an Item object or through Path/ID. it does not modifies the item itself but rather other items that link to it. If the -RemoveLink parameter is used the link will be removed rather than modified. To deliver more fine grained filtering you can provide ItemLink using the -Link parameter. You can obtain ItemLinks using Get-ItemReferrer or Get-ItemReference cmdlets. Consult Examples for specific use cases of each approach. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Link <ItemLink> + +ItemLink retrieved from the Link database. Use this parameter to do more granular filtering. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -NewTarget <Item> + +New item the links should be pointing to + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 2 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -RemoveLink <SwitchParameter> + +If provided, removes all links to the current target item. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The current item to be relinked. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the current item to be relinked - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the current item to be relinked - can work with Language parameter to specify the language other than current session language. Requires the Database parameter to be specified. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the current item to be relinked. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +If you need the current item to be relinked in specific Language You can specify it with this parameter. Globbing/wildcard supported. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +This example covers global operations + +Assuming Sitecore PowerShell Extensions 4.2 or newer is installed Assuming your Home has an "Image" field of type "Image" Assuming you have second item next to Home called Home2 that has an "Image" field of type "Image" + +```powershell +$coverImage = Get-Item 'master:\media library\Default Website\cover' +$scLogoImage = Get-item 'master:\media library\Default Website\sc_logo' + +Write-Host "`nReset 'home', 'child' and 'home2' to link to 'cover'- 3 items" -Foreground Magenta +(Get-item master:\content\home).Image = $coverImage +(Get-item master:\content\Home\child).Image = $coverImage +(Get-item master:\content\home2).Image = $coverImage + +Get-ItemReferrer -Item $coverImage + +Write-Host "`nRelinking all instances of 'cover' image to 'sc_logo'" -Foreground Yellow +$coverImage | Update-ItemReferrer -NewTarget $scLogoImage + +Write-Host "`n'cover' should no longer have links leading to it - 0 items " -Foreground Red +$coverImage | Get-ItemReferrer + +Write-Host "`n'sc_logo' should now be linked from all - 3 items" -Foreground Green +$scLogoImage | Get-ItemReferrer + +Write-Host "`nRemoving links to 'sc_logo' from all items" -Foreground Yellow +$scLogoImage | Update-ItemReferrer -RemoveLink + +Write-Host "`n'sc_logo' should have no links to it - 0 items" -Foreground Red +$scLogoImage | Get-ItemReferrer +``` + +### EXAMPLE 2 + +This example covers more fine-grained filtered approach to removing links + +Assuming Sitecore PowerShell Extensions 4.2 or newer is installed Assuming your Home has an "Image" field of type "Image" Assuming you have second item next to Home called Home2 that has an "Image" field of type "Image" + +```powershell +$coverImage = Get-Item 'master:\media library\Default Website\cover' +$scLogoImage = Get-item 'master:\media library\Default Website\sc_logo' + +Write-Host "`nReset 'home', 'child' and 'home2' to link to 'cover'- 3 items" -Foreground Magenta +(Get-item master:\content\home).Image = $coverImage +(Get-item master:\content\Home\child).Image = $coverImage +(Get-item master:\content\home2).Image = $coverImage + +Get-ItemReferrer -Item $coverImage + +Write-Host "`nRemove links to the 'cover' image from all items under 'master:\content\home'" -Foreground Yellow +Get-ChildItem master:\content\home -WithParent -Recurse | # get items under home + Get-ItemReference -ItemLink | # get all items that they are refering to + ? { $_.TargetItemID -eq $coverImage.ID } | # filter only references to $coverImage + Update-ItemReferrer -RemoveLink # remove links + +Write-Host "`n'cover' should have 1 link leading from 'home2'" -Foreground Green +$coverImage | Get-ItemReferrer +``` + +### EXAMPLE 3 + +This example covers more fine-grained filtered approach to removing links + +Assuming Sitecore PowerShell Extensions 4.2 or newer is installed Assuming your Home has an "Image" field of type "Image" Assuming you have second item next to Home called Home2 that has an "Image" field of type "Image" + +```powershell +$coverImage = Get-Item 'master:\media library\Default Website\cover' +$scLogoImage = Get-item 'master:\media library\Default Website\sc_logo' + +Write-Host "`nReset 'home', 'child' and 'home2' to link to 'cover'- 3 items" -Foreground Magenta +(Get-item master:\content\home).Image = $coverImage +(Get-item master:\content\Home\child).Image = $coverImage +(Get-item master:\content\home2).Image = $coverImage + +Get-ItemReferrer -Item $coverImage + +Write-Host "`nUpdate all links to 'cover' image to point to 'sc_logo' from all immediate children of /sitecore/content" -Foreground Yellow +Get-ChildItem master:\content | # get items immediately under 'under home'content' + Get-ItemReference -ItemLink | # get all items that they are refering to + ? { $_.TargetItemID -eq $coverImage.ID } | # filter only references to $coverImage + Update-ItemReferrer -NewTarget $scLogoImage # point them to 'sc_logo' image + +Write-Host "`n'cover' should have link from home2/child - 1 item" -Foreground Green +$coverImage | Get-ItemReferrer + +Write-Host "`n'sc_logo' should have links leading from 'home' and 'home2' - 2 items" -Foreground Green +$scLogoImage | Get-ItemReferrer +``` + +## Related Topics + +* [Get-ItemReferrer](get-itemreferrer.md) +* [Get-ItemReference](get-itemreference.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/update-listview.md b/appendix/common/update-listview.md new file mode 100644 index 00000000..d8bd7799 --- /dev/null +++ b/appendix/common/update-listview.md @@ -0,0 +1,139 @@ +# Update-ListView + +Updates List View \(created by Show-ListView\) data. + +## Syntax + +Update-ListView \[-InfoTitle <String>\] \[-InfoDescription <String>\] \[-MissingDataMessage <String>\] \[-Icon <String>\] -Data <Object> \[-Property <Object\[\]>\] + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -InfoTitle <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -InfoDescription <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -MissingDataMessage <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Icon <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Data <Object> + +Data that you want to be sent to the list view for display. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Property <Object\[\]> + +If this parameter is specified - it allows for modifying the columns shown in the list view, otherwise the columns stay the same as in the original view. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## 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. + +```powershell +# THE INITIAL SCRIPT showing the list of tasks in a list view +# This script does not yet make use of Update-ListView but tests the state for actions to be performed + +Import-Function "Edit-TaskSchedule" + +# Get all the items recursively where the TemplateName equals "Schedule". +Get-ChildItem -Path master:\system\Tasks\Schedules -Recurse | Where-Object { $_.TemplateName -eq "Schedule" } | + Show-ListView -Property @{Label="Name"; Expression={ $_.DisplayName } }, + @{Label="Last Run"; Expression={ $_."Last Run" } }, + @{Label="Command"; Expression={ $_.Database.GetItem($_.Command).Name } }, + @{Label="From"; Expression={ Parse-TaskSchedule $_ "from"} }, + @{Label="To"; Expression={ Parse-TaskSchedule $_ "to"} }, + @{Label="On Week Days"; Expression={ Parse-TaskSchedule $_ "strWeekdays" } }, + @{Label="Run Every"; Expression={ Parse-TaskSchedule $_ "interval" } } ` + -Title "Task Manager" +Close-Window + + + +# NOW THE PROPER ACTION SCRIPT + +# The Execute task action that (at the very end) updates the list with the latest tasks data +foreach($sheduleItem in $resultSet) +{ + $shedule = New-Object -TypeName "Sitecore.Tasks.ScheduleItem" -ArgumentList $sheduleItem + $shedule.Execute(); +} +Import-Function "Edit-TaskSchedule" +Get-ChildItem -Path master:\system\Tasks\Schedules -Recurse | Where-Object { $_.TemplateName -eq "Schedule" } | Update-ListView +``` + +## Related Topics + +* [Show-ListView](show-listview.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/common/write-log.md b/appendix/common/write-log.md new file mode 100644 index 00000000..e913468f --- /dev/null +++ b/appendix/common/write-log.md @@ -0,0 +1,82 @@ +# Write-Log + +Writes text to the Sitecore event log. + +## Syntax + +Write-Log \[\[-Object\] <Object>\] \[-Separator <Object>\] \[-Log <Debug \| Info \| Warning \| Error \| Fatal \| None>\] + +## Detailed Description + +The Write-Log command writes text to the Sitecore event log with the specified logging level. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Object <Object> + +Specifies the object to write to the log. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Separator <Object> + +Strings the output together with the specified text. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Log <LogNotificationLevel> + +Specifies the Sitecore logging level. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.String + + Represents the identity of a role. + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* None. + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> Write-Log "Information." +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/indexing.md b/appendix/indexing/README.md similarity index 85% rename from appendix/indexing.md rename to appendix/indexing/README.md index 8dfe4c30..fb41326d 100644 --- a/appendix/indexing.md +++ b/appendix/indexing/README.md @@ -1,2 +1,4 @@ # Indexing + + diff --git a/appendix/indexing/find-item.md b/appendix/indexing/find-item.md new file mode 100644 index 00000000..ef559f4b --- /dev/null +++ b/appendix/indexing/find-item.md @@ -0,0 +1,718 @@ +# Find-Item + +Finds items using the Sitecore Content Search API. + +## Syntax + +```powershell +Find-Item [-Index] [-Criteria ] [-QueryType ] [-OrderBy ] [-First ] [-Last ] [-Skip ] [] +Find-Item [-Index] [-Where ] [-WhereValues ] [-Filter ] [-FilterValues ] [-FacetOn ] [-FacetMinCount ] [-QueryType ] [-OrderBy ] [-First ] [-Last ] [-Skip ] [] +Find-Item [-Index] [-WherePredicate >>] [-FilterPredicate >>] [-QueryType ] [-OrderBy ] [-First ] [-Last ] [-Skip ] [] +Find-Item [-Index] [-ScopeQuery ] [-QueryType ] [-OrderBy ] [-First ] [-Last ] [-Skip ] [] +``` + +## Detailed Description + +The Find-Item command searches for items using the Sitecore Content Search API. The type `SearchResultItem` is used as the type when working with `IQueryable`. + +© 2010-2020 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Index <String> + +Name of the Index that will be used for the search: + +Find-Item -Index sitecore\_master\_index -First 10 + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Criteria <SearchCriteria\[\]> + +Simple form of search in which logical "AND" operations are needed. + +```powershell +@{ Filter = "Equals"; Field = "_templatename"; Value = "Sample Item"; }, +@{ Filter = "DescendantOf"; Value = (Get-Item "master:/content/") } +``` + +Where "Filter" is one of the following values: + +* Equals +* StartsWith +* Contains +* ContainsAny +* ContainsAll +* EndsWith +* DescendantOf - performs a _Contains_ with the field **\_path** +* Fuzzy +* InclusiveRange - performs a _Between_ using `int`, `double`, `datetime`, and `string`types +* ExclusiveRange - same as _InclusiveRange_ +* MatchesRegex - use something like `^.*$` +* MatchesWildcard - use something like `H?li*m` +* LessThan +* GreaterThan + +Where "Field" is the Index Field name found on the `SearchResultItem` such as the following: + +* \_\_smallcreateddate - CreatedDate +* \_\_smallupdateddate - Updated +* \_group - ID +* \_template - TemplateId +* \_templatename - TemplateName +* \_fullpath - Path + +Where "Value" is one of the following: + +* string +* string\[\] +* Sitecore.Data.ID +* Sitecore.Data.Items.Item +* Sitecore.Data.Items.Item\[\] +* object\[\] - when using `@()` you'll get this type, which will be treated as an array of strings +* PSObject\[\] +* System.Collections.ArrayList +* System.Collections.Generics.List<string> + +Where "Boost" is a positive number greater than 0 + +Fields by which you can filter can be discovered using the following script: + +```powershell +$criteria = @( + @{Filter = "StartsWith"; Field = "_fullpath"; Value = "/sitecore/content/" } +) +$props = @{ + Index = "sitecore_master_index" + Criteria = $criteria +} + +Find-Item @props -First 1 | Select-Object -Expand "Fields" +``` + +Where "Invert" is a boolean to indicate the following: + +* $false - This is the default value. Do exactly as the query is defined. +* $true - Reverse the logic. For example, "Contains" is treated like "NotContains", "Equals" is treated like "NotEquals". + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Where <String> + +Where the "Where" is the Dynamic Linq query and "WhereValues" includes the array of values to be replaced in the query. + +```powershell +$props = @{ + Index = "sitecore_master_index" + Where = 'TemplateName = @0 And Language=@1' + WhereValues = "Sample Item", "en" +} + +Find-Item @props +``` + +Filtering Criteria using Dynamic Linq syntax: [https://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library](https://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library) + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -WhereValues <Object\[\]> + +An Array of objects for Dynamic Linq "-Where" parameter as explained in: [https://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library](https://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library) + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Filter <String> + +Where the "Filter" is the Dynamic Linq query and "FilterValues" includes the array of values to be replaced in the query. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -FilterValues <Object\[\]> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -WherePredicate <Expression<Func<SearchResultItem,bool>>> + +Use the `New-SearchPredicate` command to build the appropriate predicates. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -FilterPredicate <Expression<Func<SearchResultItem,bool>>> + +Use the `New-SearchPredicate` command to build the appropriate predicates. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ScopeQuery <String> + +When combined with the Query Builder field, a simple query can be crafted to return search results. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -OrderBy <String> + +Field by which the search results sorting should be performed. This is the .Net Property name as see on the SearchResultItem class. Dynamic Linq ordering syntax used. [https://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library](https://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library) + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -First <Int32> + +Number of returned search results. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Last <Int32> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Skip <Int32> + +Number of search results to be skipped skip before returning the results commences. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Property <String\[\]> + +An array of property names which match with the `SearchResultItem` type. + +**Note:** The use of `Initialize-Item` is not supported because the object returned is no longer a `SearchResultItem` and therefore unable to guarantee that `Item` objects can be returned. [#1123](https://github.com/SitecorePowerShell/Console/issues/1123) + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.ContentSearch.SearchTypes.SearchResultItem + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Fields by which filtering can be performed using the -Criteria parameter. + +```powershell +$criteria = @( + @{Filter = "Equals"; Field = "_templatename"; Value = "Sample Item"}, + @{Filter = "Contains"; Field = "Title"; Value = "Sitecore"}, + @{Filter = "Contains"; Field = "Title"; Value = "Powerful ways"; "Invert" = $true} +) +$props = @{ + Index = "sitecore_master_index" + Criteria = $criteria +} + +Find-Item @props +``` + +### EXAMPLE 2 + +Find items using a search built by the Query Builder field. + +```powershell +$props = @{ + Index = "sitecore_master_index" + ScopeQuery = "location:{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9};custom:title|Sitecore" +} + +Find-Item @props +``` + +### EXAMPLE 3 + +Find all items of template "Sample Item" which are in "English" under the "Home" item using Dynamic LINQ syntax. + +```powershell +$templateId = [ID]::Parse("{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}") +$homeId = [ID]::Parse("{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}") +$language = "en" + +$props = @{ + Index = "sitecore_master_index" + Where = 'TemplateId = @0 And Language=@1 And Paths.Contains(@2)' + WhereValues = $templateId, $language, $homeId +} + +Find-Item @props +``` + +### EXAMPLE 4 + +Find items using a complex search predicate. + +```powershell +$criteriaTemplate = @( + @{Filter = "Equals"; Field = "_templatename"; Value = "Template Field"; }, + @{Filter = "Equals"; Field = "_templatename"; Value = "Sample Item"; Boost=25; }, + @{Filter = "Equals"; Field = "_templatename"; Value = "Sample Content"; } +) + +$predicateTemplate = New-SearchPredicate -Operation Or -Criteria $criteriaTemplate + +$criteriaContent = @{Filter = "Contains"; Field = "Title"; Value = 'Sitecore'} +$predicateTitle = New-SearchPredicate -Criteria $criteriaContent + +$predicateTemplateAndTitle = New-SearchPredicate -First $predicateTemplate -Second $predicateTitle -Operation And + +$root = Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" +$criteriaRoot = @{Filter = "DescendantOf"; Value = $root } +$predicateRoot = New-SearchPredicate -Criteria $criteriaRoot + +$predicate = New-SearchPredicate -First $predicateRoot -Second $predicateTemplateAndTitle -Operation And + +$props = @{ + Index = "sitecore_master_index" + WherePredicate = $predicate +} + +Find-Item @props +``` + +### EXAMPLE 5 + +Find items using logical AND conditions with ContainsAny. Demonstrates that different array types are handled. + +**Note:** When searching for `ID`s you can use the proper type like `[ID[]]@("{C852E80E-ED49-4354-A397-6F66487F0E26}")` so SPE will handle the conversion to `ShortID`. + +```powershell +$criteria = @( + @{Filter = "Equals"; Field = "_templatename"; Value = "Sample Content"; Boost=25; }, + @{Filter = "ContainsAny"; Field = "Title"; Value = [string[]]@('$name','$date')}, + @{Filter = "ContainsAny"; Field = "Title"; Value = @('$name','$date')}, + @{Filter = "ContainsAny"; Field = "Title"; Value = [System.Collections.ArrayList]@('$name','$date')}, + @{Filter = "ContainsAny"; Field = "Title"; Value = [System.Collections.Generic.List[string]]@('$name','$date')} +) +$props = @{ + Index = "sitecore_master_index" + Criteria = $criteria +} + +Find-Item @props +``` + +### EXAMPLE 6 + +Find items using logical AND with ContainsAll. Demonstrates looking in multilist fields. + +```powershell +$criteria = @( + @{Filter = "Equals"; Field = "_templatename"; Value = "Sample Content"; Boost=25; }, + @{Filter = "ContainsAll"; Field = "RelatedImages"; Value = @('{4D427A1D-312D-4EEE-A519-1F5700675BAF}','{4B603402-62AB-4ECB-9CAE-98790DDBC35A}')} +) +$props = @{ + Index = "sitecore_master_index" + Criteria = $criteria +} + +Find-Item @props +``` + +### EXAMPLE 7 + +Find an item by ID. + +```powershell +$criteria = @( + @{Filter = "Equals"; Field = "_group"; Value = "{C89D37FF-3919-4D69-9925-943B67BD22D6}"} +) +$props = @{ + Index = "sitecore_master_index" + Criteria = $criteria +} +Find-Item @props +``` + +### EXAMPLE 8 + +Find items within a data range. Possible filters are `InclusiveRange` and `ExclusiveRange` . When using dates, only **yyyyMMdd** is considered in the comparison so no need to get too precise. + +```powershell +$props = @{ + Index = "sitecore_master_index" + Criteria = @{ + Field = "__smallcreateddate" + Filter = "InclusiveRange" + Value = [datetime[]]@([datetime]"01/05/2015", [datetime]::Today) + }, @{ + Field = "_name" + Filter = "Fuzzy" + Value = "sample" + } +} + +Find-Item @props +``` + +### EXAMPLE 9 + +Find and count all items beneath a root item using the item path. + +```powershell +$criteria = @( + @{Filter = "Contains"; Field = "_fullpath"; Value = "/sitecore/content/home"}, + @{Filter = "Equals"; Field = "_latestversion"; Value = "1"} +) +$props = @{ + Index = "sitecore_master_index" + Criteria = $criteria +} + +Find-Item @props | Measure-Object +``` + +### EXAMPLE 10 + +Find and count all items beneath a root item using the item id. + +```powershell +$criteria = @( + @{Filter = "Contains"; Field = "_path"; Value = "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}"}, + @{Filter = "Equals"; Field = "_latestversion"; Value = "1"} +) +$props = @{ + Index = "sitecore_master_index" + Criteria = $criteria +} + +Find-Item @props | Measure-Object +``` + +### EXAMPLE 11 + +Find items and sort (boost) based on the date field. If this were used on a field containing future dates you should expect to see them mixed with past dates. This example demonstrates using Solr functions. + +```powershell +$criteria = @( + @{Filter = "Equals"; Field = "_val_"; Value = "recip(abs(ms(NOW/HOUR,__smallcreateddate_tdt)),3.16e-11,4,.4)"} +) +$props = @{ + Index = "sitecore_master_index" + Criteria = $criteria +} + +Find-Item @props | Select-Object Name,CreatedDate +``` + +### EXAMPLE 12 + +Find items where the created date is older than the specified time in UTC. + +```powershell +$date = New-Object DateTime 2019, 8, 1, 0, 0, 0, ([DateTimeKind]::Utc) + +$criteria = @( + @{Filter = "LessThan"; Field = "__smallupdateddate"; Value = $date} +) +$props = @{ + Index = "sitecore_master_index" + Criteria = $criteria +} + +Find-Item @props +``` + +### EXAMPLE 13 + +Find items where the title contains the specified value. A custom implementation of `SearchResultItem` is used to enable the use of the property `Title` in the Dynamic Query. + +```powershell +class TitleSearchResultItem : SearchResultItem +{ + [Sitecore.ContentSearch.IndexField("title")] + [string]$Title +} + +$props = @{ + Index = "sitecore_master_index" + Where = "Title.Contains(@0)" + WhereValues = "great" + QueryType = [TitleSearchResultItem] +} + +Find-Item @props +``` + +### EXAMPLE 14 + +Find items where the path contains the specified Id and base templates contain the specified Id using a Dynamic Query. A custom implementation of `SearchResultItem` is used to enable the use of the property `TemplateIds` in the Dynamic Query. + +```powershell +class TemplatesSearchResultItem : SearchResultItem +{ + # For items contained within an SXA index try using the name "inheritance_sm". + [Sitecore.ContentSearch.IndexField("_templates")] + [System.Collections.Generic.List[ID]]$TemplateIds +} + +$props = @{ + Index = "sitecore_master_index" + Where = "Paths.Contains(@0) And TemplateIds.Contains(@1)" + WhereValues = [ID]::Parse("{371EEE15-B6F3-423A-BB25-0B5CED860EEA}"), [ID]::Parse("{B0B6FB08-6BBE-43F2-8E36-FCE228325B63}") + QueryType = [TemplatesSearchResultItem] +} + +Find-Item @props +``` + +### EXAMPLE 15 + +Find items where the title contains "Sitecore" using a Scope Query. A custom implementation of `SearchResultItem` is used to enable the use of the property `Title` in the Scope Query. + +```powershell +class TitleSearchResultItem : SearchResultItem +{ + [Sitecore.ContentSearch.IndexField("title")] + [string]$Title +} + +$props = @{ + Index = "sitecore_master_index" + ScopeQuery = "location:{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9};custom:title|Sitecore" + QueryType = [TitleSearchResultItem] +} + +Find-Item @props | Select-Object -Property Title +``` + +### EXAMPLE 16 + +Find items where the template is "Sample Content" and the title contains "Sitecore" and created by "admin" using the Criteria Query. A custom implementation of `SearchResultItem` is used to enable the use of the property `Title` and `Creator` in the Dynamic Query. + +```powershell +class TitleSearchResultItem : SearchResultItem +{ + [Sitecore.ContentSearch.IndexField("title")] + [string]$Title + [Sitecore.ContentSearch.IndexField("_creator")] + [string]$Creator +} + +$criteria = @( + @{Filter = "Equals"; Field = "_templatename"; Value = "Sample Content"}, + @{Filter = "Contains"; Field = "Title"; Value = "Sitecore"}, + @{Filter = "Contains"; Field = "_creator"; Value = "admin"} +) +$props = @{ + Index = "sitecore_master_index" + Criteria = $criteria + QueryType = [TitleSearchResultItem] +} + +Find-Item @props +``` + +### EXAMPLE 17 + +Find items matching a complex query. A custom implementation of `SearchResultItem` is used to enable the use of the property `Title` in the Predicate Query. + +```powershell +class TitleSearchResultItem : SearchResultItem +{ + [Sitecore.ContentSearch.IndexField("title")] + [string]$Title +} + +$criteriaTemplate = @{Filter = "Equals"; Field = "_templatename"; Value = "Template Field"; }, @{Filter = "Equals"; Field = "_templatename"; Value = "Sample Item"; Boost=25; }, @{Filter = "Equals"; Field = "_templatename"; Value = "Sample Content"; } +$predicateTemplate = New-SearchPredicate -Operation Or -Criteria $criteriaTemplate -QueryType ([TitleSearchResultItem]) + +$criteriaContent = @{Filter = "Contains"; Field = "Title"; Value = 'Sitecore'} +$predicateTitle = New-SearchPredicate -Criteria $criteriaContent -QueryType ([TitleSearchResultItem]) + +$predicateTemplateAndTitle = New-SearchPredicate -First $predicateTemplate -Second $predicateTitle -Operation And -QueryType ([TitleSearchResultItem]) + +$root = Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" +$criteriaRoot = @{Filter = "DescendantOf"; Value = $root } +$predicateRoot = New-SearchPredicate -Criteria $criteriaRoot -QueryType ([TitleSearchResultItem]) + +$predicate = New-SearchPredicate -First $predicateRoot -Second $predicateTemplateAndTitle -Operation And -QueryType ([TitleSearchResultItem]) + +$props = @{ + Index = "sitecore_master_index" + WherePredicate = $predicate + QueryType = [TitleSearchResultItem] +} + +Find-Item @props +``` + +### EXAMPLE 18 + +Find items under the Content tree where the language is "en" and there are more than two occurrences. This could be used to find duplicate item names at the same path. + +```powershell +$props = @{ + Index = "sitecore_master_index" + Where = 'Paths.Contains(@0)' + WhereValues = [ID]::Parse("{0DE95AE4-41AB-4D01-9EB0-67441B7C2450}") + Filter = 'Language = @0' + FilterValues = "en" + FacetOn = "Path" + FacetMinCount = 2 +} + +Find-Item @props | Select-Object -Expand Categories | Select-Object -Expand Values +``` + +### EXAMPLE 19 + +Find the most recently updated item. + +```powershell +$templateId = "{C382C7B8-7567-40CB-AE89-7F5680735D4E}" +$criteria = @( + @{Filter = "Equals"; Field = "_template"; Value = $templateId} +) +$props = @{ + Index = "sitecore_master_index" + Criteria = $criteria + OrderBy = "Updated" + Last = 1 +} + +Find-Item @props | Select-Object -Property ItemId, Name, Path, Updated +``` + +### EXAMPLE 20 + +Find items where the expiration date has not passed (now to the future) or the expiration date is empty (never expires). + +```powershell +$props = @{ + Index = "sitecore_master_index" + ScopeQuery = "+location:{447D82A5-BDBD-4898-8598-D79B3EB9BE6D};+template:{51ED5851-1A61-4DAE-B803-6C7FAE6B43D8};custom:EventEndDate|[* TO NOW-100YEARS];custom:EventEndDate|[NOW TO *];" +} + +Find-Item @props +``` + +### EXAMPLE 21 + +Use Skip and Take to page through results until all are returned. + +```powershell +$criteria = @( + @{Filter = "Contains"; Field = "_fullpath"; Value = "/sitecore/content/home"}, + @{Filter = "Equals"; Field = "_latestversion"; Value = "1"} +) +$props = @{ + Index = "sitecore_master_index" + Criteria = $criteria +} + +$searchItems = [System.Collections.ArrayList]@() +$pageSize = 250 +$offset = 0 +$keepGoing = $true +while($keepGoing) { + $pagedItems = @(Find-Item @props -Skip $offset -First $pageSize) + if($pagedItems) { + $lastCount = $pagedItems.Count + $offset += $lastCount + $searchItems.AddRange($pagedItems) > $null + } else { + $keepGoing = $false + } +} + +$searchItems + +``` + +## Related Topics + +* [Initialize-Item](initialize-item.md) +* [https://gist.github.com/AdamNaj/273458beb3f2b179a0b6](https://gist.github.com/AdamNaj/273458beb3f2b179a0b6) +* [https://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library](https://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library) +* [#1128](https://github.com/SitecorePowerShell/Console/issues/1128) Added support for GreaterThan and LessThan +* [#1120](https://github.com/SitecorePowerShell/Console/issues/1120) Added support for custom `SearchResultItem` type +* [#1174](https://github.com/SitecorePowerShell/Console/issues/1174) Added support for Facet +* [#1176](https://github.com/SitecorePowerShell/Console/issues/1176) Added support for Filter + diff --git a/appendix/indexing/get-searchindex.md b/appendix/indexing/get-searchindex.md new file mode 100644 index 00000000..a5992591 --- /dev/null +++ b/appendix/indexing/get-searchindex.md @@ -0,0 +1,92 @@ +# Get-SearchIndex + +Returns the available Sitecore indexes. + +## Syntax + +Get-SearchIndex \[-Name <String>\] + +Get-SearchIndex \[-Name <String>\] + +## Detailed Description + +The Get-SearchIndex command returns the available Sitecore indexes. These are the same as those found in the Control Panel. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Name <String> + +Name of the index to return. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* 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 + +## Examples + +### EXAMPLE 1 + +```powershell +The following lists all available indexes. + +PS master:\>Get-SearchIndex + +Name IndexingState IsRebuilding IsSharded +---- ------------- ------------ --------- +sitecore_analytics_index Started False False +sitecore_core_index Started False False +sitecore_master_index Started True False +sitecore_web_index Started False False +sitecore_marketing_asset_inde... Started False False +sitecore_marketing_asset_inde... Started False False +sitecore_testing_index Started False False +sitecore_suggested_test_index Started False False +sitecore_fxm_master_index Started False False +sitecore_fxm_web_index Started False False +sitecore_list_index Started False False +social_messages_master Started False False +social_messages_web Started False False +``` + +### EXAMPLE 2 + +```powershell +The following lists only the specified index. + +PS master:\>Get-SearchIndex -Name sitecore_master_index + +Name IndexingState IsRebuilding IsSharded +---- ------------- ------------ --------- +sitecore_master_index Started True False +``` + +## Related Topics + +* [Initialize-SearchIndex](initialize-searchindex.md) +* [Stop-SearchIndex](stop-searchindex.md) +* [Resume-SearchIndex](resume-searchindex.md) +* [Suspend-SearchIndex](suspend-searchindex.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/indexing/initialize-item.md b/appendix/indexing/initialize-item.md new file mode 100644 index 00000000..7d5034ef --- /dev/null +++ b/appendix/indexing/initialize-item.md @@ -0,0 +1,87 @@ +# Initialize-Item + +Initializes items with the PowerShell automatic properties for each field. + +## Syntax + +Initialize-Item -Item <Item> + +Initialize-Item -SearchResultItem <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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Aliases + +The following abbreviations are aliases for this cmdlet: + +* Wrap-Item + +## Parameters + +### -Item <Item> + +The item to be wrapped/initialized. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -SearchResultItem <SearchResultItem> + +The item obtained from Find-Item command to be translated into a sitecore item. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + + Sitecore.ContentSearch.SearchTypes.SearchResultItem + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +Initialize the item obtained directly through the Sitecore API with additional PowerShell properties + +```powershell +$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 properties +$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 the added PowerShell property. +$item.Title = "New Title" +``` + +## Related Topics + +* [Find-Item](find-item.md) +* Get-Item +* Get-ChildItem +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/indexing/initialize-searchindex.md b/appendix/indexing/initialize-searchindex.md new file mode 100644 index 00000000..6870567a --- /dev/null +++ b/appendix/indexing/initialize-searchindex.md @@ -0,0 +1,116 @@ +# Initialize-SearchIndex + +Rebuilds the Sitecore index. + +## Syntax + +```powershell +Initialize-SearchIndex -Index [-IncludeRemoteIndex] [-AsJob] +Initialize-SearchIndex [-IncludeRemoteIndex] [-Name ] [-AsJob] +Initialize-SearchIndex [-Name ] [-AsJob] +``` + +## Detailed Description + +The Rebuild-SearchIndex command rebuilds Sitecore index. This command is an alias for Initialize-SearchIndex. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Aliases + +The following abbreviations are aliases for this cmdlet: + +* Rebuild-SearchIndex + +## Parameters + +### -Index <ISearchIndex> + +The index instance. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -IncludeRemoteIndex <SwitchParameter> + +The remote indexing should be triggered. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -AsJob <SwitchParameter> + +The job created for rebuilding the index should be returned as output. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Name <String> + +The name of the index to resume. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* 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 + +```powershell +The following rebuilds the index. + +Initialize-SearchIndex -Name sitecore_master_index +``` + +### EXAMPLE 2 + +```powershell +The following rebuilds the index. + +Get-SearchIndex -Name sitecore_master_index | Initialize-SearchIndex +``` + +## Related Topics + +* [Resume-SearchIndex](resume-searchindex.md) +* [Suspend-SearchIndex](suspend-searchindex.md) +* [Stop-SearchIndex](stop-searchindex.md) +* [Get-SearchIndex](get-searchindex.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/indexing/initialize-searchindexitem.md b/appendix/indexing/initialize-searchindexitem.md new file mode 100644 index 00000000..76ac6bce --- /dev/null +++ b/appendix/indexing/initialize-searchindexitem.md @@ -0,0 +1,85 @@ +# Initialize-SearchIndexItem + +## Syntax + +```powershell +Initialize-SearchIndexItem -Item [-Name ] [-AsJob] +Initialize-SearchIndexItem -Item [-Name ] [-AsJob] +Initialize-SearchIndexItem -SearchResultItem [-AsJob] +``` + +## Detailed Description + +Rebuilds the index for a given tree with the specified root item and index name. Supports wildcard filtering for the index name. + +© 2010-2020 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Aliases + +The following abbreviations are aliases for this cmdlet: + +* Rebuild-SearchIndexItem + +## Parameters + +### -Item  <Item> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -SearchResultItem  <SearchResultItem> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -AsJob  <SwitchParameter> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Name  <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Examples + +### EXAMPLE 1 + +The following rebuilds the index for a given tree with the specified root node and index name. + +```powershell +$item = Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" +$indexName = "sitecore_master_index" +Initialize-SearchIndexItem -Item $item -Name $indexName +``` + +### EXAMPLE 2 + +The following rebuilds the indexes matching the wildcard pattern for a given tree with the specified root node and index name. + +```powershell +$item = Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" +$indexName = "sitecore_*_index" +Initialize-SearchIndexItem -Item $item -Name $indexName +``` \ No newline at end of file diff --git a/appendix/indexing/remove-searchindexitem.md b/appendix/indexing/remove-searchindexitem.md new file mode 100644 index 00000000..19f1254c --- /dev/null +++ b/appendix/indexing/remove-searchindexitem.md @@ -0,0 +1,79 @@ +# Remove-SearchIndexItem + +## Syntax + +```powershell +Remove-SearchIndexItem -Item [-Name ] [-AsJob] +Remove-SearchIndexItem -Item [-Name ] [-AsJob] +Remove-SearchIndexItem -SearchResultItem [-AsJob] +``` + +## Detailed Description + +Removes an indexed item from the specified index. Supports wildcard filtering for the index name. + +© 2010-2020 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Item  <Item> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -SearchResultItem  <SearchResultItem> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -AsJob  <SwitchParameter> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Name  <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Examples + +### EXAMPLE 1 + +The following removes the indexed item from the specified search index. + +```powershell +$item = Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" +$indexName = "sitecore_master_index" +Remove-SearchIndexItem -Item $item -Name $indexName +``` + +### EXAMPLE 2 + +The following removes the indexed item from the indexes matching the wildcard pattern. + +```powershell +$item = Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" +$indexName = "sitecore_*_index" +Remove-SearchIndexItem -Item $item -Name $indexName +``` \ No newline at end of file diff --git a/appendix/indexing/resume-searchindex.md b/appendix/indexing/resume-searchindex.md new file mode 100644 index 00000000..5d0b9825 --- /dev/null +++ b/appendix/indexing/resume-searchindex.md @@ -0,0 +1,84 @@ +# Resume-SearchIndex + +Resumes the suspended \(paused\) Sitecore index. + +## Syntax + +Resume-SearchIndex -Index <ISearchIndex> + +Resume-SearchIndex \[-Name <String>\] + +Resume-SearchIndex \[-Name <String>\] + +## Detailed Description + +The Resume-SearchIndex command resumes the suspended \(paused\) Sitecore index. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Index <ISearchIndex> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Name <String> + +The name of the index to resume. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.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 + +### EXAMPLE 1 + +```powershell +The following stops the indexing process from running. + +PS master:\> Resume-SearchIndex -Name sitecore_master_index +``` + +### EXAMPLE 2 + +```powershell +The following stops the indexing process from running. + +PS master:\> Get-SearchIndex -Name sitecore_master_index | Resume-SearchIndex +``` + +## Related Topics + +* [Initialize-SearchIndex](initialize-searchindex.md) +* [Suspend-SearchIndex](suspend-searchindex.md) +* [Stop-SearchIndex](stop-searchindex.md) +* [Get-SearchIndex](get-searchindex.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/indexing/stop-searchindex.md b/appendix/indexing/stop-searchindex.md new file mode 100644 index 00000000..8e64e323 --- /dev/null +++ b/appendix/indexing/stop-searchindex.md @@ -0,0 +1,84 @@ +# Stop-SearchIndex + +Stops the Sitecore index. + +## Syntax + +Stop-SearchIndex -Index <ISearchIndex> + +Stop-SearchIndex \[-Name <String>\] + +Stop-SearchIndex \[-Name <String>\] + +## Detailed Description + +The Stop-SearchIndex command stops the Sitecore index. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Index <ISearchIndex> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Name <String> + +The name of the index to stop. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.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 + +### EXAMPLE 1 + +```powershell +The following stops the indexing process from running. + +PS master:\> Stop-SearchIndex -Name sitecore_master_index +``` + +### EXAMPLE 2 + +```powershell +The following stops the indexing process from running. + +PS master:\> Get-SearchIndex -Name sitecore_master_index | Stop-SearchIndex +``` + +## Related Topics + +* [Initialize-SearchIndex](initialize-searchindex.md) +* [Suspend-SearchIndex](suspend-searchindex.md) +* [Resume-SearchIndex](resume-searchindex.md) +* [Get-SearchIndex](get-searchindex.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/indexing/suspend-searchindex.md b/appendix/indexing/suspend-searchindex.md new file mode 100644 index 00000000..d65d5bf9 --- /dev/null +++ b/appendix/indexing/suspend-searchindex.md @@ -0,0 +1,84 @@ +# Suspend-SearchIndex + +Suspends \(pauses\) the Sitecore index. + +## Syntax + +Suspend-SearchIndex -Index <ISearchIndex> + +Suspend-SearchIndex \[-Name <String>\] + +Suspend-SearchIndex \[-Name <String>\] + +## Detailed Description + +The Suspend-SearchIndex command suspends \(pauses\) the Sitecore index. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Index <ISearchIndex> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Name <String> + +The name of the index to suspend \(pause\). + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.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 + +### EXAMPLE 1 + +```powershell +The following suspends (pauses) the indexing process from running. + +PS master:\> Suspend-SearchIndex -Name sitecore_master_index +``` + +### EXAMPLE 2 + +```powershell +The following suspends (pauses) the indexing process from running. + +PS master:\> Get-SearchIndex -Name sitecore_master_index | Suspend-SearchIndex +``` + +## Related Topics + +* [Initialize-SearchIndex](initialize-searchindex.md) +* [Stop-SearchIndex](stop-searchindex.md) +* [Resume-SearchIndex](resume-searchindex.md) +* [Get-SearchIndex](get-searchindex.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/indexing/update-searchindexitem.md b/appendix/indexing/update-searchindexitem.md new file mode 100644 index 00000000..95c0ff32 --- /dev/null +++ b/appendix/indexing/update-searchindexitem.md @@ -0,0 +1,79 @@ +# Update-SearchIndexItem + +## Syntax + +```powershell +Update-SearchIndexItem -Item [-Name ] [-AsJob] +Update-SearchIndexItem -Item [-Name ] [-AsJob] +Update-SearchIndexItem -SearchResultItem [-AsJob] +``` + +## Detailed Description + + Updates an item in the specified index. Supports wildcard filtering for the index name. + +© 2010-2020 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Item  <Item> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -SearchResultItem  <SearchResultItem> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -AsJob  <SwitchParameter> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Name  <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Examples + +### EXAMPLE 1 + +The following updates the index for a given item and index name. + +```powershell +$item = Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" +$indexName = "sitecore_master_index" +Update-SearchIndexItem -Item $item -Name $indexName +``` + +### EXAMPLE 2 + +The following updates the indexed item for the indexes matching the wildcard pattern. + +```powershell +$item = Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" +$indexName = "sitecore_*_index" +Update-SearchIndexItem -Item $item -Name $indexName +``` \ No newline at end of file diff --git a/appendix/packaging.md b/appendix/packaging/README.md similarity index 86% rename from appendix/packaging.md rename to appendix/packaging/README.md index b5ecf311..ee8c0038 100644 --- a/appendix/packaging.md +++ b/appendix/packaging/README.md @@ -1,2 +1,4 @@ # Packaging + + diff --git a/appendix/packaging/export-item.md b/appendix/packaging/export-item.md new file mode 100644 index 00000000..fa77e937 --- /dev/null +++ b/appendix/packaging/export-item.md @@ -0,0 +1,165 @@ +# Export-Item + +Exports \(serializes\) the Sitecore item to the filesystem. + +## Syntax + +Export-Item \[-Entry <IncludeEntry>\] \[-Recurse\] \[-ItemPathsAbsolute\] \[-Root <String>\] + +Export-Item \[-Item\] <Item> \[-Recurse\] \[-ItemPathsAbsolute\] \[-Root <String>\] + +Export-Item \[-Path\] <String> \[-Recurse\] \[-ItemPathsAbsolute\] \[-Root <String>\] + +Export-Item -Id <String> \[-Database <String>\] \[-Recurse\] \[-ItemPathsAbsolute\] \[-Root <String>\] + +## Detailed Description + +The Export-Item command serializes Sitecore items to the filesystem. The alias for the command is Serialize-Item. The simplest command syntax is: Export-Item -path "master:\content" + +or + +Get-Item "master:\content" \| Export-Item + +Both of them will serialize the content item in the master database. In first case we pass the path to the item as a parameter, in second case we serialize the items which come from the pipeline. You can send more items from the pipeline to the Export-Item command, e.g. if you need to serialize all the descendants of the home item created by sitecore\admin, you can use: + +Get-Childitem "master:\content\home" -recurse \| Where-Object { $\_."\_\_Created By" -eq "sitecore\admin" } \| Export-Item + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Aliases + +The following abbreviations are aliases for this cmdlet: + +* Serialize-Item + +## Parameters + +### -Entry <IncludeEntry> + +Serialization preset to be serialized. Obtain the preset through the use of Get-Preset command. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Recurse <SwitchParameter> + +Process the item and all of its children - switch which decides if serialization concerns only the single item or the whole tree below the item, e.g. + +Export-Item -path "master:\content\articles" -recurse + +Root - directory where the serialized files should be saved, e.g. Export-Item -path "master:\content" -Root "c:\tmp" + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ItemPathsAbsolute <SwitchParameter> + +Works only with Root parameter and decides if folder structure starting from "sitecore\content" should be created, e.g. if you want to serialize articles item in directory c:\tmp\sitecore\content you can use. For example: Export-Item -Path "master:\content\articles" -ItemPathsAbsolute -Root "c:\tmp" + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Root <String> + +Directory where the serialized files should be saved, e.g. + +Export-Item -Path "master:\content" -Root "c:\tmp" + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be serialized. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +You can pass the id of serialized item instead of path, e.g. Export-Item -id "{0DE95AE4-41AB-4D01-9EB0-67441B7C2450}" + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +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 + +```powershell +PS master:\> Export-Item -Path master:\content\home +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Get-Preset](../common/get-preset.md) +* [Import-Item](export-item.md) +* [https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd\_nCypVZSNkudGwPFRqf1na0b&index=7](https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=7) +* [https://gist.github.com/AdamNaj/6c86f61510dc3d2d8b2f](https://gist.github.com/AdamNaj/6c86f61510dc3d2d8b2f) +* [https://stackoverflow.com/questions/20266841/sitecore-powershell-deserialization](https://stackoverflow.com/questions/20266841/sitecore-powershell-deserialization) +* [https://stackoverflow.com/questions/20195718/sitecore-serialization-powershell](https://stackoverflow.com/questions/20195718/sitecore-serialization-powershell) +* [https://stackoverflow.com/questions/20283438/sitecore-powershell-deserialization-core-db](https://stackoverflow.com/questions/20283438/sitecore-powershell-deserialization-core-db) + diff --git a/appendix/packaging/export-package.md b/appendix/packaging/export-package.md new file mode 100644 index 00000000..a6784d85 --- /dev/null +++ b/appendix/packaging/export-package.md @@ -0,0 +1,129 @@ +# Export-Package + +Exports a Sitecore installation package and project. + +## Syntax + +Export-Package \[\[-Path\] <String>\] \[\[-Project\] <PackageProject>\] \[-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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Path <String> + +Path the project should be saved under. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Project <PackageProject> + +Project object created ealier with the New-Package. or Loaded with Get-Package. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 2 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Zip <SwitchParameter> + +Specify this parameter to exposrt package with all its assets in a zip file. If this parameter is missing only Xml file with the package project definition will be saved. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -NoClobber <SwitchParameter> + +Do not overwrite \(replace the contents\) of an existing file. By default, if a file exists in the specified path, Export-Package overwrites the file without warning. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -IncludeProject <SwitchParameter> + +Specify this parameter if exporting the zip file and when you want it to contain the project definitnion xml file in it. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Install.PackageProject + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +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. + +```powershell +# Create package +$package = new-package "Package for something special"; + +# Set package metadata +$package.Sources.Clear(); + +$package.Metadata.Author = "Michael West"; +$package.Metadata.Publisher = "Scripting in Powerful Ways Team"; +$package.Metadata.Version = "2.7"; +$package.Metadata.Readme = 'This text will be visible to people installing your package' + +# Add contnet/home to the package +$source = Get-Item 'master:\content\home' | New-ItemSource -Name 'Home Page' -InstallMode Overwrite +$package.Sources.Add($source); + +# Save package +Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip + +# Offer the user to download the package +Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip" +``` + +## Related Topics + +* [Get-Package](get-package.md) +* Import-Package +* [Install-UpdatePackage](install-updatepackage.md) +* [New-ExplicitFileSource](new-explicitfilesource.md) +* [New-ExplicitItemSource](new-explicititemsource.md) +* [New-FileSource](new-filesource.md) +* [New-ItemSource](new-itemsource.md) +* [New-Package](new-package.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [https://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/](https://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/) +* [https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae](https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae) + diff --git a/appendix/packaging/export-updatepackage.md b/appendix/packaging/export-updatepackage.md new file mode 100644 index 00000000..66dfc925 --- /dev/null +++ b/appendix/packaging/export-updatepackage.md @@ -0,0 +1,111 @@ +# Export-UpdatePackage + +Exports a Sitecore update package containing a serialization diff list. + +## Syntax + +Export-UpdatePackage \[-CommandList\] <List\`1> \[\[-Name\] <String>\] \[\[-Path\] <String>\] \[-Readme <String>\] \[-LicenseFileName <String>\] \[-Tag <String>\] + +## Detailed Description + +The Export-UpdatePackage command generates a Sitecore update package containing a serialization diff list. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -CommandList <List\`1> + +List of changes to be included in the package. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Name <String> + +Name of the package. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 2 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path the update package should be saved under. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 3 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Readme <String> + +Contents of the "read me" instruction for the package + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -LicenseFileName <String> + +file name of the license to be included with the package. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Tag <String> + +Package tag. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## 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 + +```powershell +$diff = Get-UpdatePackageDiff -SourcePath C:\temp\SerializationSource -TargetPath C:\temp\SerializationTarget +Export-UpdatePackage -Path C:\temp\SerializationDiff.update -CommandList $diff -Name name +``` + +## Related Topics + +* [Get-UpdatePackageDiff](get-updatepackagediff.md) +* [Install-UpdatePackage](install-updatepackage.md) +* [https://sitecoresnippets.blogspot.com/2012/10/sitecore-courier-effortless-packaging.html](https://sitecoresnippets.blogspot.com/2012/10/sitecore-courier-effortless-packaging.html) +* [https://github.com/adoprog/Sitecore-Courier](https://github.com/adoprog/Sitecore-Courier) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/packaging/get-package.md b/appendix/packaging/get-package.md new file mode 100644 index 00000000..be956b16 --- /dev/null +++ b/appendix/packaging/get-package.md @@ -0,0 +1,63 @@ +# Get-Package + +Loads the package definition \(xml\) from the specified path. + +## Syntax + +Get-Package \[-Path\] <String> + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Path <String> + +Path to the package file. If the path is not absolute the path needs to be relative to the Sitecore Package path defined in the "PackagePath" setting and later exposed in the Sitecore.Shell.Applications.Install.PackageProjectPath + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Install.PackageProject + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +The following assumes that the project file is located in the default package directory. + +```powershell +PS master:\> Get-Package -Path myproject.xml +``` + +## Related Topics + +* [Export-Package](export-package.md) +* Import-Package +* [Install-UpdatePackage](install-updatepackage.md) +* [New-ExplicitFileSource](new-explicitfilesource.md) +* [New-ExplicitItemSource](new-explicititemsource.md) +* [New-FileSource](new-filesource.md) +* [New-ItemSource](new-itemsource.md) +* [New-Package](new-package.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [https://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/](https://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/) +* [https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae](https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae) +* [https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd\_nCypVZSNkudGwPFRqf1na0b&index=7](https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=7) + diff --git a/appendix/packaging/get-preset.md b/appendix/packaging/get-preset.md new file mode 100644 index 00000000..b8186d91 --- /dev/null +++ b/appendix/packaging/get-preset.md @@ -0,0 +1,70 @@ +# Get-Preset + +Returns a serialization preset for use with Export-Item. + +## Syntax + +Get-Preset \[\[-Name\] <String\[\]>\] + +## Detailed Description + +The Get-Preset command returns a serialization preset for use with Export-Item. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Name <String\[\]> + +Name of the serialization preset. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Data.Serialization.Presets.IncludeEntry + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> Get-Preset -Name "PowerShell", "AssetsOptimiser" | ft PresetName, Database, Path -AutoSize + +PresetName Database Path +---------- -------- ---- +PowerShell core /sitecore/templates/Modules/PowerShell Console +PowerShell core /sitecore/system/Modules/PowerShell/Console Colors +PowerShell core /sitecore/system/Modules/PowerShell/Script Library +PowerShell core /sitecore/layout/Layouts/Applications/PowerShell Console +PowerShell core /sitecore/layout/Layouts/Applications/PowerShell ISE Sheer +PowerShell core /sitecore/layout/Layouts/Applications/PowerShell ISE +PowerShell core /sitecore/layout/Layouts/Applications/PowerShell ListView +PowerShell core /sitecore/content/Documents and Settings/All users/Start menu/Right/PowerShell Toolbox +PowerShell core /sitecore/content/Applications/PowerShell +PowerShell core /sitecore/content/Applications/Content Editor/Context Menues/Default/Context PowerShell Scripts +PowerShell master /sitecore/templates/Modules/PowerShell Console +PowerShell master /sitecore/system/Modules/PowerShell/Console Colors +PowerShell master /sitecore/system/Modules/PowerShell/Rules +PowerShell master /sitecore/system/Modules/PowerShell/Script Library +AssetsOptimiser master /sitecore/system/Modules/Optimiser +``` + +## Related Topics + +* Serialize-Item +* Deserialize-Item +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/packaging/get-updatepackagediff.md b/appendix/packaging/get-updatepackagediff.md new file mode 100644 index 00000000..a9b38f99 --- /dev/null +++ b/appendix/packaging/get-updatepackagediff.md @@ -0,0 +1,110 @@ +# 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\] <String> \[\[-TargetPath\] <String>\] + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -SourcePath <String> + +Path containing the current serialization items that needs to be transformed into Target. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -TargetPath <String> + +Path containing the desired serialization state that the Source needs to be transformed to. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Update.Interfaces.ICommand + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Required addition to web.config file for the functionality to work: + +```powershell + + +
+ + + + + + __Created + {5DD74568-4D4B-44C1-B513-0AF5F4CDA34F} + __Revision + __Updated + __Updated by + + + + + + $(id) + + + $(id) + + + + + source + + + + target + + + +``` + +### 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 + +```powershell +$diff = Get-UpdatePackageDiff -SourcePath C:\temp\SerializationSource -TargetPath C:\temp\SerializationTarget +Export-UpdatePackage -Path C:\temp\SerializationDiff.update -CommandList $diff -Name name +``` + +## Related Topics + +* [Export-UpdatePackage](export-updatepackage.md) +* [Install-UpdatePackage](install-updatepackage.md) +* [https://sitecoresnippets.blogspot.com/2012/10/sitecore-courier-effortless-packaging.html](https://sitecoresnippets.blogspot.com/2012/10/sitecore-courier-effortless-packaging.html) +* [https://github.com/adoprog/Sitecore-Courier](https://github.com/adoprog/Sitecore-Courier) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/packaging/import-item-1.md b/appendix/packaging/import-item-1.md new file mode 100644 index 00000000..3e0773c6 --- /dev/null +++ b/appendix/packaging/import-item-1.md @@ -0,0 +1,180 @@ +# Import-Item + +Imports \(deserializes\) the specified path from the filesystem on the server as a Sitecore item. + +## Syntax + +Import-Item \[-Database <Database>\] \[-Root <String>\] \[-UseNewId\] \[-DisableEvents\] \[-ForceUpdate\] + +Import-Item \[-Item\] <Item> \[-Recurse\] \[-Root <String>\] \[-UseNewId\] \[-DisableEvents\] \[-ForceUpdate\] + +Import-Item \[-Preset\] <IncludeEntry> \[-Root <String>\] \[-UseNewId\] \[-DisableEvents\] \[-ForceUpdate\] + +Import-Item \[-Path\] <String> \[-Recurse\] \[-Root <String>\] \[-UseNewId\] \[-DisableEvents\] \[-ForceUpdate\] + +## Detailed Description + +The Import-Item command deserializes the specified items. + +The simplest syntax requires 2 parameters: + +* -Path : which is a path to the item on the drive but without .item extension. If the item does not exist in the Sitecore tree yet, you need to pass the parent item path. +* -Root : the directory which is the root of serialization. Trailing slash character is required, + +e.g.: + +Import-Item -Path "c:\project\data\serialization\master\sitecore\content\articles" -Root "c:\project\data\serialization\" + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Aliases + +The following abbreviations are aliases for this cmdlet: + +* Deserialize-Item + +## Parameters + +### -Database <Database> + +Database to contain the item to be deserialized. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be serialized. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Preset <IncludeEntry> + +Name of the preset to be deserialized. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item on the drive but without .item extension. If the item does not exist in the Sitecore tree yet, you need to pass the parent item path. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Recurse <SwitchParameter> + +If included in the execution - dederializes both the item and all of its children. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Root <String> + +The directory which is the root of serialization. Trailing slash character is required. if not specified the default root will be used. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -UseNewId <SwitchParameter> + +Tells Sitecore if each of the items should be created with a newly generated ID, e.g. Import-Item -path "c:\project\data\serialization\master\sitecore\content\articles" -root "c:\project\data\serialization\" -usenewid -recurse + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -DisableEvents <SwitchParameter> + +If set Sitecore will use EventDisabler during deserialization, e.g.: Import-Item -path "c:\project\data\serialization\master\sitecore\content\articles" -root "c:\project + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ForceUpdate <SwitchParameter> + +Forces item to be updated even if it has not changed. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* System.Void + +## Notes + +Help Author: Marek Musielak, Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\> Import-Item -path "c:\project\data\serialization\master\sitecore\content\articles" -root "c:\project\data\serialization\" +``` + +### EXAMPLE 2 + +```powershell +PS master:\> Import-Item -path "c:\project\data\serialization\master\sitecore\content\articles" -root "c:\project\data\serialization\" -recurse +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Export-Item](export-item.md) +* [Get-Preset](../common/get-preset.md) +* [https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd\_nCypVZSNkudGwPFRqf1na0b&index=7](https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=7) +* [https://gist.github.com/AdamNaj/6c86f61510dc3d2d8b2f](https://gist.github.com/AdamNaj/6c86f61510dc3d2d8b2f) +* [https://stackoverflow.com/questions/20266841/sitecore-powershell-deserialization](https://stackoverflow.com/questions/20266841/sitecore-powershell-deserialization) +* [https://stackoverflow.com/questions/20195718/sitecore-serialization-powershell](https://stackoverflow.com/questions/20195718/sitecore-serialization-powershell) +* [https://stackoverflow.com/questions/20283438/sitecore-powershell-deserialization-core-db](https://stackoverflow.com/questions/20283438/sitecore-powershell-deserialization-core-db) + diff --git a/appendix/packaging/import-item.md b/appendix/packaging/import-item.md new file mode 100644 index 00000000..3e0773c6 --- /dev/null +++ b/appendix/packaging/import-item.md @@ -0,0 +1,180 @@ +# Import-Item + +Imports \(deserializes\) the specified path from the filesystem on the server as a Sitecore item. + +## Syntax + +Import-Item \[-Database <Database>\] \[-Root <String>\] \[-UseNewId\] \[-DisableEvents\] \[-ForceUpdate\] + +Import-Item \[-Item\] <Item> \[-Recurse\] \[-Root <String>\] \[-UseNewId\] \[-DisableEvents\] \[-ForceUpdate\] + +Import-Item \[-Preset\] <IncludeEntry> \[-Root <String>\] \[-UseNewId\] \[-DisableEvents\] \[-ForceUpdate\] + +Import-Item \[-Path\] <String> \[-Recurse\] \[-Root <String>\] \[-UseNewId\] \[-DisableEvents\] \[-ForceUpdate\] + +## Detailed Description + +The Import-Item command deserializes the specified items. + +The simplest syntax requires 2 parameters: + +* -Path : which is a path to the item on the drive but without .item extension. If the item does not exist in the Sitecore tree yet, you need to pass the parent item path. +* -Root : the directory which is the root of serialization. Trailing slash character is required, + +e.g.: + +Import-Item -Path "c:\project\data\serialization\master\sitecore\content\articles" -Root "c:\project\data\serialization\" + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Aliases + +The following abbreviations are aliases for this cmdlet: + +* Deserialize-Item + +## Parameters + +### -Database <Database> + +Database to contain the item to be deserialized. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be serialized. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Preset <IncludeEntry> + +Name of the preset to be deserialized. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item on the drive but without .item extension. If the item does not exist in the Sitecore tree yet, you need to pass the parent item path. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Recurse <SwitchParameter> + +If included in the execution - dederializes both the item and all of its children. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Root <String> + +The directory which is the root of serialization. Trailing slash character is required. if not specified the default root will be used. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -UseNewId <SwitchParameter> + +Tells Sitecore if each of the items should be created with a newly generated ID, e.g. Import-Item -path "c:\project\data\serialization\master\sitecore\content\articles" -root "c:\project\data\serialization\" -usenewid -recurse + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -DisableEvents <SwitchParameter> + +If set Sitecore will use EventDisabler during deserialization, e.g.: Import-Item -path "c:\project\data\serialization\master\sitecore\content\articles" -root "c:\project + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ForceUpdate <SwitchParameter> + +Forces item to be updated even if it has not changed. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* System.Void + +## Notes + +Help Author: Marek Musielak, Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\> Import-Item -path "c:\project\data\serialization\master\sitecore\content\articles" -root "c:\project\data\serialization\" +``` + +### EXAMPLE 2 + +```powershell +PS master:\> Import-Item -path "c:\project\data\serialization\master\sitecore\content\articles" -root "c:\project\data\serialization\" -recurse +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Export-Item](export-item.md) +* [Get-Preset](../common/get-preset.md) +* [https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd\_nCypVZSNkudGwPFRqf1na0b&index=7](https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=7) +* [https://gist.github.com/AdamNaj/6c86f61510dc3d2d8b2f](https://gist.github.com/AdamNaj/6c86f61510dc3d2d8b2f) +* [https://stackoverflow.com/questions/20266841/sitecore-powershell-deserialization](https://stackoverflow.com/questions/20266841/sitecore-powershell-deserialization) +* [https://stackoverflow.com/questions/20195718/sitecore-serialization-powershell](https://stackoverflow.com/questions/20195718/sitecore-serialization-powershell) +* [https://stackoverflow.com/questions/20283438/sitecore-powershell-deserialization-core-db](https://stackoverflow.com/questions/20283438/sitecore-powershell-deserialization-core-db) + diff --git a/appendix/packaging/install-package.md b/appendix/packaging/install-package.md new file mode 100644 index 00000000..a41fbce8 --- /dev/null +++ b/appendix/packaging/install-package.md @@ -0,0 +1,95 @@ +# Install-Package + +Installs a Sitecore package from the specified path. + +## Syntax + +Install-Package \[\[-Path\] <String>\] \[-InstallMode <Undefined \| Overwrite \| Merge \| Skip \| SideBySide>\] \[-MergeMode <Undefined \| Clear \| Append \| Merge>\] \[-DisableIndexing\] + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Aliases + +The following abbreviations are aliases for this cmdlet: + +* Import-Package + +## Parameters + +### -Path <String> + +Path to the package file. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -InstallMode <InstallMode> + +Undefined, Overwrite, Merge, Skip, SideBySide + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -MergeMode <MergeMode> + +Undefined, Clear, Append, Merge + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -DisableIndexing <SwitchParameter> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> Install-Package -Path SitecorePowerShellConsole.zip -InstallMode Merge -MergeMode Merge +``` + +## Related Topics + +* [Export-Package](export-package.md) +* [Get-Package](get-package.md) +* [Install-UpdatePackage](install-updatepackage.md) +* [New-ExplicitFileSource](new-explicitfilesource.md) +* [New-ExplicitItemSource](new-explicititemsource.md) +* [New-FileSource](new-filesource.md) +* [New-ItemSource](new-itemsource.md) +* [New-Package](new-package.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [https://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/](https://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/) +* [https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae](https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae) +* [https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd\_nCypVZSNkudGwPFRqf1na0b&index=7](https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=7) + diff --git a/appendix/packaging/install-updatepackage.md b/appendix/packaging/install-updatepackage.md new file mode 100644 index 00000000..adc9c363 --- /dev/null +++ b/appendix/packaging/install-updatepackage.md @@ -0,0 +1,90 @@ +# Install-UpdatePackage + +Installs a Sitecore update package from the specified path. + +## Syntax + +Install-UpdatePackage \[-Path\] <String> \[\[-RollbackPackagePath\] <String>\] -UpgradeAction <Preview \| Upgrade> -InstallMode <Install \| Update> + +## Detailed Description + +The Install-UpdatePackage command installs update packages that are used created by Sitecore CMS updates, TDS, and Courier. + +Install-UpdatePackage. Install-UpdatePackage -Path "C:\Projects\LaunchSitecore.TDSMaster.update" -UpgradeAction {Preview or Upgrade} -InstallMode {Install or Update} + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Path <String> + +Path to the .update package on the Sitecore server disk drive. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -RollbackPackagePath <String> + +Specify Rollback Package Path - for rolling back if the installation was not functioning as expected. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -UpgradeAction <UpgradeAction> + +Preview / Upgrade + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -InstallMode <InstallMode> + +Install / Update + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Update.Installer.ContingencyEntry + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> Install-UpdatePackage -Path "C:\Projects\LaunchSitecore.TDSMaster.update" -UpgradeAction Preview -InstallMode Install +``` + +## Related Topics + +* [Export-UpdatePackage](export-updatepackage.md) +* [Get-UpdatePackageDiff](get-updatepackagediff.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/packaging/new-explicitfilesource.md b/appendix/packaging/new-explicitfilesource.md new file mode 100644 index 00000000..5336d6fe --- /dev/null +++ b/appendix/packaging/new-explicitfilesource.md @@ -0,0 +1,104 @@ +# New-ExplicitFileSource + +Creates new File source that can be added to a Sitecore package. + +## Syntax + +New-ExplicitFileSource \[-Name\] <String> \[-File <FileSystemInfo>\] \[-InstallMode <String>\] + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Name <String> + +Name of the file source. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -File <FileSystemInfo> + +Path to the file to be included. this can be automatically discovered if a stream of files is piped to the command. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -InstallMode <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Install.Files.ExplicitFileSource + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +Following example creates a new package, adds content of the Console folder \(except the source files\) under the site folder saves it in the Sitecore Package folder + gives you an option to download the saved package. + +```powershell +# Create package +$package = New-Package "Packing in Powerful Ways"; + +# Set package metadata +$package.Sources.Clear(); + +$package.Metadata.Author = "Adam Najmanowicz, Michael West"; +$package.Metadata.Publisher = "Powerful Ways"; +$package.Metadata.Version = "1.0"; +$package.Metadata.Readme = 'This text will be visible to people installing your package' + +# Add content of the Console folder (except the source files) located in the site folder to the package +$source = Get-ChildItem -exclude *.cs -Path "$AppPath\Console" -Recurse -File | New-ExplicitFileSource -Name "Console Assets" +$package.Sources.Add($source); + +# Save package +Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip + +# Offer the user to download the package +Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip" +``` + +## Related Topics + +* [Export-Package](export-package.md) +* [Get-Package](get-package.md) +* Import-Package +* [Install-UpdatePackage](install-updatepackage.md) +* [New-ExplicitItemSource](new-explicititemsource.md) +* [New-FileSource](new-filesource.md) +* [New-ItemSource](new-itemsource.md) +* [New-Package](new-package.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [https://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/](https://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/) +* [https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae](https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae) +* [https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd\_nCypVZSNkudGwPFRqf1na0b&index=7](https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=7) + diff --git a/appendix/packaging/new-explicititemsource.md b/appendix/packaging/new-explicititemsource.md new file mode 100644 index 00000000..7d8ea248 --- /dev/null +++ b/appendix/packaging/new-explicititemsource.md @@ -0,0 +1,146 @@ +# New-ExplicitItemSource + +Creates new Explicit Item Source that can be added to a Sitecore package. + +## Syntax + +New-ExplicitItemSource \[-Item <Item>\] \[-Name\] <String> \[\[-SkipVersions\]\] \[-InstallMode <Undefined \| Overwrite \| Merge \| Skip \| SideBySide>\] \[-MergeMode <Undefined \| Clear \| Append \| Merge>\] + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Item <Item> + +The item to be added to the source. If used in pipeline after e.g. Get-Item the source is created once all items are piped into it. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Name <String> + +Name of the item source. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -SkipVersions <SwitchParameter> + +Add this parameter if you want to skip versions of the item from being included in the source and only include the version provided. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 2 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -InstallMode <InstallMode> + +Specifies what installer should do if the item already exists. Possible values: + +* Undefined - User will have to choose one of the below. But they probably don't really know what should be done so not a preferable option. +* Overwrite - All versions of the old item are removed and replaced with all versions of the new item. This option basically replaces the old item with new one. +* Merge - merge with existing item. How the item will be merged is defined with MergeMode parameter + * Skip - All versions remains unchanged. Other languages remains unchanged. All children remains unchanged. +* SideBySide - all new item will be created. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -MergeMode <MergeMode> + +Specifies what installer should do if the item already exists and InstallMode is specified as Merge. Possible values: + +* Undefined - User will have to choose one of the below. But they probably don't really know what should be done so not a preferable option. +* Clear - All versions of the old item are removed and replaced with all versions of the new item. This option basically replaces the old item with new one. Other language versions \(those which are not in the package\) are removed but only for items which are in the package. All child items which are not in the package keep other language versions. All child items which are in the package are changed. +* Append - All versions of the new item are added on top of versions of the previous item. This option allows for further manual merge because all history is preserved, so user can see what was changed. Other languages remains unchanged. All child items which are not in the package keep other language versions. All child items which are in the package are changed. +* Merge - All versions with the same number in both packages are replaced with versions from installed package. All versions which are in the package but not in the target are added. All versions which are not in the package but are in the target remains unchanged. This option also preserves history, however it might overwrite some of the changes. Other languages remains unchanged. All child items which are in the package are changed. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Install.Items.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. + +```powershell +$package = New-Package "Packing in Powerful Ways"; + +# Set package metadata +$package.Sources.Clear(); + +$package.Metadata.Author = "Adam Najmanowicz, Michael West"; +$package.Metadata.Publisher = "Powerful Ways"; +$package.Metadata.Version = "1.0"; +$package.Metadata.Readme = 'This text will be visible to people installing your package' + +# Add content/home and all of its children to the package +$source = Get-Item 'master:\content\home\*' | New-ExplicitItemSource -Name 'Home Page' -InstallMode Overwrite +$package.Sources.Add($source); + +# Save package +Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip + +# Offer the user to download the package +Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip" +``` + +## Related Topics + +* [Export-Package](export-package.md) +* [Get-Package](get-package.md) +* Import-Package +* [Install-UpdatePackage](install-updatepackage.md) +* [New-ExplicitFileSource](new-explicitfilesource.md) +* [New-FileSource](new-filesource.md) +* [New-ItemSource](new-itemsource.md) +* [New-Package](new-package.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [https://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/](https://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/) +* [https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae](https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae) +* [https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd\_nCypVZSNkudGwPFRqf1na0b&index=7](https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=7) + diff --git a/appendix/packaging/new-filesource.md b/appendix/packaging/new-filesource.md new file mode 100644 index 00000000..b9ca9507 --- /dev/null +++ b/appendix/packaging/new-filesource.md @@ -0,0 +1,128 @@ +# New-FileSource + +Creates new File source that can be added to a Sitecore package. + +## Syntax + +New-FileSource \[-Name\] <String> \[-Root\] <DirectoryInfo> \[\[-IncludeFilter\] <String>\] \[\[-ExcludeFilter\] <String>\] \[-InstallMode <String>\] + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Name <String> + +Name of the file source. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Root <DirectoryInfo> + +Root folder to include in the package + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 2 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -IncludeFilter <String> + +Filter that defines which files will be included. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 3 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ExcludeFilter <String> + +Filter that defines which files will NOT be included. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 4 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -InstallMode <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Install.Files.FileSource + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +Following example creates a new package, adds content of the Console folder under the site folder saves it in the Sitecore Package folder + gives you an option to download the saved package. + +```powershell +# Create package +$package = New-Package "Packing in Powerful Ways"; + +# Set package metadata +$package.Sources.Clear(); + +$package.Metadata.Author = "Adam Najmanowicz, Michael West"; +$package.Metadata.Publisher = "Powerful Ways"; +$package.Metadata.Version = "1.0"; +$package.Metadata.Readme = 'This text will be visible to people installing your package' + +# Add content of the Console folder in the site folder to the package +$source = New-FileSource -Name "Console Assets" -Root "$AppPath\Console" +$package.Sources.Add($source); + +# Save package +Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip + +# Offer the user to download the package +Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip" +``` + +## Related Topics + +* [Export-Package](export-package.md) +* [Get-Package](get-package.md) +* Import-Package +* [Install-UpdatePackage](install-updatepackage.md) +* [New-ExplicitFileSource](new-explicitfilesource.md) +* [New-ExplicitItemSource](new-explicititemsource.md) +* [New-ItemSource](new-itemsource.md) +* [New-Package](new-package.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [https://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/](https://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/) +* [https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae](https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae) +* [https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd\_nCypVZSNkudGwPFRqf1na0b&index=7](https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=7) + diff --git a/appendix/packaging/new-itemsource.md b/appendix/packaging/new-itemsource.md new file mode 100644 index 00000000..a5238f76 --- /dev/null +++ b/appendix/packaging/new-itemsource.md @@ -0,0 +1,171 @@ +# New-ItemSource + +Creates new Item source that can be added to a Sitecore package. + +## Syntax + +New-ItemSource \[-Item <Item>\] \[-Name\] <String> \[\[-SkipVersions\]\] \[\[-Database\] <String>\] \[\[-Root\] <String>\] \[-InstallMode <Undefined \| Overwrite \| Merge \| Skip \| SideBySide>\] \[-MergeMode <Undefined \| Clear \| Append \| Merge>\] + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Item <Item> + +The item to be added as the root of the source. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Name <String> + +Name of the item source. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -SkipVersions <SwitchParameter> + +Add this parameter if you want to skip versions of the item from being included in the source and only include the version provided. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 2 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be added - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 3 | +| Default Value | | +| Accept Pipeline Input? | true \(ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Root <String> + +You can provide the Root as sitecore native path instead of specifying it through. Do not include Item in such case as Item will take priority over Root. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 4 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -InstallMode <InstallMode> + +Specifies what installer should do if the item already exists. Possible values: + +* Undefined - User will have to choose one of the below. But they probably don't really know what should be done so not a preferable option. +* Overwrite - All versions of the old item are removed and replaced with all versions of the new item. This option basically replaces the old item with new one. +* Merge - merge with existing item. How the item will be merged is defined with MergeMode parameter + * Skip - All versions remains unchanged. Other languages remains unchanged. All children remains unchanged. +* SideBySide - all new item will be created. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -MergeMode <MergeMode> + +Specifies what installer should do if the item already exists and InstallMode is specified as Merge. Possible values: + +* Undefined - User will have to choose one of the below. But they probably don't really know what should be done so not a preferable option. +* Clear - All versions of the old item are removed and replaced with all versions of the new item. This option basically replaces the old item with new one. Other language versions \(those which are not in the package\) are removed but only for items which are in the package. All child items which are not in the package keep other language versions. All child items which are in the package are changed. +* Append - All versions of the new item are added on top of versions of the previous item. This option allows for further manual merge because all history is preserved, so user can see what was changed. Other languages remains unchanged. All child items which are not in the package keep other language versions. All child items which are in the package are changed. +* Merge - All versions with the same number in both packages are replaced with versions from installed package. All versions which are in the package but not in the target are added. All versions which are not in the package but are in the target remains unchanged. This option also preserves history, however it might overwrite some of the changes. Other languages remains unchanged. All child items which are in the package are changed. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Install.Items.ItemSource + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +Following example creates a new package, adds content/home item to it and saves it in the Sitecore Package folder+ gives you an option to download the saved package. + +```powershell +# Create package +$package = New-Package "Packing in Powerful Ways"; + +# Set package metadata +$package.Sources.Clear(); + +$package.Metadata.Author = "Adam Najmanowicz, Michael West"; +$package.Metadata.Publisher = "Powerful Ways"; +$package.Metadata.Version = "1.0"; +$package.Metadata.Readme = 'This text will be visible to people installing your package' + +# Add contnet/home to the package +$source = Get-Item 'master:\content\home' | New-ItemSource -Name 'Home Page' -InstallMode Overwrite +$package.Sources.Add($source); + +# Save package +Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip + +# Offer the user to download the package +Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip" +``` + +## Related Topics + +* [Export-Package](export-package.md) +* [Get-Package](get-package.md) +* Import-Package +* [Install-UpdatePackage](install-updatepackage.md) +* [New-ExplicitFileSource](new-explicitfilesource.md) +* [New-ExplicitItemSource](new-explicititemsource.md) +* [New-FileSource](new-filesource.md) +* [New-Package](new-package.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [https://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/](https://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/) +* [https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae](https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae) +* [https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd\_nCypVZSNkudGwPFRqf1na0b&index=7](https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=7) + diff --git a/appendix/packaging/new-package.md b/appendix/packaging/new-package.md new file mode 100644 index 00000000..90680abe --- /dev/null +++ b/appendix/packaging/new-package.md @@ -0,0 +1,81 @@ +# New-Package + +Creates a new Sitecore install package object. + +## Syntax + +New-Package \[-Name\] <String> + +## Detailed Description + +Creates a new Sitecore install package object that allows for further addition of items and files & further export to file. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Name <String> + +Package name + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Install.PackageProject + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +Following example creates a new package, adds content/home item to it and saves it in the Sitecore Package folder+ gives you an option to download the saved package. + +```powershell +$package = New-Package "Packing in Powerful Ways"; + +# Set package metadata +$package.Sources.Clear(); + +$package.Metadata.Author = "Adam Najmanowicz, Michael West"; +$package.Metadata.Publisher = "Powerful Ways"; +$package.Metadata.Version = "1.0"; +$package.Metadata.Readme = 'This text will be visible to people installing your package' + +# Add contnet/home to the package +$source = Get-Item 'master:\content\home' | New-ItemSource -Name 'Home Page' -InstallMode Overwrite +$package.Sources.Add($source); + +# Save package +Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip + +# Offer the user to download the package +Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip" +``` + +## Related Topics + +* [Export-Package](export-package.md) +* [Get-Package](get-package.md) +* Import-Package +* [New-ExplicitFileSource](new-explicitfilesource.md) +* [New-ExplicitItemSource](new-explicititemsource.md) +* [New-FileSource](new-filesource.md) +* [New-ItemSource](new-itemsource.md) +* [Install-UpdatePackage](install-updatepackage.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [https://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/](https://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/) +* [https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae](https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae) +* [https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd\_nCypVZSNkudGwPFRqf1na0b&index=7](https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=7) + diff --git a/appendix/packaging/new-securitysource.md b/appendix/packaging/new-securitysource.md new file mode 100644 index 00000000..e2ea4853 --- /dev/null +++ b/appendix/packaging/new-securitysource.md @@ -0,0 +1,176 @@ +# New-SecuritySource + +Creates new User & Role source that can be added to a Sitecore package. + +## Syntax + +New-SecuritySource \[-Account\] <Account> \[-Name\] <String> + +New-SecuritySource \[-Identity\] <AccountIdentity> \[\[-AccountType\] <Unknown \| Role \| User>\] \[-Name\] <String> + +New-SecuritySource \[-Filter\] <String\[\]> \[\[-AccountType\] <Unknown \| Role \| User>\] \[-Name\] <String> + +## Detailed Description + +Creates new User & Role source that can be added to a Sitecore package. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Account <Account> + +User or Role provided from e.g. Get-Role or Get-User Cmdlet. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 2 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Identity <AccountIdentity> + +User or role name including domain for which the access rule is being created. If no domain is specified - 'sitecore' will be used as the default domain. + +Specifies the Sitecore user by providing one of the following values. + +```powershell +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 | | +| :--- | :--- | +| Required? | true | +| Position? | 2 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Filter <String\[\]> + +Specifies a simple pattern to match Sitecore roles & users. + +Examples: The following examples show how to use the filter syntax. + +To get security for all roles, use the asterisk wildcard: Get-ItemAcl -Filter \* + +To security got all roles in a domain use the following command: Get-ItemAcl -Filter "sitecore\*" + +if -AccountType parameter is specified as Role - only roles will be taken into consideration. if -AccountType parameter is specified as User - only users will be taken into consideration. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 2 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -AccountType <AccountType> + +* Unknown - Both Roles and users will be taken into consideration when looking for accounts through either -Identity or -Filter parameters +* Role - Only Roles will be taken into consideration when looking for accounts through either -Identity or -Filter parameters +* User - Only Users will be taken into consideration when looking for accounts through either -Identity or -Filter parameters + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | 3 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Name <String> + +Name of the security source. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Security.Accounts.Account + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Install.Security.SecuritySource + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Following example creates a new package, adds sitecore\admin user to it and saves it in the Sitecore Package folder+ gives you an option to download the saved package. + +```powershell +# Create package +$package = New-Package "Packing in Powerful Ways"; + +# Set package metadata +$package.Sources.Clear(); + +$package.Metadata.Author = "Adam Najmanowicz, Michael West"; +$package.Metadata.Publisher = "Powerful Ways"; +$package.Metadata.Version = "1.0"; +$package.Metadata.Readme = 'This text will be visible to people installing your package' + +# Create security source with Sitecore Administrator only +$source = New-SecuritySource -Identity sitecore\admin -Name "Sitecore Admin" +$package.Sources.Add($source); + +# Save package +Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip + +# Offer the user to download the package +Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip" +``` + +### EXAMPLE 2 + +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. + +```powershell +$package = New-Package "Packing in Powerful Ways"; + +# Set package metadata +$package.Sources.Clear(); + +$package.Metadata.Author = "Adam Najmanowicz, Michael West"; +$package.Metadata.Publisher = "Powerful Ways"; +$package.Metadata.Version = "1.0"; +$package.Metadata.Readme = 'This text will be visible to people installing your package' + +# Create security source with all roles within the sitecore domain +$source = New-SecuritySource -Filter sitecore\* -Name "Sitecore Roles" -AccountType Role +$package.Sources.Add($source); + +# Save package +Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip + +# Offer the user to download the package +Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip" +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/presentation/README.md b/appendix/presentation/README.md new file mode 100644 index 00000000..3a4fcd98 --- /dev/null +++ b/appendix/presentation/README.md @@ -0,0 +1 @@ +# Presentation \ No newline at end of file diff --git a/appendix/commands/Set-User.md b/appendix/presentation/add-placeholdersetting.md similarity index 53% rename from appendix/commands/Set-User.md rename to appendix/presentation/add-placeholdersetting.md index e2fdde7f..b95f1225 100644 --- a/appendix/commands/Set-User.md +++ b/appendix/presentation/add-placeholdersetting.md @@ -1,483 +1,410 @@ -# Set-User - -Sets the Sitecore user properties. - -## Syntax - -Set-User [-Identity] <AccountIdentity> [-IsAdministrator <Boolean>] [-Portrait <String>] [-Email <String>] [-FullName <String>] [-Comment <String>] [-ProfileItemId <ID>] [-StartUrl <String>] [-Enabled] [-CustomProperties <Hashtable>] - -Set-User -Instance <User> [-IsAdministrator <Boolean>] [-Portrait <String>] [-Email <String>] [-FullName <String>] [-Comment <String>] [-ProfileItemId <ID>] [-StartUrl <String>] [-Enabled] [-CustomProperties <Hashtable>] - - -## 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-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -IsAdministrator  <Boolean> - -Specifies whether the Sitecore user should be classified as an Administrator. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Portrait  <String> - -Specifies the Sitecore user portrait image. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Identity  <AccountIdentity> - -Specifies the Sitecore user by providing one of the following values. - - Local Name - Example: admin - - Fully Qualified Name - Example: sitecore\admi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Instance  <User> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?true (ByValue)
Accept Wildcard Characters?false
- -### -Email  <String> - -Specifies the Sitecore user email address. The value is validated for a properly formatted address. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -FullName  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Comment  <String> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -ProfileItemId  <ID> - -Specifies the profile id to use for the user. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -StartUrl  <String> - -Specifies the url to navigate to once the user is logged in. The values are validated with a pretermined set. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Enabled  <SwitchParameter> - -Specifies whether the Sitecore user should be enabled. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -CustomProperties  <Hashtable> - -Specifies a hashtable of custom properties to assign to the Sitecore user profile. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* System.String -Represents the identity of a user. +# Add-PlaceholderSetting + +Adds a placeholder setting to a chosen device for the presentation of an item. + +## Syntax + +```powershell +Add-PlaceholderSetting [-Item] -Instance [-MetaDataItemId ] [-Key ] [-Device ] [-FinalLayout] [-Language ] -Sitecore.Security.Accounts.User -Represents the instance of a user. - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* None. - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE 1 - - - -```powershell - -PS master:\> Set-User -Identity michael -Email michaellwest@gmail.com - -``` - -### EXAMPLE 2 - - - -```powershell - -PS master:\> "michael","adam","mike" | Set-User -Enable $false - -``` - -### EXAMPLE 3 - - - -```powershell - -PS master:\> Get-User -Filter * | Set-User -Comment "Sitecore user" - -``` - -### EXAMPLE 4 - - - -```powershell - -PS master:\> Set-User -Identity michael -CustomProperties @{"Date"=(Get-Date)} -PS master:\>(Get-User michael).Profile.GetCustomProperty("Date") +Add-PlaceholderSetting [-Path] -Instance [-MetaDataItemId ] [-Key ] [-Device ] [-FinalLayout] [-Language ] -7/3/2014 4:40:02 PM - -``` - -### EXAMPLE 5 - - - -```powershell - -PS master:\> Set-User -Identity michael -IsAdministrator $true -CustomProperties @{"HireDate"="03/17/2010"} -PS master:\>$user = Get-User -Identity michael -PS master:\>$user.Profile.GetCustomProperty("HireDate") +Add-PlaceholderSetting -Instance -Id [-MetaDataItemId ] [-Key ] [-Device ] [-FinalLayout] [-Language ] [-Database ] +``` + +## Detailed Description + +Adds a placeholder setting to a chosen device for the presentation of an item. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions -03/17/2010 - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Get-User](/appendix/commands/Get-User.md) * [New-User](/appendix/commands/New-User.md) * [Remove-User](/appendix/commands/Remove-User.md) * [Unlock-User](/appendix/commands/Unlock-User.md) +## Parameters + +### -Database  <string> + +Database containing the item to be processed - can work with Language parameter to narrow the publication scope. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -Device  <DeviceItem> + +Device the placeholder setting is assigned to. If not specified - default device will be used. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -FinalLayout  <switch> + +Targets the Final Layout. If not provided, the Shared Layout will be targeted. Applies to Sitecore 8.0 and higher only. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -Id  <string> + +Id of the item to be processed - can work with Language parameter to narrow the publication scope. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?true
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?
+ +### -Instance  <PlaceholderDefinition> + +Placeholder setting definition to be added to the item + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesPlaceholderSetting
Required?true
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -Item  <Item> + +The item to be processed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?true
Position?0
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
+ +### -Key  <string> + +The key for this placeholder setting - if not specified the value provided in the placeholder setting definition specified in the Instance parameter will be used. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -Language  <string[]> + +Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard supported. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesLanguages
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -MetaDataItemId  <string> + +The metadata item Id for this placeholder setting - if not specified the value provided in the placeholder setting definition specified in the Instance parameter will be used. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -Path  <string> + +Path to the item to be processed - can work with Language parameter to narrow the publication scope. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesFullName, FileName
Required?true
Position?0
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* System.Void + +## Notes + +Help Author: Adam Najmanowicz, Michael West, Alex Washtell + +## Examples + +### EXAMPLE 1 + +Create item defining placeholder setting and add to an item + +```powershell +$placeholderSetting = gi "master:\layout\Placeholder Settings\content" | New-PlaceholderSetting -Key "content" +$item = gi master:\content\Home +# Add the placeholder setting to the item +Add-PlaceholderSetting -Item $item -Instance $placeholderSetting +``` + +### EXAMPLE 2 + +Create item defining placeholder setting and add to an item, overriding the key + +```powershell +$placeholderSetting = gi "master:\layout\Placeholder Settings\content" | New-PlaceholderSetting -Key "content" +# find item you want the placeholder setting added to +$item = gi master:\content\Home +# Add the placeholder setting to the item +Add-PlaceholderSetting -Item $item -Instance $placeholderSetting -Key "content-override" +``` + +## Related Topics + + +* https://github.com/SitecorePowerShell/Console/
+* [Get-PlaceholderSetting](get-placeholdersetting.md) +* [New-PlaceholderSetting](new-placeholdersetting.md) +* [Remove-PlaceholderSetting](remove-placeholdersetting.md) \ No newline at end of file diff --git a/appendix/presentation/add-rendering.md b/appendix/presentation/add-rendering.md new file mode 100644 index 00000000..0c5af659 --- /dev/null +++ b/appendix/presentation/add-rendering.md @@ -0,0 +1,217 @@ +# Add-Rendering + +Adds a rendering to a chosen device for the presentation of an item. + +## Syntax + +```powershell +Add-Rendering [-Item] -Instance [-Parameter ] -PlaceHolder [-DataSource ] [-Index ] [-Device ] [-FinalLayout] [-Language ] [-PassThru] + +Add-Rendering [-Path] -Instance [-Parameter ] -PlaceHolder [-DataSource ] [-Index ] [-Device ] [-FinalLayout] [-Language ] [-PassThru] + +Add-Rendering -Id [-Database ] -Instance [-Parameter ] -PlaceHolder [-DataSource ] [-Index ] [-Device ] [-FinalLayout] [-Language ] [-PassThru] +``` + +## Detailed Description + +Adds a rendering to a chosen device for the presentation of an item. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Instance <RenderingDefinition> + +Rendering definition to be added to the item + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Parameter <Hashtable> + +Rendering Parameters to be overriden on the Rendering that is being updated - if not specified the value provided in rendering definition specified in the Instance parameter will be used. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -PlaceHolder <String> + +Placeholder path the Rendering should be added to - if not specified the value provided in rendering definition specified in the Instance parameter will be used. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -DataSource <String> + +Data source of the Rendering - if not specified the value provided in rendering definition specified in the Instance parameter will be used. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Index <Int32> + +Index at which the Rendering should be inserted. If not provided the rendering will be appended at the end of the list. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Device <DeviceItem> + +Device the rendering is assigned to. If not specified - default device will be used. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -FinalLayout <SwitchParameter> + +Targets the Final Layout. If not provided, the Shared Layout will be targeted. Applies to Sitecore 8.0 and higher only. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -PassThru <SwitchParameter> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* System.Void + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Find item defining rendering and create rendering definition. + +```powershell +# Find the rendering item and convert to a rendering +$renderingPath = "/sitecore/layout/Renderings/Feature/Experience Accelerator/Page Content/Page Content" +$renderingItem = Get-Item -Database "master" -Path $renderingPath | New-Rendering -Placeholder "main" +# Find the item to receive the new rendering +$item = Get-Item -Path "master:\content\Training\Playground\play1\Home" +# Add the rendering to the item +Add-Rendering -Item $item -PlaceHolder "main" -Instance $renderingItem -Parameter @{ "Reset Caching Options" = "1" } -FinalLayout +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [New-Rendering](new-rendering.md) +* [Set-Rendering](set-rendering.md) +* [Get-Rendering](get-rendering.md) +* [Get-LayoutDevice](get-layoutdevice.md) +* [Remove-Rendering](remove-rendering.md) +* [Get-Layout](get-layout.md) +* [Set-Layout](set-layout.md) + diff --git a/appendix/presentation/get-layout.md b/appendix/presentation/get-layout.md new file mode 100644 index 00000000..2941b0cf --- /dev/null +++ b/appendix/presentation/get-layout.md @@ -0,0 +1,142 @@ +# Get-Layout + +Returns the layout for the specified item. + +## Syntax + +```powershell +Get-Layout [-Item] [-Device ] [-FinalLayout] [-Language ] + +Get-Layout [-Path] [-Device ] [-FinalLayout] [-Language ] + +Get-Layout -Id [-Database ] [-Device ] [-FinalLayout] [-Language ] +``` + +## Detailed Description + +The Get-Layout command returns the layout for the specified item. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Device <DeviceItem> + +Layout Device for which the item should be returned. If not specified All layouts used will be returned. If Device is specified but no layout is specified the command will return an error that can be silenced + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -FinalLayout <SwitchParameter> + +Returns the Final Layout. If not provided, the Shared Layout will be returned. Applies to Sitecore 8.0 and higher only. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +The following retrieves the layouts defined on the home item. + +```powershell +Get-Layout -Path "master:{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Add-Rendering](add-rendering.md) +* [New-Rendering](new-rendering.md) +* [Set-Rendering](set-rendering.md) +* [Get-Rendering](get-rendering.md) +* [Get-LayoutDevice](get-layoutdevice.md) +* [Remove-Rendering](remove-rendering.md) +* [Set-Layout](set-layout.md) +* [Reset-Layout](reset-layout.md) + diff --git a/appendix/presentation/get-layoutdevice.md b/appendix/presentation/get-layoutdevice.md new file mode 100644 index 00000000..8b970c7a --- /dev/null +++ b/appendix/presentation/get-layoutdevice.md @@ -0,0 +1,97 @@ +# Get-LayoutDevice + +Returns the layout for the specified device. + +## Syntax + +```powershell +Get-LayoutDevice [-Name] + +Get-LayoutDevice [-Default] +``` + +## Detailed Description + +The Get-LayoutDevice command returns the layout for the specified device. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Name <String> + +Name of the device to return. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Default <SwitchParameter> + +Determines that a default system layout device should be returned. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Data.Items.DeviceItem + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Get Print device + +```powershell +PS master:\> Get-LayoutDevice "Print" +``` + +### EXAMPLE 2 + +Get default device + +```powershell +PS master:\> Get-LayoutDevice -Default +``` + +### EXAMPLE 3 + +Get all layout devices + +```powershell +PS master:\> Get-LayoutDevice * +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Add-Rendering](add-rendering.md) +* [New-Rendering](new-rendering.md) +* [Set-Rendering](set-rendering.md) +* [Get-Rendering](get-rendering.md) +* [Remove-Rendering](remove-rendering.md) +* [Get-Layout](get-layout.md) +* [Set-Layout](set-layout.md) + diff --git a/appendix/commands/Add-Rendering.md b/appendix/presentation/get-placeholdersetting.md similarity index 63% rename from appendix/commands/Add-Rendering.md rename to appendix/presentation/get-placeholdersetting.md index 0394b7e1..78ba515a 100644 --- a/appendix/commands/Add-Rendering.md +++ b/appendix/presentation/get-placeholdersetting.md @@ -1,464 +1,477 @@ -# Add-Rendering - -Adds a rendering to a chosen device for the presentation of an item. - -## Syntax - -Add-Rendering [-Item] <Item> -Instance <RenderingDefinition> [-Parameter <Hashtable>] -PlaceHolder <String> [-DataSource <String>] [-Index <Int32>] [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - -Add-Rendering [-Path] <String> -Instance <RenderingDefinition> [-Parameter <Hashtable>] -PlaceHolder <String> [-DataSource <String>] [-Index <Int32>] [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - -Add-Rendering -Id <String> [-Database <String>] -Instance <RenderingDefinition> [-Parameter <Hashtable>] -PlaceHolder <String> [-DataSource <String>] [-Index <Int32>] [-Device <DeviceItem>] [-FinalLayout] [-Language <String[]>] - - -## Detailed Description - -Adds a rendering to a chosen device for the presentation of an item. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Instance  <RenderingDefinition> - -Rendering definition to be added to the item - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Parameter  <Hashtable> - -Rendering Parameters to be overriden on the Rendering that is being updated - if not specified the value provided in rendering definition specified in the Instance parameter will be used. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -PlaceHolder  <String> - -Placeholder path the Rendering should be added to - if not specified the value provided in rendering definition specified in the Instance parameter will be used. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -DataSource  <String> - -Data source of the Rendering - if not specified the value provided in rendering definition specified in the Instance parameter will be used. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Index  <Int32> - -Index at which the Rendering should be inserted. If not provided the rendering will be appended at the end of the list. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Device  <DeviceItem> - -Device the rendering is assigned to. If not specified - default device will be used. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -FinalLayout  <SwitchParameter> - -Targets the Final Layout. If not provided, the Shared Layout will be targeted. Applies to Sitecore 8.0 and higher only. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Layouts.RenderingDefinitio - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - -find item defining rendering and create rendering definitio - -```powershell - -PS master:\> $renderingItem = gi master:\layout\Sublayouts\ZenGarden\Basic\Content | New-Rendering -Placeholder "main" -# find item you want the rendering added to -PS master:\> $item = gi master:\content\Demo\Int\Home -# Add the rendering to the item -PS master:\> Add-Rendering -Item $item -PlaceHolder "main" -Rendering $renderingItem -Parameter @{ FieldName = "Content" } - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [New-Rendering](/appendix/commands/New-Rendering.md) * [Set-Rendering](/appendix/commands/Set-Rendering.md) * [Get-Rendering](/appendix/commands/Get-Rendering.md) * [Get-LayoutDevice](/appendix/commands/Get-LayoutDevice.md) * [Remove-Rendering](/appendix/commands/Remove-Rendering.md) * [Get-Layout](/appendix/commands/Get-Layout.md) * [Set-Layout](/appendix/commands/Set-Layout.md) +# Get-PlaceholderSetting + +The Get-PlaceholderSetting command returns PlaceholderSettingDefinition(s) for an item using the filtering parameters. + +## Syntax + +```powershell +Get-PlaceholderSetting -Item [-Key ] [-PlaceholderSetting ] [-Index ] [-Device ] [-FinalLayout] [-Language ] + +Get-PlaceholderSetting -Item -Instance [-Device ] [-FinalLayout] [-Language ] + +Get-PlaceholderSetting -Item -UniqueId [-Device ] [-FinalLayout] [-Language ] + +Get-PlaceholderSetting -Path [-Key ] [-PlaceholderSetting ] [-Index ] [-Device ] [-FinalLayout] [-Language ] + +Get-PlaceholderSetting -Path -Instance [-Device ] [-FinalLayout] [-Language ] + +Get-PlaceholderSetting -Path -UniqueId [-Device ] [-FinalLayout] [-Language ] + +Get-PlaceholderSetting [-Id ] [-Database ] [-Key ] [-PlaceholderSetting ] [-Index ] [-Device ] [-FinalLayout] [-Language ] + +Get-PlaceholderSetting -Instance [-Id ] [-Database ] [-Device ] [-FinalLayout] [-Language ] + +Get-PlaceholderSetting -UniqueId [-Id ] [-Database ] [-Device ] [-FinalLayout] [-Language ] +``` + +## Detailed Description + +The Get-PlaceholderSetting command returns PlaceholderSettingDefinition(s) for an item using the filtering parameters. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Database  <string> + +Database containing the item to be processed - can work with Language parameter to narrow the publication scope. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -Device  <DeviceItem> + +Device for which the placeholder settings will be retrieved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -FinalLayout  <switch> + +Targets the Final Layout. If not provided, the Shared Layout will be targeted. Applies to Sitecore 8.0 and higher only. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -Id  <string> + +Id of the item to be processed - can work with Language parameter to narrow the publication scope. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -Index  <int> + +Index at which the placeholder setting exists in the layout. The placeholder setting at that index will be returned. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -Instance  <PlaceholderDefinition> + +Specific instance of placeholder setting that should be returned. The instance could earlier be obtained through e.g. use of Get-PlaceholderSetting. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?true
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -Item  <Item> + +The item to be processed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?true
Position?Named
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
+ +### -Key  <string> + +Placeholder key filter - supports wildcards. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?true
+ +### -Language  <string[]> + +Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard supported. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesLanguages
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -Path  <string> + +Path to the item to be processed - can work with Language parameter to narrow the publication scope. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesFullName, FileName
Required?true
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -PlaceholderSetting  <Item> + +Item representing the placeholder setting. If matching, the placeholder setting will be returned. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -UniqueId  <string> + +UniqueID of the placeholder setting to be retrieved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?true
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Layouts.PlaceholderDefinition + +## Notes + +Help Author: Adam Najmanowicz, Michael West, Alex Washtell + +## Examples + +### EXAMPLE 1 + +Get all placeholder settings for "Default" device, using any key matching the wildcard "content*" + +```powershell +Get-Item master:\content\home | Get-PlaceholderSetting -Key "content*" -Device (Get-LayoutDevice "Default") +``` + +## Related Topics + + +* https://github.com/SitecorePowerShell/Console/
+* [Add-PlaceholderSetting](add-placeholdersetting.md) +* [New-PlaceholderSetting](new-placeholdersetting.md) +* [Remove-PlaceholderSetting](remove-placeholdersetting.md) + + diff --git a/appendix/presentation/get-rendering.md b/appendix/presentation/get-rendering.md new file mode 100644 index 00000000..80d614f1 --- /dev/null +++ b/appendix/presentation/get-rendering.md @@ -0,0 +1,248 @@ +# Get-Rendering + +Returns a RenderingDefinition for an item using the filtering parameters. + +## Syntax + +```powershell +Get-Rendering -Item [-DataSource ] [-Rendering ] [-Index ] [-PlaceHolder ] [-Parameter ] [-Device ] [-FinalLayout] [-Language ] + +Get-Rendering -Item -Instance [-Device ] [-FinalLayout] [-Language ] + +Get-Rendering -Item -UniqueId [-Device ] [-FinalLayout] [-Language ] + +Get-Rendering -Path [-DataSource ] [-Rendering ] [-Index ] [-PlaceHolder ] [-Parameter ] [-Device ] [-FinalLayout] [-Language ] + +Get-Rendering -Path -Instance [-Device ] [-FinalLayout] [-Language ] + +Get-Rendering -Path -UniqueId [-Device ] [-FinalLayout] [-Language ] + +Get-Rendering [-Id ] [-Database ] [-DataSource ] [-Rendering ] [-Index ] [-PlaceHolder ] [-Parameter ] [-Device ] [-FinalLayout] [-Language ] + +Get-Rendering [-Id ] [-Database ] -Instance [-Device ] [-FinalLayout] [-Language ] + +Get-Rendering [-Id ] [-Database ] -UniqueId [-Device ] [-FinalLayout] [-Language ] +``` + +## Detailed Description + +The Get-Rendering command returns a RenderingDefinition for an item using the filtering parameters. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Item <Item> + +The item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -DataSource <String> + +Data source filter - supports wildcards. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Rendering <Item> + +Item representing the sublayout/rendering. If matching the rendering will be returned. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Index <Int32> + +Index at which the rendering exists in the layout. The rendering at that index will be returned. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -PlaceHolder <String> + +Place holder at which the rendering exists in the layout. Renderings at that place holder will be returned. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Parameter <Hashtable> + +Additional rendering parameter values. If both name and value match - the rendering will be returned. Values support wildcards. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Instance <RenderingDefinition> + +Specific instance of rendering that should be returned. The instance could earlier be obtained through e.g. use of Get-Rendering. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -UniqueId <String> + +UniqueID of the rendering to be retrieved. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Device <DeviceItem> + +Device for which the renderings will be retrieved. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -FinalLayout <SwitchParameter> + +Targets the Final Layout. If not provided, the Shared Layout will be targeted. Applies to Sitecore 8.0 and higher only. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Layouts.RenderingDefinition + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Get all renderings for "Default" device, located in the any placeholder that has name in it or any of its sub-placeholders. + +```powershell +Get-Item master:\content\home | + Get-Rendering -Placeholder "*main*" -Device (Get-LayoutDevice "Default") +``` + +### EXAMPLE 2 + +The following example returns all renderings on the home page. + +```powershell +$item = Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" +$defaultLayout = Get-LayoutDevice "Default" +Get-Rendering -Item $item -Device $defaultLayout -FinalLayout +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Add-Rendering](add-rendering.md) +* [New-Rendering](new-rendering.md) +* [Set-Rendering](set-rendering.md) +* [Get-LayoutDevice](get-layoutdevice.md) +* [Remove-Rendering](remove-rendering.md) +* [Get-Layout](get-layout.md) +* [Set-Layout](set-layout.md) + diff --git a/appendix/presentation/get-renderingparameter.md b/appendix/presentation/get-renderingparameter.md new file mode 100644 index 00000000..b5bf2a7a --- /dev/null +++ b/appendix/presentation/get-renderingparameter.md @@ -0,0 +1,84 @@ +# Get-RenderingParameter + +Gets the available rendering parameters found for a given rendering. + +## Syntax + +```powershell +Get-RenderingParameter -Instance [-Name ] +``` + +## Detailed Description + +Gets the available rendering parameters found for a given rendering. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Instance <RenderingDefinition> + +Rendering definition containing the rendering parameters. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Name <String\[\]> + +The names (or keys) identifying specific rendering parameters. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Layouts.RenderingDefinition + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* IDictionary + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +The following gets all renderings for a given item and lists the available rendering parameters. + +```powershell +$item = Get-Item -Path "master" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" + +foreach($itemRendering in Get-Rendering -Item $item -FinalLayout) { + Write-Host "Rendering UniqueId: $($itemRendering.UniqueId)" + Get-RenderingParameter -Rendering $itemRendering | Format-Table -Auto +} +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [New-Rendering](new-rendering.md) +* [Set-Rendering](set-rendering.md) +* [Get-Rendering](get-rendering.md) +* [Get-LayoutDevice](get-layoutdevice.md) +* [Remove-Rendering](remove-rendering.md) +* [Get-Layout](get-layout.md) +* [Set-Layout](set-layout.md) + diff --git a/appendix/presentation/merge-layout.md b/appendix/presentation/merge-layout.md new file mode 100644 index 00000000..44047414 --- /dev/null +++ b/appendix/presentation/merge-layout.md @@ -0,0 +1,102 @@ +# Merge-Layout + +The Merge-Layout command takes all the layout information stored in the FinalLayout field and merges into the SharedLayout field. The FinalLayout field is reset after the merge completes. + +## Syntax + +```powershell +Merge-Layout [-Item] [-Language ] + +Merge-Layout [-Path] [-Language ] + +Merge-Layout -Id [-Database ] [-Language ] +``` + +## Detailed Description + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Language  <String\[\]> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item  <Item> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path  <String> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id  <String> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database  <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +The following retrieves all pages under home and merges the layout. + +```powershell +Get-ChildItem master:\content\Showcase\int\home -Recurse | Merge-Layout +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Add-Rendering](add-rendering.md) +* [New-Rendering](new-rendering.md) +* [Set-Rendering](set-rendering.md) +* [Get-Rendering](get-rendering.md) +* [Get-LayoutDevice](get-layoutdevice.md) +* [Remove-Rendering](remove-rendering.md) +* [Get-Layout](get-layout.md) +* [Reset-Layout](reset-layout.md) + diff --git a/appendix/commands/ConvertFrom-ItemClone.md b/appendix/presentation/new-placeholdersetting.md similarity index 63% rename from appendix/commands/ConvertFrom-ItemClone.md rename to appendix/presentation/new-placeholdersetting.md index 3bff4a59..80f29427 100644 --- a/appendix/commands/ConvertFrom-ItemClone.md +++ b/appendix/presentation/new-placeholdersetting.md @@ -1,256 +1,255 @@ -# ConvertFrom-ItemClone - -Converts an item from a clone to a fully independent item. - -## Syntax - -ConvertFrom-ItemClone [-Item] <Item> [-Recurse] [-PassThru] - -ConvertFrom-ItemClone [-Path] <String> [-Recurse] [-PassThru] - -ConvertFrom-ItemClone -Id <String> [-Database <String>] [-Recurse] [-PassThru] - - -## Detailed Description - -Converts an item from a clone to a fully independent item. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Recurse  <SwitchParameter> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -PassThru  <SwitchParameter> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be converted. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be converted - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be converted - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be converted - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Outputs - -The output type is the type of the objects that the cmdlet emits. - -* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - - - -```powershell - -PS master:\> ConvertFrom-ItemClone -Path master:\content\home - -``` - -## Related Topics - - * [New-ItemClone](/appendix/commands/New-ItemClone.md) * [Get-ItemClone](/appendix/commands/Get-ItemClone.md) * https://github.com/SitecorePowerShell/Console/
+# New-PlaceholderSetting + +Creates new placeholder setting definition that can later be added to an item. + +## Syntax + +```powershell +New-PlaceholderSetting [-Item] [-Key ] [-Language ] + +New-PlaceholderSetting [-Path] [-Key ] [-Language ] + +New-PlaceholderSetting -Id [-Key ] [-Language ] [-Database ] +``` + +## Detailed Description + +Creates new placeholder setting definition that can later be added to an item. Most parameters can later be overriden when calling Add-PlaceholderSetting. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Database  <string> + +Database containing the item to be processed - can work with Language parameter to narrow the publication scope. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -Id  <string> + +Id of the item to be processed - can work with Language parameter to narrow the publication scope. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?true
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -Item  <Item> + +The item to be processed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?true
Position?0
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
+ +### -Key  <string> + +The key for this placeholder setting. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -Language  <string[]> + +Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard supported. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesLanguages
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -Path  <string> + +Path to the item to be processed - can work with Language parameter to narrow the publication scope. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesFullName, FileName
Required?true
Position?0
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Layouts.PlaceholderDefinition + +## Examples + +### EXAMPLE 1 + +Create item defining placeholder setting + +```powershell +$placeholderSetting = gi "master:\layout\Placeholder Settings\content" | New-PlaceholderSetting -Key "content" +``` + +## Related Topics + + +* https://github.com/SitecorePowerShell/Console/
+* [Add-PlaceholderSetting](add-placeholdersetting.md) +* [Get-PlaceholderSetting](get-placeholdersetting.md) +* [Remove-PlaceholderSetting](remove-placeholdersetting.md) \ No newline at end of file diff --git a/appendix/presentation/new-rendering.md b/appendix/presentation/new-rendering.md new file mode 100644 index 00000000..e9aa2c74 --- /dev/null +++ b/appendix/presentation/new-rendering.md @@ -0,0 +1,243 @@ +# New-Rendering + +Creates new rendering definition that can later be added to an item. + +## Syntax + +```powershell +New-Rendering [-Item] [-Parameter ] [-PlaceHolder ] [-DataSource ] [-Cacheable] [-VaryByData] [-VaryByDevice] [-VaryByLogin] [-VaryByParameters] [-VaryByQueryString] [-VaryByUser] [-Language ] + +New-Rendering [-Path] [-Parameter ] [-PlaceHolder ] [-DataSource ] [-Cacheable] [-VaryByData] [-VaryByDevice] [-VaryByLogin] [-VaryByParameters] [-VaryByQueryString] [-VaryByUser] [-Language ] + +New-Rendering -Id [-Database ] [-Parameter ] [-PlaceHolder ] [-DataSource ] [-Cacheable] [-VaryByData] [-VaryByDevice] [-VaryByLogin] [-VaryByParameters] [-VaryByQueryString] [-VaryByUser] [-Language ] +``` + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Parameter <Hashtable> + +Rendering parameters as hashtable + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -PlaceHolder <String> + +Placeholder for the rendering to be placed into. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -DataSource <Item> + +Datasource for the rendering. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Cacheable <SwitchParameter> + +Defined whether the rendering is cacheable. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -VaryByData <SwitchParameter> + +Defines whether a data-specific cache version of the rendering should be kept. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -VaryByDevice <SwitchParameter> + +Defines whether a device-specific cache version of the rendering should be kept. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -VaryByLogin <SwitchParameter> + +Defines whether a login - specific cache version of the rendering should be kept. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -VaryByParameters <SwitchParameter> + +Defines whether paremeter - specific cache version of the rendering should be kept. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -VaryByQueryString <SwitchParameter> + +Defines whether query string - specific cache version of the rendering should be kept. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -VaryByUser <SwitchParameter> + +Defines whether a user - specific cache version of the rendering should be kept. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Layouts.RenderingDefinition + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Find item defining rendering and create rendering definition. + +```powershell +# Find the rendering item and convert to a rendering +$renderingPath = "/sitecore/layout/Renderings/Feature/Experience Accelerator/Page Content/Page Content" +$renderingItem = Get-Item -Database "master" -Path $renderingPath | New-Rendering -Placeholder "main" +# Find the item to receive the new rendering +$item = Get-Item -Path "master:\content\Training\Playground\play1\Home" +# Add the rendering to the item +Add-Rendering -Item $item -PlaceHolder "main" -Instance $renderingItem -Parameter @{ "Reset Caching Options" = "1" } -FinalLayout +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Add-Rendering](add-rendering.md) +* [Set-Rendering](set-rendering.md) +* [Get-Rendering](get-rendering.md) +* [Get-LayoutDevice](get-layoutdevice.md) +* [Remove-Rendering](remove-rendering.md) +* [Get-Layout](get-layout.md) +* [Set-Layout](set-layout.md) + diff --git a/appendix/presentation/remove-layout.md b/appendix/presentation/remove-layout.md new file mode 100644 index 00000000..7b322794 --- /dev/null +++ b/appendix/presentation/remove-layout.md @@ -0,0 +1,151 @@ +# Remove-Layout + +Removes item layout for a device. + +## Syntax + +```powershell +Remove-Layout [-Item] -Device [-Layout ] [-FinalLayout] [-Language ] + +Remove-Layout [-Path] -Device [-Layout ] [-FinalLayout] [-Language ] + +Remove-Layout -Id [-Database ] -Device [-Layout ] [-FinalLayout] [-Language ] +``` + +## Detailed Description + +Removes item layout for the specified device. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Device <DeviceItem> + +Device for which to set layout. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Layout <Item> + +Sitecore item defining the layout. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -FinalLayout <SwitchParameter> + +Targets the Final Layout. If not provided, the Shared Layout will be targeted. Applies to Sitecore 8.0 and higher only. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +$itemId = "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" +$item = Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" +$layoutDevice = Get-LayoutDevice -Name "Print" + +Remove-Layout -Item $item -Device $layoutDevice -FinalLayout +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Add-Rendering](add-rendering.md) +* [New-Rendering](new-rendering.md) +* [Set-Rendering](set-rendering.md) +* [Get-Rendering](get-rendering.md) +* [Get-LayoutDevice](get-layoutdevice.md) +* [Remove-Rendering](remove-rendering.md) +* [Get-Layout](get-layout.md) +* [Reset-Layout](reset-layout.md) +* [#579](https://github.com/SitecorePowerShell/Console/issues/579) +* [#1111](https://github.com/SitecorePowerShell/Console/issues/1111) diff --git a/appendix/commands/Set-Rendering.md b/appendix/presentation/remove-placeholdersetting.md similarity index 59% rename from appendix/commands/Set-Rendering.md rename to appendix/presentation/remove-placeholdersetting.md index 5f5943f6..9fcefdcd 100644 --- a/appendix/commands/Set-Rendering.md +++ b/appendix/presentation/remove-placeholdersetting.md @@ -1,421 +1,478 @@ -# Set-Rendering - -Updates rendering with new values. - -## Syntax - -Set-Rendering [-Item] <Item> -Instance <RenderingDefinition> [-Parameter <Hashtable>] [-PlaceHolder <String>] [-DataSource <String>] [-Index <Int32>] [-FinalLayout] [-Language <String[]>] - -Set-Rendering [-Path] <String> -Instance <RenderingDefinition> [-Parameter <Hashtable>] [-PlaceHolder <String>] [-DataSource <String>] [-Index <Int32>] [-FinalLayout] [-Language <String[]>] - -Set-Rendering -Id <String> [-Database <String>] -Instance <RenderingDefinition> [-Parameter <Hashtable>] [-PlaceHolder <String>] [-DataSource <String>] [-Index <Int32>] [-FinalLayout] [-Language <String[]>] - - -## Detailed Description - -Updates rendering instance with new values. The instance should be earlier obtained using Get-Rendering. - -© 2010-2017 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions - -## Parameters - -### -Instance  <RenderingDefinition> - -Instance of the Rendering to be updated. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Parameter  <Hashtable> - -Rendering Parameters to be overriden on the Rendering that is being updated - if not specified the value provided in rendering definition specified in the Instance parameter will be used. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -PlaceHolder  <String> - -Placeholder path the Rendering should be added to - if not specified the value provided in rendering definition specified in the Instance parameter will be used. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -DataSource  <String> - -Data source of the Rendering - if not specified the value provided in rendering definition specified in the Instance parameter will be used. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Index  <Int32> - -If provided the rendering will be moved to the specified index. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -FinalLayout  <SwitchParameter> - -Targets the Final Layout. If not provided, the Shared Layout will be targeted. Applies to Sitecore 8.0 and higher only. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Language  <String[]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Item  <Item> - -The item to be processed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
- -### -Path  <String> - -Path to the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Id  <String> - -Id of the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?true
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -### -Database  <String> - -Database containing the item to be processed - can work with Language parameter to narrow the publication scope. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
- -## Inputs - -The input type is the type of the objects that you can pipe to the cmdlet. - -* Sitecore.Data.Items.Item - -## Notes - -Help Author: Adam Najmanowicz, Michael West - -## Examples - -### EXAMPLE - -change all rendering's placeholder from main to footer - -```powershell - -PS master:\> $item = Get-Item -Path master:\content\home -PS master:\> Get-Rendering -Item $item -PlaceHolder "main" | Foreach-Object { $_.Placeholder = "footer"; Set-Rendering -Item $item -Instance $_ } - -``` - -## Related Topics - - * https://github.com/SitecorePowerShell/Console/
* [Add-Rendering](/appendix/commands/Add-Rendering.md) * [New-Rendering](/appendix/commands/New-Rendering.md) * [Get-Rendering](/appendix/commands/Get-Rendering.md) * [Get-LayoutDevice](/appendix/commands/Get-LayoutDevice.md) * [Remove-Rendering](/appendix/commands/Remove-Rendering.md) * [Get-Layout](/appendix/commands/Get-Layout.md) * [Set-Layout](/appendix/commands/Set-Layout.md) +# Remove-PlaceholderSetting + +Removes placeholder setting(s) from an item using the filtering parameters. + +## Syntax + +```powershell +Remove-PlaceholderSetting -Item [-Key ] [-PlaceholderSetting ] [-Index ] [-Device ] [-FinalLayout] [-Language ] + +Remove-PlaceholderSetting -Item -Instance [-Device ] [-FinalLayout] [-Language ] + +Remove-PlaceholderSetting -Item -UniqueId [-Device ] [-FinalLayout] [-Language ] + +Remove-PlaceholderSetting -Path [-Key ] [-PlaceholderSetting ] [-Index ] [-Device ] [-FinalLayout] [-Language ] + +Remove-PlaceholderSetting -Path -Instance [-Device ] [-FinalLayout] [-Language ] + +Remove-PlaceholderSetting -Path -UniqueId [-Device ] [-FinalLayout] [-Language ] + +Remove-PlaceholderSetting [-Id ] [-Database ] [-Key ] [-PlaceholderSetting ] [-Index ] [-Device ] [-FinalLayout] [-Language ] + +Remove-PlaceholderSetting -Instance [-Id ] [-Database ] [-Device ] [-FinalLayout] [-Language ] + +Remove-PlaceholderSetting -UniqueId [-Id ] [-Database ] [-Device ] [-FinalLayout] [-Language ] +``` + +## Detailed Description + +Removes placeholder setting(s) from an item using the filtering parameters. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Database  <string> + +Database containing the item to be processed - can work with Language parameter to narrow the publication scope. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -Device  <DeviceItem> + +Device for which the placeholder settings will be removed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -FinalLayout  <switch> + +Targets the Final Layout. If not provided, the Shared Layout will be targeted. Applies to Sitecore 8.0 and higher only. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -Id  <string> + +Id of the item to be processed - can work with Language parameter to narrow the publication scope. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -Index  <int> + + Index at which the placeholder setting exists in the layout. The placeholder setting at that index will be removed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -Instance  <PlaceholderDefinition> + +Specific instance of placeholder setting that should be removed. The instance could earlier be obtained through e.g. use of Get-PlaceholderSetting. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?true
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -Item  <Item> + +The item to be processed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?true
Position?Named
Default Value
Accept Pipeline Input?true (ByValue, ByPropertyName)
Accept Wildcard Characters?false
+ +### -Key  <string> + +Placeholder key filter - supports wildcards. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?true
+ +### -Language  <string[]> + +Language that will be used as source language. If not specified the current user language will be used. Globbing/wildcard supported. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesLanguages
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -Path  <string> + +Path to the item to be processed - can work with Language parameter to narrow the publication scope. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesFullName, FileName
Required?true
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -PlaceholderSetting  <Item> + +Item representing the placeholder setting. If matching, the placeholder setting will be removed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?false
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +### -UniqueId  <string> + +UniqueID of the placeholder setting to be removed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AliasesNone
Required?true
Position?Named
Default Value
Accept Pipeline Input?false
Accept Wildcard Characters?false
+ +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Remove all placeholder settings for "Default" device + +```powershell +Remove-PlaceholderSetting -Path master:\content\home -Device (Get-LayoutDevice "Default") +``` + +### EXAMPLE 2 + +Remove all placeholder settings with the "content" key. + +```powershell +Remove-PlaceholderSetting -Path master:\content\home -Key "content" +``` + +## Related Topics + + +* https://github.com/SitecorePowerShell/Console/
+* [Add-PlaceholderSetting](add-placeholdersetting.md) +* [Get-PlaceholderSetting](get-placeholdersetting.md) +* [New-PlaceholderSetting](new-placeholdersetting.md) \ No newline at end of file diff --git a/appendix/presentation/remove-rendering.md b/appendix/presentation/remove-rendering.md new file mode 100644 index 00000000..f99ae428 --- /dev/null +++ b/appendix/presentation/remove-rendering.md @@ -0,0 +1,253 @@ +# Remove-Rendering + +Removes renderings from an item. + +## Syntax + +```powershell +Remove-Rendering -Item [-DataSource ] [-Rendering ] [-Index ] [-PlaceHolder ] [-Parameter ] [-Device ] [-FinalLayout] [-Language ] + +Remove-Rendering -Item -Instance [-Device ] [-FinalLayout] [-Language ] + +Remove-Rendering -Item -UniqueId [-Device ] [-FinalLayout] [-Language ] + +Remove-Rendering -Path [-DataSource ] [-Rendering ] [-Index ] [-PlaceHolder ] [-Parameter ] [-Device ] [-FinalLayout] [-Language ] + +Remove-Rendering -Path -Instance [-Device ] [-FinalLayout] [-Language ] + +Remove-Rendering -Path -UniqueId [-Device ] [-FinalLayout] [-Language ] + +Remove-Rendering [-Id ] [-Database ] [-DataSource ] [-Rendering ] [-Index ] [-PlaceHolder ] [-Parameter ] [-Device ] [-FinalLayout] [-Language ] + +Remove-Rendering [-Id ] [-Database ] -Instance [-Device ] [-FinalLayout] [-Language ] + +Remove-Rendering [-Id ] [-Database ] -UniqueId [-Device ] [-FinalLayout] [-Language ] +``` + +## Detailed Description + +Removes renderings from an item based on a number of qualifying criteria. The search criteria are cumulative and narrowing the search in an "AND" manner. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Item <Item> + +The item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -DataSource <String> + +Data source filter - supports wildcards. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Rendering <Item> + +Item representing the sublayout/rendering. If matching the rendering will be removed. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Index <Int32> + +Index at which the rendering exists in the layout. The rendering at that index will be removed. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -PlaceHolder <String> + +Place holder at which the rendering exists in the layout. Rendering at that placeholder will be removed. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Parameter <Hashtable> + +Additional rendering parameter values. If both name and value match - the rendering will be removed. Values support wildcards. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Instance <RenderingDefinition> + +Specific instance of rendering that should be removed. The instance coule earlier be obtained through e.g. use of Get-Rendering. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -UniqueId <String> + +UniqueID of the rendering to be removed. The instance coule earlier be obtained through e.g. use of OD of rendering retrieved with Get-Rendering. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Device <DeviceItem> + +Device for which the rendering should be removed. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -FinalLayout <SwitchParameter> + +Targets the Final Layout. If not provided, the Shared Layout will be targeted. Applies to Sitecore 8.0 and higher only. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* System.Void + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +remove all renderings for "Default" device + +```powershell +Remove-Rendering -Path master:\content\home -Device (Get-LayoutDevice "Default") +``` + +### EXAMPLE 2 + +remove all renderings from the "main" placeholder and all of its embedded placeholders. + +```powershell +Remove-Rendering -Path master:\content\home -PlaceHolder "main*" +``` + +### EXAMPLE 3 + +remove all renderings from the "main" placeholder and all of its embedded placeholders, but only in the "Default" device + +```powershell +Remove-Rendering -Path master:\content\home -PlaceHolder "main*" -Device (Get-LayoutDevice "Default") +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Add-Rendering](add-rendering.md) +* [New-Rendering](new-rendering.md) +* [Set-Rendering](set-rendering.md) +* [Get-Rendering](get-rendering.md) +* [Get-LayoutDevice](get-layoutdevice.md) +* [Get-Layout](get-layout.md) +* [Set-Layout](set-layout.md) + diff --git a/appendix/presentation/remove-renderingparameter.md b/appendix/presentation/remove-renderingparameter.md new file mode 100644 index 00000000..e49c6800 --- /dev/null +++ b/appendix/presentation/remove-renderingparameter.md @@ -0,0 +1,83 @@ +# Remove-RenderingParameter + +Removes the specified rendering parameter from the rendering. + +## Syntax + +```powershell +Remove-RenderingParameter -Instance [-Name ] +``` + +## Detailed Description + +Removes the specified rendering parameter from the rendering. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Instance <RenderingDefinition> + +Rendering definition containing the rendering parameters. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Name <String\[\]> + +The names (or keys) identifying specific rendering parameters. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Layouts.RenderingDefinition + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Layouts.RenderingDefinition + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +The following removes the specified rendering parameter and updates the item. + +```powershell +$item = Get-Item -Path "master" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" + +Get-Rendering -Item $item -FinalLayout | + Remove-RenderingParameter -Name"SampleKey2" | + Set-Rendering -Item $item -FinalLayout +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [New-Rendering](new-rendering.md) +* [Set-Rendering](set-rendering.md) +* [Get-Rendering](get-rendering.md) +* [Get-LayoutDevice](get-layoutdevice.md) +* [Remove-Rendering](remove-rendering.md) +* [Get-Layout](get-layout.md) +* [Set-Layout](set-layout.md) + diff --git a/appendix/presentation/reset-layout.md b/appendix/presentation/reset-layout.md new file mode 100644 index 00000000..f8f7a330 --- /dev/null +++ b/appendix/presentation/reset-layout.md @@ -0,0 +1,130 @@ +# Reset-Layout + +Resets the SharedLayout or FinalLayout field for the specified item. + +## Syntax + +```powershell +Reset-Layout [-Item] [-FinalLayout] [-Language ] + +Reset-Layout [-Path] [-FinalLayout] [-Language ] + +Reset-Layout -Id [-Database ] [-FinalLayout] [-Language ] +``` + +## Detailed Description + +The Reset-Layout command resets the layout for the specified item. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -FinalLayout <SwitchParameter> + +Targets the Final Layout. If not provided, the Shared Layout will be targeted. Applies to Sitecore 8.0 and higher only. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* None. + +## Notes + +Help Author: Adam Najmanowicz, Michael West, Alex Washtell + +## Examples + +### EXAMPLE 1 + +The following resets the layout information on the SharedLayout. + +```powershell +Reset-Layout -Path master:\content\home +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Add-Rendering](add-rendering.md) +* [New-Rendering](new-rendering.md) +* [Set-Rendering](set-rendering.md) +* [Get-Rendering](get-rendering.md) +* [Get-LayoutDevice](get-layoutdevice.md) +* [Remove-Rendering](remove-rendering.md) +* [Set-Layout](set-layout.md) +* [Get-Layout](get-layout.md) + diff --git a/appendix/presentation/set-layout.md b/appendix/presentation/set-layout.md new file mode 100644 index 00000000..01c7b0fb --- /dev/null +++ b/appendix/presentation/set-layout.md @@ -0,0 +1,166 @@ +# Set-Layout + +Sets item layout for a device. + +## Syntax + +```powershell +Set-Layout [-Item] -Device [-Layout ] [-FinalLayout] [-Language ] + +Set-Layout [-Path] -Device [-Layout ] [-FinalLayout] [-Language ] + +Set-Layout -Id [-Database ] -Device [-Layout ] [-FinalLayout] [-Language ] +``` + +## Detailed Description + +Sets item layout for a specific device provided + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Device <DeviceItem> + +Device for which to set layout. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Layout <Item> + +Sitecore item defining the layout. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -FinalLayout <SwitchParameter> + +Targets the Final Layout. If not provided, the Shared Layout will be targeted. Applies to Sitecore 8.0 and higher only. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +# where my test page will go +$path = 'master:\content\Sample' + +# wipe and re-create it if exists +if(Test-Path $path){ + Remove-Item $path +} +$item = New-Item -Path $path -ItemType "Sample/Sample Item" + +# select default layout +$device = Get-LayoutDevice -Default + +# and a layout we will change to +$layout = Get-Item -Path 'master:\layout\Layouts\System\Simulated Device Layout' + +# change the layout from what is in Standard values to the new one. +Set-Layout -Item $item -Device $device -Layout $layout | Out-Null + +# verify +Get-Layout $item +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Add-Rendering](add-rendering.md) +* [New-Rendering](new-rendering.md) +* [Set-Rendering](set-rendering.md) +* [Get-Rendering](get-rendering.md) +* [Get-LayoutDevice](get-layoutdevice.md) +* [Remove-Rendering](remove-rendering.md) +* [Get-Layout](get-layout.md) +* [Reset-Layout](reset-layout.md) +* [#579](https://github.com/SitecorePowerShell/Console/issues/579) + diff --git a/appendix/presentation/set-rendering.md b/appendix/presentation/set-rendering.md new file mode 100644 index 00000000..8785e97a --- /dev/null +++ b/appendix/presentation/set-rendering.md @@ -0,0 +1,213 @@ +# Set-Rendering + +Updates rendering with new values. + +## Syntax + +```powershell +Set-Rendering [-Item] -Instance [-Parameter ] [-PlaceHolder ] [-DataSource ] [-Index ] [-FinalLayout] [-Device ] [-Language ] + +Set-Rendering [-Path] -Instance [-Parameter ] [-PlaceHolder ] [-DataSource ] [-Index ] [-FinalLayout] [-Device ] [-Language ] + +Set-Rendering -Id [-Database ] -Instance [-Parameter ] [-PlaceHolder ] [-DataSource ] [-Index ] [-FinalLayout] [-Device ] [-Language ] +``` + +## Detailed Description + +Updates rendering instance with new values. The instance should be earlier obtained using Get-Rendering. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Instance <RenderingDefinition> + +Instance of the Rendering to be updated. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Parameter <Hashtable> + +Rendering Parameters to be overriden on the Rendering that is being updated - if not specified the value provided in rendering definition specified in the Instance parameter will be used. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -PlaceHolder <String> + +Placeholder path the Rendering should be added to - if not specified the value provided in rendering definition specified in the Instance parameter will be used. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -DataSource <String> + +Data source of the Rendering - if not specified the value provided in rendering definition specified in the Instance parameter will be used. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Index <Int32> + +If provided the rendering will be moved to the specified index. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -FinalLayout <SwitchParameter> + +Targets the Final Layout. If not provided, the Shared Layout will be targeted. Applies to Sitecore 8.0 and higher only. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Device <DeviceItem> + +Specifies the target device when applying the rendering changes. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Change all rendering's placeholder from main to footer. + +```powershell +$item = Get-Item -Path master:\content\home +Get-Rendering -Item $item -PlaceHolder "main" | + Foreach-Object { + $_.Placeholder = "footer"; + Set-Rendering -Item $item -Instance $_ + } +``` + +### EXAMPLE 2 + +Clear the datasource value for a rendering. + +```powershell +$item = Get-Item -Path master:\content\home +Get-Rendering -Item $item -PlaceHolder "main" | + Foreach-Object { + $_.DataSource = $null + Set-Rendering -Item $item -Instance $_ + } +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Add-Rendering](add-rendering.md) +* [New-Rendering](new-rendering.md) +* [Get-Rendering](get-rendering.md) +* [Get-LayoutDevice](get-layoutdevice.md) +* [Remove-Rendering](remove-rendering.md) +* [Get-Layout](get-layout.md) +* [Set-Layout](set-layout.md) + diff --git a/appendix/presentation/set-renderingparameter.md b/appendix/presentation/set-renderingparameter.md new file mode 100644 index 00000000..7137b0d3 --- /dev/null +++ b/appendix/presentation/set-renderingparameter.md @@ -0,0 +1,97 @@ +# Set-RenderingParameter + +Adds and updates the specified rendering parameter from the rendering. + +## Syntax + +```powershell +Set-RenderingParameter -Instance -Parameter [-Overwrite] +``` + +## Detailed Description + +Adds and updates the specified rendering parameter from the rendering. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Instance <RenderingDefinition> + +Rendering definition containing the rendering parameters. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Parameter <IDictionary> + +The hashtable or dictionary of key/value pairs used to add/update rendering parameters. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Overwrite <SwitchParameter> + +Specifying this parameter will remove all existing rendering parameters and use the new collection provided. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Layouts.RenderingDefinition + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Layouts.RenderingDefinition + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +The following updates the specified rendering parameter and updates the item. + +```powershell +$item = Get-Item -Path "master" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" + +# Accepts Hashtable, Ordered Dictionaries, etc. +$parameters = [ordered]@{"SampleKey2"="SampleValue2"} +Get-Rendering -Item $item -FinalLayout | + Set-RenderingParameter -Parameter $parameters | + Set-Rendering -Item $item -FinalLayout +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [New-Rendering](new-rendering.md) +* [Set-Rendering](set-rendering.md) +* [Get-Rendering](get-rendering.md) +* [Get-LayoutDevice](get-layoutdevice.md) +* [Remove-Rendering](remove-rendering.md) +* [Get-Layout](get-layout.md) +* [Set-Layout](set-layout.md) + diff --git a/appendix/presentation/switch-rendering.md b/appendix/presentation/switch-rendering.md new file mode 100644 index 00000000..fa3025d2 --- /dev/null +++ b/appendix/presentation/switch-rendering.md @@ -0,0 +1,248 @@ +# Switch-Rendering + +Switches an existing rendering with an alternate one to a chosen device for the presentation of an item. + +## Syntax + +```powershell +Switch-Rendering -NewRendering -Item [-DataSource ] [-Rendering ] [-Index ] [-PlaceHolder ] [-Parameter ] [-Device ] [-FinalLayout] [-Language ] [-WhatIf] [-Confirm] [] + +Switch-Rendering -NewRendering -Item -Instance [-Device ] [-FinalLayout] [-Language ] [-WhatIf] [-Confirm][] + +Switch-Rendering -NewRendering -Item -UniqueId [-Device ] [-FinalLayout] [-Language ] [-WhatIf] [-Confirm] [] + +Switch-Rendering -NewRendering -Path [-DataSource ] [-Rendering ] [-Index ] [-PlaceHolder ] [-Parameter ] [-Device ] [-FinalLayout] [-Language ] [-WhatIf] [-Confirm] [] + +Switch-Rendering -NewRendering -Path -Instance [-Device ] [-FinalLayout] [-Language ] [-WhatIf] [-Confirm] [] + +Switch-Rendering -NewRendering -Path -UniqueId [-Device ] [-FinalLayout] [-Language ] [-WhatIf] [-Confirm] [] + +Switch-Rendering -NewRendering [-Id ] [-Database ] [-DataSource ] [-Rendering ] [-Index ] [-PlaceHolder ] [-Parameter ] [-Device ] [-FinalLayout] [-Language ] [-WhatIf] [-Confirm] [] + +Switch-Rendering -NewRendering -Instance [-Id ] [-Database ] [-Device ] [-FinalLayout] [-Language ] [-WhatIf] [-Confirm] [] + +Switch-Rendering -NewRendering -UniqueId [-Id ] [-Database ] [-Device ] [-FinalLayout] [-Language ] [-WhatIf] [-Confirm] [] +``` + +## Detailed Description + +Switches an existing rendering with an alternate one to a chosen device for the presentation of an item. + +© 2010-2022 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Instance <RenderingDefinition> + +Existing rendering definition to be swapped on the item + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -NewRendering <RenderingDefinition> + +New rendering definition to be swapped on the item + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Parameter <Hashtable> + +Rendering Parameters to be overriden on the Rendering that is being updated - if not specified the value provided in rendering definition specified in the Instance parameter will be used. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -PlaceHolder <String> + +Placeholder path the Rendering should be added to - if not specified the value provided in rendering definition specified in the Instance parameter will be used. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -DataSource <String> + +Data source of the Rendering - if not specified the value provided in rendering definition specified in the Instance parameter will be used. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Index <Int32> + +Index at which the Rendering should be inserted. If not provided the rendering will be appended at the end of the list. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Device <DeviceItem> + +Device the rendering is assigned to. If not specified - default device will be used. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -FinalLayout <SwitchParameter> + +Targets the Final Layout. If not provided, the Shared Layout will be targeted. Applies to Sitecore 8.0 and higher only. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <String\[\]> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be processed - can work with Language parameter to narrow the publication scope. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -PassThru <SwitchParameter> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* System.Void + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Switch an old rendering for the new. + +```powershell +$itemId = "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" +$item = Get-Item -Path "master:" -ID $itemId +$defaultLayout = Get-LayoutDevice "Default" + +$sourceRenderingId = "{37F58448-7460-4AD2-B0FB-67C85C2A49CB}" +$targetRenderingId = "{90A9C167-5714-481F-82E4-29E394D12614}" + +$sourceRenderings = Get-Rendering -Item $item -Device $defaultLayout -FinalLayout | + Where-Object { $_.ItemID -eq $sourceRenderingId } +$targetRendering = Get-Item -Path "master:" -ID $targetRenderingId | New-Rendering + +# Replace all instances of the old rendering with the new rendering +foreach($sourceRendering in $sourceRenderings) { + $item | Switch-Rendering -Instance $sourceRendering -Device $defaultLayout -FinalLayout -NewRendering $targetRendering +} +``` + +## Related Topics + +* [#1110](https://github.com/SitecorePowerShell/Console/issues/1110) Switch-Rendering added in 6.0 +* [New-Rendering](new-rendering.md) +* [Set-Rendering](set-rendering.md) +* [Get-Rendering](get-rendering.md) +* [Get-LayoutDevice](get-layoutdevice.md) +* [Remove-Rendering](remove-rendering.md) +* [Get-Layout](get-layout.md) +* [Set-Layout](set-layout.md) diff --git a/appendix/provider/README.md b/appendix/provider/README.md new file mode 100644 index 00000000..a3253160 --- /dev/null +++ b/appendix/provider/README.md @@ -0,0 +1 @@ +# Provider \ No newline at end of file diff --git a/appendix/provider/get-item.md b/appendix/provider/get-item.md new file mode 100644 index 00000000..65a087e0 --- /dev/null +++ b/appendix/provider/get-item.md @@ -0,0 +1,186 @@ +# Get-Item + +Gets Sitecore items from the specified drive. + +## Syntax + +``` +Get-Item [-Path] [-ID ] [-Language ] [-Version ] [] + +Get-Item [-Path] [-Query ] [-Language ] [-Version ] [-AmbiguousPaths] [] + +Get-Item [-Path] [-Uri ] [-Language ] [-Version ] [] + +Get-Item [-Path] [-Database ] [-Language ] [-Version ] [] +``` + +## Detailed Description + +The Get-Item command unlocks the item. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Path <String> + +The path to the item. If the Database parameter is not provided, the path should include the database. For example, `"master:\content\home"`. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ID <ID> + +The unique identifier for the item. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Query <String> + +The Sitecore query or fast query to retrieve the item. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be processed - can work with Language parameter to specify the language other than current session language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be fetched with Id parameter. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Language <Language[]> + +Language(s) to use for filtering items. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Version <String> + +Version number to use for filtering items. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. Should be the path to an item. + +* System.String + +## 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 + +The following gets the item using the path. + +```powershell +Get-Item -Path "master:\content\home" +``` + +### EXAMPLE 2 + +The following gets all items in the master database, located under Content, which are based on the template **Sample Item** using a Sitecore query. + +```powershell +Get-Item -Path "master:" -Query "/sitecore/content//*[@@templatename='Sample Item']" +``` + +### EXAMPLE 3 + +The following gets the item in the master database with the specified `ID`. + +```powershell +Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" +``` + +### EXAMPLE 4 + +The following gets the item in the master database using the Uri. + +```powershell +Get-Item -Path "master:" -Uri "sitecore://master/{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}?lang=en&ver=1" +``` + +## Related Topics + +* Get-ChildItem + diff --git a/appendix/security.md b/appendix/security/README.md similarity index 85% rename from appendix/security.md rename to appendix/security/README.md index 3ebfc6fb..fb929542 100644 --- a/appendix/security.md +++ b/appendix/security/README.md @@ -1,2 +1,4 @@ # Security + + diff --git a/appendix/security/add-itemacl.md b/appendix/security/add-itemacl.md new file mode 100644 index 00000000..3f77682d --- /dev/null +++ b/appendix/security/add-itemacl.md @@ -0,0 +1,254 @@ +# 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 + +```powershell +Add-ItemAcl -PropagationType -SecurityPermission -AccessRight -Identity -Path [-PassThru] +Add-ItemAcl -PropagationType -SecurityPermission -AccessRight -Identity -Id [-Database ] [-PassThru] +Add-ItemAcl -PropagationType -SecurityPermission -AccessRight -Identity -Item [-PassThru] +Add-ItemAcl -AccessRules -Path [-PassThru] +Add-ItemAcl -AccessRules -Id [-PassThru] +Add-ItemAcl -AccessRules -Item [-PassThru] +``` + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -PropagationType <PropagationType> + +The PropagationType enumeration determines which items will be granted the access right. + +* Any - the item and all items inheriting +* Descendants - applies rights to inheriting children only +* Entity - applies right to the item only + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -SecurityPermission <SecurityPermission> + +The SecurityPermission determines whether to grant \(allow\) or deny the access right, and deny or allow inheritance of the right. + +* AllowAccess - +* DenyAccess - +* AllowInheritance - +* DenyInheritance - + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -AccessRules <AccessRuleCollection> + +A single or multiple access rules created e.g. through the New-ItemAcl or obtained from other item using the Get-ItemAcl cmdlet. This information will be appended to the existing security descriptors on the item. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -PassThru <SwitchParameter> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -AccessRight <String> + +The access right to grand or deny. Well known rights are: + +* field:read - "Field Read" - controls whether an account can read a specific field on an item.. +* field:write - "Field Write" - controls whether an account can update a specific field on an item. +* item:read - "Read" - controls whether an account can see an item in the content tree and/or on the published Web site, including all of its properties and field values. +* item:write - "Write" - controls whether an account can update field values. The write access right requires the read access right and field read and field write access rights for individual fields \(field read and field write are allowed by default\). +* item:rename - "Rename" - controls whether an account can change the name of an item. The rename access right requires the read access right. +* item:create - "Create" - controls whether an account can create child items. The create access right requires the read access right. +* item:delete - "Delete" - Delete right for items. controls whether an account can delete an item. The delete access right requires the read access right + + Important! + + The Delete command also deletes all child items, even if the account has been denied Delete + + rights for one or more of the subitems. + +* item:admin - "Administer" - controls whether an account can configure access rights on an item. The administer access right requires the read and write access rights. +* language:read - "Language Read" - controls whether a user can read a specific language version of items. +* language:write - "Language Write" - controls whether a user can update a specific language version of items. +* site:enter - controls whether a user can access a specific site. +* insert:show - "Show in Insert" - Determines if the user can see the insert option +* workflowState:delete - "Workflow State Delete" - controls whether a user can delete items which are currently associated with a specific workflow state. +* workflowState:write - "Workflow State Write" - controls whether a user can update items which are currently associated with a specific workflow state. +* workflowCommand:execute - "Workflow Command Execute" - — controls whether a user is shown specific workflow commands. +* profile:customize - "Customize Profile Key Values" - The right to input out of range values of profile keys, that belong to this profile. +* bucket:makebucket - "Create Bucket" - convert item to bucket. +* bucket:unmake - "Revert Bucket" - convert item back from bucket. +* remote:fieldread - "Field Remote Read" - Field Read right for remoted clients. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Identity <AccountIdentity> + +User name including domain for which the access rule is being created. If no domain is specified - 'sitecore' will be used as the default domain. + +Specifies the Sitecore user by providing one of the following values. + +```powershell +Local Name + Example: adam +Fully Qualified Name + Example: sitecore\adam +``` + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be processed. Requires Database parameter to be specified + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be fetched using the Id Parameter. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* can be piped from another cmdlet\* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Only if -PassThru is used\* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +allows the "sitecore\adam" user to rename the Home item and all of its childre + +```powershell +PS master:\> Add-ItemAcl -Path master:\content\Home -AccessRight "item:rename" -PropagationType Any -SecurityPermission AllowAccess -Identity "sitecore\admin" +``` + +### 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. + +```powershell +$acl1 = New-ItemAcl -AccessRight item:delete -PropagationType Any -SecurityPermission AllowAccess -Identity "sitecore\admin" +$acl2 = New-ItemAcl -AccessRight item:read -PropagationType Descendants -SecurityPermission DenyAccess -Identity "sitecore\mikey" +Get-Item -Path master:\content\home | Add-ItemAcl -AccessRules $acl1, $acl2 -PassThru + +Name Children Languages Id TemplateName +---- -------- --------- -- ------------ +Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item +``` + +### EXAMPLE 3 + +The following demonstrates how to add several AccessRule to an item when the PropogationType and SecurityPermission are the same. + +```powershell +$item = Get-Item -Path master:\content\youritem +$role = "sitecore\role" +$rights = @("item:create", "item:write", "item:rename", "item:delete") + +$item | Clear-ItemAcl +$rights | ForEach-Object { Add-ItemAcl -Item $item -AccessRight $_ -PropagationType Any -SecurityPermission AllowAccess -Identity $role } +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Add-ItemAcl](add-itemacl.md) +* [Clear-ItemAcl](clear-itemacl.md) +* [Get-ItemAcl](get-itemacl.md) +* [New-ItemAcl](new-itemacl.md) +* [Set-ItemAcl](set-itemacl.md) +* [Test-ItemAcl](test-itemacl.md) +* [https://sdn.sitecore.net/upload/sitecore6/security\_administrators\_cookbook\_a4.pdf](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/61/security_reference-a4.pdf) +* [https://sdn.sitecore.net/upload/sitecore6/64/content\_api\_cookbook\_sc64\_and\_later-a4.pdf](https://sdn.sitecore.net/upload/sitecore6/64/content_api_cookbook_sc64_and_later-a4.pdf) +* [https://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2013/01/sitecore-security-access-rights.aspx](https://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/](https://briancaos.wordpress.com/2009/10/02/assigning-security-to-items-in-sitecore-6-programatically/) + diff --git a/appendix/security/add-rolemember.md b/appendix/security/add-rolemember.md new file mode 100644 index 00000000..1e6a86da --- /dev/null +++ b/appendix/security/add-rolemember.md @@ -0,0 +1,88 @@ +# Add-RoleMember + +Adds one or more Sitecore users to the specified role. + +## Syntax + +Add-RoleMember \[-Identity\] <AccountIdentity> -Members <AccountIdentity\[\]> + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Identity <AccountIdentity> + +Specifies the Sitecore role by providing one of the following values. + +```powershell +Local Name + Example: developer +Fully Qualified Name + Example: sitecore\developer +``` + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Members <AccountIdentity\[\]> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.String + + Represents the identity of a role. + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* None. + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 2 + +```powershell +PS master:\> Add-RoleMember -Identity developer -Members "michael","adam","mike" +``` + +### EXAMPLE 2 + +The following adds all users of a given domain to the Developer role. + +```powershell +$users = Get-User -Filter * | Where-Object { @("ad1","ad2") -contains $_.Domain } +Add-RoleMember -Identity "sitecore\Developer" -Members $users +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Get-RoleMember](get-rolemember.md) +* [Remove-RoleMember](remove-rolemember.md) + diff --git a/appendix/security/clear-itemacl.md b/appendix/security/clear-itemacl.md new file mode 100644 index 00000000..2b5d3001 --- /dev/null +++ b/appendix/security/clear-itemacl.md @@ -0,0 +1,131 @@ +# Clear-ItemAcl + +Removes all security information from the item specified. + +## Syntax + +Clear-ItemAcl \[-Item\] <Item> \[-PassThru\] + +Clear-ItemAcl \[-Path\] <String> \[-PassThru\] + +Clear-ItemAcl -Id <String> \[-Database <String>\] \[-PassThru\] + +## Detailed Description + +Removes all security information from the item specified. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -PassThru <SwitchParameter> + +Passes the processed item back into the pipeline. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be processed. Requires the Database parameter to be specified. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be fetched with Id parameter. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* can be piped from another cmdlet\* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Only if -PassThru is used\* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Clears the security information from the Home item providing its path + +```powershell +PS master:\> Clear-ItemAcl -Path master:\content\home +``` + +### EXAMPLE 2 + +Clears the security information from the Home item by providing it from the pipeline and passing it back to the pipeline. + +```powershell +PS master:\> Get-Item -Path master:\content\home | Clear-ItemAcl -PassThru + +Name Children Languages Id TemplateName +---- -------- --------- -- ------------ +Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item +``` + +## Related Topics + +* [Add-ItemAcl](add-itemacl.md) +* [Get-ItemAcl](get-itemacl.md) +* [New-ItemAcl](new-itemacl.md) +* [Set-ItemAcl](set-itemacl.md) +* [Test-ItemAcl](test-itemacl.md) +* [https://sdn.sitecore.net/upload/sitecore6/security\_administrators\_cookbook\_a4.pdf](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/61/security_reference-a4.pdf) +* [https://sdn.sitecore.net/upload/sitecore6/64/content\_api\_cookbook\_sc64\_and\_later-a4.pdf](https://sdn.sitecore.net/upload/sitecore6/64/content_api_cookbook_sc64_and_later-a4.pdf) +* [https://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2013/01/sitecore-security-access-rights.aspx](https://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/](https://briancaos.wordpress.com/2009/10/02/assigning-security-to-items-in-sitecore-6-programatically/) + diff --git a/appendix/security/disable-user.md b/appendix/security/disable-user.md new file mode 100644 index 00000000..72d14228 --- /dev/null +++ b/appendix/security/disable-user.md @@ -0,0 +1,89 @@ +# Disable-User + +Disables the specified Sitecore user. + +## Syntax + +Disable-User \[-Identity\] <AccountIdentity> + +Disable-User -Instance <User> + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Identity <AccountIdentity> + +Specifies the Sitecore user by providing one of the following values. + +```powershell +Local Name + Example: michael +Fully Qualified Name + Example: sitecore\michael +``` + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Instance <User> + +Specifies the Sitecore user by providing an instance of a user. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.String + + Represents the identity of a user. + +Sitecore.Security.Accounts.User One or more user instances. + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* None. + +## Notes + +Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\> Disable-User -Identity michael +``` + +### EXAMPLE 2 + +```powershell +PS master:\> Get-User -Filter * | Disable-User +``` + +## Related Topics + +* [https://michaellwest.blogspot.com](https://michaellwest.blogspot.com) + diff --git a/appendix/security/enable-user.md b/appendix/security/enable-user.md new file mode 100644 index 00000000..505a73ab --- /dev/null +++ b/appendix/security/enable-user.md @@ -0,0 +1,89 @@ +# Enable-User + +Enables the specified Sitecore user. + +## Syntax + +Enable-User \[-Identity\] <AccountIdentity> + +Enable-User -Instance <User> + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Identity <AccountIdentity> + +Specifies the Sitecore user by providing one of the following values. + +```powershell +Local Name + Example: michael +Fully Qualified Name + Example: sitecore\michael +``` + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Instance <User> + +Specifies the Sitecore user by providing an instance of a user. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.String + + Represents the identity of one or more users. + +Sitecore.Security.Accounts.User One or more user instances. + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* None. + +## Notes + +Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\> Enable-User -Identity michael +``` + +### EXAMPLE 2 + +```powershell +PS master:\> Get-User -Filter * | Enable-User +``` + +## Related Topics + +* [https://michaellwest.blogspot.com](https://michaellwest.blogspot.com) + diff --git a/appendix/security/export-role.md b/appendix/security/export-role.md new file mode 100644 index 00000000..9d496191 --- /dev/null +++ b/appendix/security/export-role.md @@ -0,0 +1,150 @@ +# Export-Role + +Exports \(serializes\) Sitecore roles to the filesystem on the server. + +## Syntax + +Export-Role \[-Identity\] <AccountIdentity> \[-Root <String>\] + +Export-Role \[-Identity\] <AccountIdentity> -Path <String> + +Export-Role -Filter <String> \[-Root <String>\] + +Export-Role \[-Role\] <Role> \[-Root <String>\] + +Export-Role \[-Role\] <Role> -Path <String> + +## Detailed Description + +The Export-Role command exports \(serializes\) Sitecore roles to the filesystem on the server. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Identity <AccountIdentity> + +Specifies the Sitecore role by providing one of the following values. + +```powershell +Local Name + Example: developer +Fully Qualified Name + Example: sitecore\developer +``` + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Filter <String> + +Specifies a simple pattern to match Sitecore roles. + +Examples: The following examples show how to use the filter syntax. + +To get all the roles, use the asterisk wildcard: Export-Role -Filter \* + +To get all the roles in a domain use the following command: Export-Role -Filter "sitecore\*" + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Role <Role> + +Specifies the role to be exported + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the file the role should be saved to. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Root <String> + +Specifies the serialization root directory. If this parameter is not specified - the default Sitecore serialization folder will be used \(unless you're saving to an explicit location with the -Path parameter\). + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## 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 + +```powershell +PS master:\> Export-Role -Identity sitecore\Author +``` + +### EXAMPLE 2 + +```powershell +PS master:\> Export-Role -Filter sitecore\* +``` + +### EXAMPLE 3 + +```powershell +PS master:\> Export-Role -Root C:\my\Serialization\Folder\ -Filter *\* +``` + +### EXAMPLE 4 + +```powershell +PS master:\> Export-Role -Path C:\my\Serialization\Folder\Authors.role -Identity sitecore\Author +``` + +## Related Topics + +* [Import-Role](import-role.md) +* [Export-User](export-user.md) +* [Import-User](import-user.md) +* [Export-Item](../packaging/export-item.md) +* [Import-Item](export-role.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/security/export-user.md b/appendix/security/export-user.md new file mode 100644 index 00000000..979e4ecc --- /dev/null +++ b/appendix/security/export-user.md @@ -0,0 +1,147 @@ +# Export-User + +Export \(serialize\) a Sitecore user to the filesystem on the server. + +## Syntax + +Export-User \[-Identity\] <AccountIdentity> \[-Root <String>\] + +Export-User \[-Identity\] <AccountIdentity> -Path <String> + +Export-User -Filter <String> \[-Root <String>\] + +Export-User \[-User\] <User> \[-Root <String>\] + +Export-User \[-User\] <User> -Path <String> + +Export-User -Current \[-Root <String>\] + +Export-User -Current -Path <String> + +## Detailed Description + +The Export-User command serializes a Sitecore user to the filesystem on the server. + +The Identity parameter specifies the Sitecore user to get. You can specify a user by its local name or fully qualified name. You can also specify user object variable, such as $<user>. + +To search for and retrieve more than one user, use the Filter parameter. + +You can also pipe a user from the Get-user command. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Identity <AccountIdentity> + +Specifies the Sitecore user by providing one of the following values. + +```powershell +Local Name + Example: admin +Fully Qualified Name + Example: sitecore\admi +``` + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Filter <String> + +Specifies a simple pattern to match Sitecore users. + +Examples: The following examples show how to use the filter syntax. + +To get all the users, use the asterisk wildcard: Export-User -Filter \* + +To get all the users in a domain use the following command: Export-User -Filter "sitecore\*" + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -User <User> + +User object retrieved from the Sitecore API or using the Get-User command. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Current <SwitchParameter> + +Specifies that the current user should be serialized. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the file the user should be saved to. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Root <String> + +Overrides Sitecore Serialization root directory + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Security.Accounts.User + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> Export-User -Identify sitecore\admin +``` + +## Related Topics + +* [Export-Role](export-role.md) +* [Import-User](import-user.md) +* [Export-Item](../packaging/export-item.md) +* [Import-Role](import-role.md) +* [Import-Item](export-user.md) +* [Get-User](get-user.md) +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/security/get-domain.md b/appendix/security/get-domain.md new file mode 100644 index 00000000..e34303ad --- /dev/null +++ b/appendix/security/get-domain.md @@ -0,0 +1,75 @@ +# Get-Domain + +Gets all available domains or the specified domain. + +## Syntax + +Get-Domain \[-Name <String>\] + +## Detailed Description + +The Get-Domain command returns all the domains or the specified domain. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Name <String> + +The name of the domai + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.String + + Represents the name of a domain. + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Security.Domains.Domai + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\> Get-Domain -Name sitecore +Name AccountPrefix EnsureAnonymousUser LocallyManaged +---- ------------- ------------------- -------------- +sitecore sitecore\ False False +``` + +### EXAMPLE 2 + +```powershell +PS master:\> Get-Domain + +Name AccountPrefix EnsureAnonymousUser LocallyManaged +---- ------------- ------------------- -------------- +sitecore sitecore\ False False +extranet extranet\ True False +default default\ True False +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Remove-Domain](remove-domain.md) +* [New-Domain](new-domain.md) + diff --git a/appendix/security/get-itemacl.md b/appendix/security/get-itemacl.md new file mode 100644 index 00000000..522c2671 --- /dev/null +++ b/appendix/security/get-itemacl.md @@ -0,0 +1,168 @@ +# Get-ItemAcl + +Retrieves security access rules from an item. + +## Syntax + +Get-ItemAcl -Identity <AccountIdentity> -Path <String> + +Get-ItemAcl -Identity <AccountIdentity> -Id <String> \[-Database <String>\] + +Get-ItemAcl -Identity <AccountIdentity> -Item <Item> + +Get-ItemAcl -Filter <String> -Path <String> + +Get-ItemAcl -Filter <String> -Id <String> \[-Database <String>\] + +Get-ItemAcl -Filter <String> -Item <Item> + +Get-ItemAcl -Item <Item> + +Get-ItemAcl -Path <String> + +Get-ItemAcl -Id <String> + +## Detailed Description + +Retrieves security access rules from an item. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Identity <AccountIdentity> + +User name including domain for which the access rule is being created. If no domain is specified - 'sitecore' will be used as the default domain. + +Specifies the Sitecore user by providing one of the following values. + +```powershell +Local Name + Example: adam +Fully Qualified Name + Example: sitecore\adam +``` + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Filter <String> + +Specifies a simple pattern to match Sitecore roles & users. + +Examples: The following examples show how to use the filter syntax. + +To get security for all roles, use the asterisk wildcard: Get-ItemAcl -Filter \* + +To security got all roles in a domain use the following command: Get-ItemAcl -Filter "sitecore\*" + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item from which the security rules should be taken. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item from which the security rules should be taken. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item from which the security rules should be taken. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be fetched with Id parameter containing the security rules that should be returned. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Security.AccessControl.AccessRule + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Take the security information from the Home item and apply it to the Settings item + +```powershell +$acl = Get-ItemAcl -Path master:\content\home +Set-ItemAcl -Path master:\content\Settings -AccessRules $acl -PassThru +``` + +### EXAMPLE 2 + +Take the security information from the Home item and add it to the access rules on the Settings item + +```powershell +$acl = Get-ItemAcl -Path master:\content\home +Add-ItemAcl -Path master:\content\Settings -AccessRules $acl -PassThru +``` + +## Related Topics + +* [Add-ItemAcl](add-itemacl.md) +* [Clear-ItemAcl](clear-itemacl.md) +* [Set-ItemAcl](set-itemacl.md) +* [New-ItemAcl](new-itemacl.md) +* [Test-ItemAcl](test-itemacl.md) +* [https://sdn.sitecore.net/upload/sitecore6/security\_administrators\_cookbook\_a4.pdf](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/61/security_reference-a4.pdf) +* [https://sdn.sitecore.net/upload/sitecore6/64/content\_api\_cookbook\_sc64\_and\_later-a4.pdf](https://sdn.sitecore.net/upload/sitecore6/64/content_api_cookbook_sc64_and_later-a4.pdf) +* [https://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2013/01/sitecore-security-access-rights.aspx](https://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/](https://briancaos.wordpress.com/2009/10/02/assigning-security-to-items-in-sitecore-6-programatically/) + diff --git a/appendix/security/get-role.md b/appendix/security/get-role.md new file mode 100644 index 00000000..91852552 --- /dev/null +++ b/appendix/security/get-role.md @@ -0,0 +1,134 @@ +# Get-Role + +Returns one or more Sitecore roles using the specified criteria. + +## Syntax + +Get-Role \[-Identity\] <AccountIdentity> + +Get-Role -Filter <String> + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Identity <AccountIdentity> + +Specifies the Sitecore role by providing one of the following values. + +```powershell +Local Name + Example: developer +Fully Qualified Name + Example: sitecore\developer +``` + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Filter <String> + +Specifies a simple pattern to match Sitecore roles. + +Examples: The following examples show how to use the filter syntax. + +To get all the roles, use the asterisk wildcard: Get-Role -Filter \* + +To get all the roles in a domain use the following command: Get-Role -Filter "sitecore\*" + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.String + + Represents the identity of a role. + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Security.Accounts.Role + + Returns one or more roles. + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\> Get-Role -Identity sitecore\developer + +Name Domain IsEveryone +---- ------ ---------- +sitecore\developer sitecore False +``` + +### EXAMPLE 2 + +```powershell +PS master:\> "sitecore\developer","sitecore\author" | Get-Role + +Name Domain IsEveryone +---- ------ ---------- +sitecore\author sitecore False +sitecore\developer sitecore False +``` + +### EXAMPLE 3 + +```powershell +PS master:\> Get-Role -Filter sitecore\d* + +Name Domain IsEveryone +---- ------ ---------- +sitecore\Designer sitecore False +sitecore\Developer sitecore False +``` + +### EXAMPLE 4 + +Expand the MemberOf property to see a list of roles that the specified role is a member. + +```powershell +PS master:\> Get-Role -Identity sitecore\developer | Select-Object -ExpandProperty MemberOf + +Name Domain IsEveryone +---- ------ ---------- +sitecore\Sitecore Client Configuring sitecore False +sitecore\Sitecore Client Developing sitecore False +sitecore\Designer sitecore False +sitecore\Author sitecore False +sitecore\Sitecore Client Maintaining sitecore False +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Get-RoleMember](get-rolemember.md) + diff --git a/appendix/security/get-rolemember.md b/appendix/security/get-rolemember.md new file mode 100644 index 00000000..eec0d39a --- /dev/null +++ b/appendix/security/get-rolemember.md @@ -0,0 +1,131 @@ +# Get-RoleMember + +Returns the Sitecore users in the specified role. + +## Syntax + +Get-RoleMember \[-Identity\] <AccountIdentity> \[-Recurse\] + +Get-RoleMember \[-Identity\] <AccountIdentity> \[-UsersOnly\] \[-Recurse\] + +Get-RoleMember \[-Identity\] <AccountIdentity> \[-RolesOnly\] \[-Recurse\] + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Identity <AccountIdentity> + +Specifies the Sitecore role by providing one of the following values. + +```powershell +Local Name + Example: developer +Fully Qualified Name + Example: sitecore\developer +``` + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Recurse <SwitchParameter> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -UsersOnly <SwitchParameter> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -RolesOnly <SwitchParameter> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.String + + Represents the identity of a role. + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Security.Accounts.User + + Returns one or more users. + +Sitecore.Security.Accounts.Role Returns one or more roles. + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\> Get-RoleMember -Identity developer + +Name Domain IsAdministrator IsAuthenticated +---- ------ --------------- --------------- +sitecore\michael sitecore False False +``` + +### EXAMPLE 2 + +```powershell +PS master:\> Get-RoleMember -Identity author + +Name Domain IsAdministrator IsAuthenticated +---- ------ --------------- --------------- +sitecore\michael sitecore False False + +Domain : sitecore +IsEveryone : False +IsGlobal : False +AccountType : Role +Description : Role +DisplayName : sitecore\Developer +LocalName : sitecore\Developer +Name : sitecore\Developer +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Get-Role](get-role.md) +* [Remove-RoleMember](remove-rolemember.md) +* [Add-RoleMember](add-rolemember.md) + diff --git a/appendix/security/get-user.md b/appendix/security/get-user.md new file mode 100644 index 00000000..cb6d309c --- /dev/null +++ b/appendix/security/get-user.md @@ -0,0 +1,193 @@ +# Get-User + +Returns one or more Sitecore users using the specified criteria. + +## Syntax + +``` +Get-User [-Identity] [-Authenticated] +Get-User -Filter [-Authenticated] [-ResultPageSize ] +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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Identity <AccountIdentity> + +Specifies the Sitecore user by providing one of the following values. + +Local Name: + +```powershell +admin +``` + +Fully Qualified Name: + +```powershell +sitecore\admin +``` + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Filter <String> + +Specifies a simple pattern to match Sitecore users. + +Examples: The following examples show how to use the filter syntax. + +To get all the users, use the asterisk wildcard: + +```powershell +Get-User -Filter * +``` + +To get all the users in a domain use the following command: + +```powershell +Get-User -Filter "sitecore\*" +``` + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Current <SwitchParameter> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Authenticated <SwitchParameter> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ResultPageSize <Int32> + +Specifies the number of users to retrieve per request to the user provider. Each page of users is written to the pipeline before the next request is made. Without specifying this parameter all accounts are retrieved before passing down the pipeline. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.String + + Represents the identity of a user. + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Security.Accounts.User + + Returns one or more users. + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\> Get-User -Identity admin + +Name Domain IsAdministrator IsAuthenticated +---- ------ --------------- --------------- +sitecore\admin sitecore True False +``` + +### EXAMPLE 2 + +```powershell +PS master:\> "admin","michael" | Get-User + +Name Domain IsAdministrator IsAuthenticated +---- ------ --------------- --------------- +sitecore\Admin sitecore True False +sitecore\michael sitecore False False +``` + +### EXAMPLE 3 + +```powershell +PS master:\> Get-User -Filter * + +Name Domain IsAdministrator IsAuthenticated +---- ------ --------------- --------------- +default\Anonymous default False False +extranet\Anonymous extranet False False +sitecore\Admin sitecore True False +sitecore\michael sitecore False False +``` + +### EXAMPLE 4 + +```powershell +PS master:\> Get-User -Filter "michaellwest@*.com" + +Name Domain IsAdministrator IsAuthenticated +---- ------ --------------- --------------- +sitecore\michael sitecore False False +``` + +### EXAMPLE 5 + +Expand the MemberOf property to see a list of roles that the specified user is a member. + +```powershell +PS master:\> Get-User -Identity sitecore\michael | Select-Object -ExpandProperty MemberOf + +Name Domain IsEveryone +---- ------ ---------- +sitecore\PowerShell Extensions Remoting sitecore False +sitecore\Developer sitecore False +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Set-User](set-user.md) +* [New-User](new-user.md) +* [Remove-User](remove-user.md) +* [Unlock-User](unlock-user.md) + diff --git a/appendix/security/import-role.md b/appendix/security/import-role.md new file mode 100644 index 00000000..010758d9 --- /dev/null +++ b/appendix/security/import-role.md @@ -0,0 +1,137 @@ +# Import-Role + +Imports \(deserializes\) Sitecore roles from the Sitecore server filesystem. + +## Syntax + +Import-Role \[-Identity\] <AccountIdentity> \[-Root <String>\] + +Import-Role -Filter <String> \[-Root <String>\] + +Import-Role \[-Role\] <User> \[-Root <String>\] + +Import-Role -Path <String> + +## Detailed Description + +The Import-Role command imports \(deserializes\) Sitecore roles from the Sitecore server filesystem. + +© 2010-2019 Adam Najmanowicz, 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. + +```powershell +Local Name + Example: developer +Fully Qualified Name + Example: sitecore\developer +``` + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Filter <String> + +Specifies a simple pattern to match Sitecore roles. + +Examples: The following examples show how to use the filter syntax. + +To get all the roles, use the asterisk wildcard: Import-Role -Filter \* + +To get all the roles in a domain use the following command: Import-Role -Filter "sitecore\*" + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Role <User> + +An existing role object to be restored to the version from disk + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the file the role should be loaded from. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Root <String> + +Specifies the serialization root directory. If this parameter is not specified - the default Sitecore serialization folder will be used \(unless you're reading from an explicit location with the -Path parameter\). + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +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 + +```powershell +PS master:\> Import-Role -Identity sitecore\Author +``` + +### EXAMPLE 2 + +```powershell +PS master:\> Import-Role -Filter sitecore\* +``` + +### EXAMPLE 3 + +```powershell +PS master:\> Import-Role -Root C:\my\Serialization\Folder\ -Filter *\* +``` + +### EXAMPLE 4 + +```powershell +PS master:\> Import-Role -Path C:\my\Serialization\Folder\Admins.role +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/security/import-user.md b/appendix/security/import-user.md new file mode 100644 index 00000000..6b5e3938 --- /dev/null +++ b/appendix/security/import-user.md @@ -0,0 +1,137 @@ +# Import-User + +Imports \(deserializes\) Sitecore users from the Sitecore server filesystem. + +## Syntax + +Import-User \[-Identity\] <AccountIdentity> \[-Root <String>\] + +Import-User -Filter <String> \[-Root <String>\] + +Import-User \[-User\] <User> \[-Root <String>\] + +Import-User -Path <String> + +## Detailed Description + +The Import-User command imports \(deserializes\) Sitecore users from the Sitecore server filesystem. + +© 2010-2019 Adam Najmanowicz, 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. + +```powershell +Local Name + Example: developer +Fully Qualified Name + Example: sitecore\developer +``` + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Filter <String> + +Specifies a simple pattern to match Sitecore users. + +Examples: The following examples show how to use the filter syntax. + +To get all the roles, use the asterisk wildcard: Import-User -Filter \* + +To get all the roles in a domain use the following command: Import-User -Filter "sitecore\*" + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -User <User> + +User object retrieved from the Sitecore API or using the Get-User command identifying the user account to be deserialized. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the file the user should be loaded from. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Root <String> + +Specifies the serialization root directory. If this parameter is not specified - the default Sitecore serialization folder will be used \(unless you're reading from an explicit location with the -Path parameter\). + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +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 + +```powershell +PS master:\> Import-User -Identity sitecore\Admin +``` + +### EXAMPLE 2 + +```powershell +PS master:\> Import-User -Filter sitecore\* +``` + +### EXAMPLE 3 + +```powershell +PS master:\> Import-User -Root C:\my\Serialization\Folder\ -Filter *\* +``` + +### EXAMPLE 4 + +```powershell +PS master:\> Import-User -Path C:\my\Serialization\Folder\Admin.user +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/security/lock-item.md b/appendix/security/lock-item.md new file mode 100644 index 00000000..3762c0e7 --- /dev/null +++ b/appendix/security/lock-item.md @@ -0,0 +1,157 @@ +# Lock-Item + +Locks the Sitecore item by the current or specified user. + +## Syntax + +Lock-Item \[-Item\] <Item> \[-Force\] \[-PassThru\] \[-Identity <AccountIdentity>\] + +Lock-Item \[-Path\] <String> \[-Force\] \[-PassThru\] \[-Identity <AccountIdentity>\] + +Lock-Item -Id <String> \[-Database <String>\] \[-Force\] \[-PassThru\] \[-Identity <AccountIdentity>\] + +## Detailed Description + +The Lock-Item command unlocks the item. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Force  <SwitchParameter> + +Forces the item to be locked by the specified user even if it's currently locked by another user. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -PassThru  <SwitchParameter> + +Passes the processed object back into the pipeline. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Identity  <AccountIdentity> + +User name including domain for which the item is to be locked. If no domain is specified - 'sitecore' will be used as the default domain. + +Specifies the Sitecore user by providing one of the following values. + +```powershell +Local Name + Example: adam +Fully Qualified Name + Example: sitecore\adam +``` + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item  <Item> + +The item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path  <String> + +Path to the item to be processed - can work with Language parameter to specify the language other than current session language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id  <String> + +Id of the item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database  <String> + +Database containing the item to be fetched with Id parameter. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* can be piped from another cmdlet\* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Only if -PassThru is used\* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Lock the Home item providing its path + +```powershell +PS master:\> Lock-Item -Path master:\content\home +``` + +### EXAMPLE 2 + +Lock the Home item by providing it from the pipeline and passing it back to the pipeline. The Item is locked by the "sitecore\adam" user. + +```powershell +PS master:\> Get-Item -Path master:\content\home | Lock-Item -PassThru -Identity sitecore\adam + +Name Children Languages Id TemplateName +---- -------- --------- -- ------------ +Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Unlock-Item](https://github.com/SitecorePowerShell/Book/tree/bfef3ab0ca500162f7287e1fd4fa14bb4f6a760b/appendix/commands/Unlock-Item.md) +* Get-Item + diff --git a/appendix/security/login-user.md b/appendix/security/login-user.md new file mode 100644 index 00000000..020b64a9 --- /dev/null +++ b/appendix/security/login-user.md @@ -0,0 +1,56 @@ +# Login-User + +Logs a user in and performs further script instructions in the context of the user. + +## Syntax + +Login-User \[-Identity\] <GenericIdentity> \[-Password\] <String> + +## Detailed Description + +Logs a user in and performs further script instructions in the context of the user. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Identity <GenericIdentity> + +User name including domain. If no domain is specified - 'sitecore' will be used as the default value + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Password <String> + +Password for the account provided using the -Identity parameter. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 2 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> Login-User -Identity "sitecore\admin" -Password "b" +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/security/logout-user.md b/appendix/security/logout-user.md new file mode 100644 index 00000000..3259e92e --- /dev/null +++ b/appendix/security/logout-user.md @@ -0,0 +1,30 @@ +# Logout-User + +Logs the current user out. + +## Syntax + +## Detailed Description + +Logs the current user out. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> Logout-User +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/security/new-domain.md b/appendix/security/new-domain.md new file mode 100644 index 00000000..5c0543fc --- /dev/null +++ b/appendix/security/new-domain.md @@ -0,0 +1,72 @@ +# New-Domain + +Creates a new domain with the specified name. + +## Syntax + +New-Domain \[-Name\] <String> \[-LocallyManaged\] + +## Detailed Description + +The New-Domain command creates a domain if it does not exist. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Name <String> + +The name of the domain. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -LocallyManaged <SwitchParameter> + +TODO: Provide description for this parameter + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.String + + Represents the name of a domain. + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* None. + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> New-Domain -Name "domainName" +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Get-Domain](get-domain.md) +* [Remove-Domain](remove-domain.md) + diff --git a/appendix/security/new-itemacl.md b/appendix/security/new-itemacl.md new file mode 100644 index 00000000..bdc48b6b --- /dev/null +++ b/appendix/security/new-itemacl.md @@ -0,0 +1,175 @@ +# New-ItemAcl + +Creates a new access rule for use with Set-ItemAcl and Add-ItemAcl cmdlets. + +## Syntax + +New-ItemAcl \[-Identity\] <AccountIdentity> \[-AccessRight\] <String> \[-PropagationType\] <Unknown \| Descendants \| Entity \| Any> \[-SecurityPermission\] <NotSet \| AllowAccess \| DenyAccess \| AllowInheritance \| DenyInheritance> + +## Detailed Description + +Creates a new access rule for use with Set-ItemAcl and Add-ItemAcl cmdlets. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Identity <AccountIdentity> + +User name including domain for which the access rule is being created. If no domain is specified - 'sitecore' will be used as the default domain. + +Specifies the Sitecore user by providing one of the following values. + +```powershell +Local Name + Example: adam +Fully Qualified Name + Example: sitecore\adam +``` + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -AccessRight <String> + +The access right to grand or deny. Well known rights are: + +* field:read - "Field Read" - controls whether an account can read a specific field on an item.. +* field:write - "Field Write" - controls whether an account can update a specific field on an item. +* item:read - "Read" - controls whether an account can see an item in the content tree and/or on the published Web site, including all of its properties and field values. +* item:write - "Write" - controls whether an account can update field values. The write access right requires the read access right and field read and field write access rights for individual fields \(field read and field write are allowed by default\). +* item:rename - "Rename" - controls whether an account can change the name of an item. The rename access right requires the read access right. +* item:create - "Create" - controls whether an account can create child items. The create access right requires the read access right. +* item:delete - "Delete" - Delete right for items. controls whether an account can delete an item. The delete access right requires the read access right + + Important! + + The Delete command also deletes all child items, even if the account has been denied Delete + + rights for one or more of the subitems. + +* item:admin - "Administer" - controls whether an account can configure access rights on an item. The administer access right requires the read and write access rights. +* language:read - "Language Read" - controls whether a user can read a specific language version of items. +* language:write - "Language Write" - controls whether a user can update a specific language version of items. +* site:enter - controls whether a user can access a specific site. +* insert:show - "Show in Insert" - Determines if the user can see the insert option +* workflowState:delete - "Workflow State Delete" - controls whether a user can delete items which are currently associated with a specific workflow state. +* workflowState:write - "Workflow State Write" - controls whether a user can update items which are currently associated with a specific workflow state. +* workflowCommand:execute - "Workflow Command Execute" - — controls whether a user is shown specific workflow commands. +* profile:customize - "Customize Profile Key Values" - The right to input out of range values of profile keys, that belong to this profile. +* bucket:makebucket - "Create Bucket" - convert item to bucket. +* bucket:unmake - "Revert Bucket" - convert item back from bucket. +* remote:fieldread - "Field Remote Read" - Field Read right for remoted clients. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 2 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -PropagationType <PropagationType> + +The PropagationType enumeration determines which items will be granted the access right. + +* Any - the item and all items inheriting +* Descendants - applies rights to inheriting children only +* Entity - applies right to the item only + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 3 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -SecurityPermission <SecurityPermission> + +The SecurityPermission determines whether to grant \(allow\) or deny the access right, and deny or allow inheritance of the right. + +* AllowAccess - +* DenyAccess - +* AllowInheritance - +* DenyInheritance - + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 4 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Security.AccessControl.AccessRule + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Creates an access rule that allows the "sitecore\adam" user to delete the item to which it will be applied and all of its childre + +```powershell +PS master:\> New-ItemAcl -AccessRight item:delete -PropagationType Any -SecurityPermission AllowAccess -Identity "sitecore\adam" + +Account AccessRight PermissionType PropagationType SecurityPermission +------- ----------- -------------- --------------- ------------------ +sitecore\admin item:delete Access Any AllowAccess +``` + +### EXAMPLE 2 + +Allows the "sitecore\adam" user to delete the Home item and all of its children. Denies the "sitecore\mikey" user reading the descendants of the Home item. ;P The security info is created prior to adding it to the item. The item is delivered to the Add-ItemAcl from the pipeline and returned to the pipeline after processing due to the -PassThru parameter. The security information is added to the previously existing security qualifiers. + +```powershell +$acl1 = New-ItemAcl -AccessRight item:delete -PropagationType Any -SecurityPermission AllowAccess -Identity "sitecore\adam" +$acl2 = New-ItemAcl -AccessRight item:read -PropagationType Descendants -SecurityPermission DenyAccess -Identity "sitecore\mikey" +Get-Item -Path master:\content\home | Add-ItemAcl -AccessRules $acl1, $acl2 -PassThru + +Name Children Languages Id TemplateName +---- -------- --------- -- ------------ +Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item +``` + +### EXAMPLE 3 + +Allows the "sitecore\adam" user to delete the Home item and all of its children. Denies the "sitecore\mikey" user reading the descendants of the Home item. ;P The security info is created prior to setting it to the item. The item is delivered to the Set-ItemAcl from the pipeline and returned to the pipeline after processing due to the -PassThru parameter. Any previuous security information on the item is removed. + +```powershell +$acl1 = New-ItemAcl -AccessRight item:delete -PropagationType Any -SecurityPermission AllowAccess -Identity "sitecore\adam" +$acl2 = New-ItemAcl -AccessRight item:read -PropagationType Descendants -SecurityPermission DenyAccess -Identity "sitecore\mikey" +Get-Item -Path master:\content\home | Set-ItemAcl -AccessRules $acl1, $acl2 -PassThru + +Name Children Languages Id TemplateName +---- -------- --------- -- ------------ +Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Add-ItemAcl](add-itemacl.md) +* [Clear-ItemAcl](clear-itemacl.md) +* [Get-ItemAcl](get-itemacl.md) +* [Set-ItemAcl](set-itemacl.md) +* [Test-ItemAcl](test-itemacl.md) +* [https://sdn.sitecore.net/upload/sitecore6/security\_administrators\_cookbook\_a4.pdf](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/61/security_reference-a4.pdf) +* [https://sdn.sitecore.net/upload/sitecore6/64/content\_api\_cookbook\_sc64\_and\_later-a4.pdf](https://sdn.sitecore.net/upload/sitecore6/64/content_api_cookbook_sc64_and_later-a4.pdf) +* [https://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2013/01/sitecore-security-access-rights.aspx](https://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/](https://briancaos.wordpress.com/2009/10/02/assigning-security-to-items-in-sitecore-6-programatically/) + diff --git a/appendix/security/new-role.md b/appendix/security/new-role.md new file mode 100644 index 00000000..9e66e86e --- /dev/null +++ b/appendix/security/new-role.md @@ -0,0 +1,56 @@ +# New-Role + +Creates a new Sitecore role. + +## Syntax + +New-Role \[-Identity\] <AccountIdentity> + +## Detailed Description + +The New-Role command creates a new Sitecore role. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Identity <AccountIdentity> + +Role name including domain. If no domain is specified - 'sitecore' will be used as the default value + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByPropertyName\) | +| Accept Wildcard Characters? | false | + +## 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. + +* Sitecore.Security.Accounts.Role + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> New-Role -Identity Michael +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/security/new-user.md b/appendix/security/new-user.md new file mode 100644 index 00000000..03f742fa --- /dev/null +++ b/appendix/security/new-user.md @@ -0,0 +1,161 @@ +# New-User + +Creates a new Sitecore user. + +## Syntax + +New-User \[-Identity\] <AccountIdentity> \[-Password <String>\] \[-Email <String>\] \[-FullName <String>\] \[-Comment <String>\] \[-Portrait <String>\] \[-Enabled\] \[-ProfileItemId <ID>\] + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Identity <AccountIdentity> + +Specifies the Sitecore user by providing one of the following values. + +```powershell +Local Name + Example: developer +Fully Qualified Name + Example: sitecore\developer +``` + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Password <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Email <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -FullName <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Comment <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Portrait <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Enabled <SwitchParameter> + +Specifies that the account should be enabled. When enabled, the Password parameter is required. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -ProfileItemId <ID> + +Specifies the profile id to use for the user. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByPropertyName\) | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.String + + Represents the identity of a role. + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* None. + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\> New-User -Identity michael +``` + +### EXAMPLE 2 + +```powershell +PS master:\> New-User -Identity michael -Enabled -Password b -Email michaellwest@gmail.com -FullName "Michael West" +``` + +### EXAMPLE 3 + +```powershell +PS master:\> New-User -Identity michael -PassThru + +Name Domain IsAdministrator IsAuthenticated +---- ------ --------------- --------------- +sitecore\michael2 sitecore False False +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Get-User](get-user.md) +* [Set-User](set-user.md) +* [Remove-User](remove-user.md) +* [Unlock-User](unlock-user.md) + diff --git a/appendix/security/protect-item.md b/appendix/security/protect-item.md new file mode 100644 index 00000000..bb5d53f5 --- /dev/null +++ b/appendix/security/protect-item.md @@ -0,0 +1,120 @@ +# Protect-Item + +Protects the Sitecore item. + +## Syntax + +Protect-Item \[-Item\] <Item> \[-PassThru\] + +Protect-Item \[-Path\] <String> \[-PassThru\] + +Protect-Item -Id <String> \[-Database <String>\] \[-PassThru\] + +## Detailed Description + +The Protect-Item command protects the item by making it read-only. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -PassThru <SwitchParameter> + +Passes the processed item back into the pipeline. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be processed - can work with Language parameter to specify the language other than current session language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be fetched with Id parameter. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* can be piped from another cmdlet\* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Only if -PassThru is used\* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\> Protect-Item -Path master:\content\home +``` + +### EXAMPLE 2 + +```powershell +PS master:\> Get-Item -Path master:\content\home | Protect-Item -PassThru + +Name Children Languages Id TemplateName +---- -------- --------- -- ------------ +Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Unprotect-Item](unprotect-item.md) +* Get-Item + diff --git a/appendix/security/remove-domain.md b/appendix/security/remove-domain.md new file mode 100644 index 00000000..5f9a5894 --- /dev/null +++ b/appendix/security/remove-domain.md @@ -0,0 +1,70 @@ +# Remove-Domain + +Removes the specified domain. + +## Syntax + +Remove-Domain \[-Name\] <String> \[-Force\] + +## Detailed Description + +The Remove-Domain command removes the specified domain. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Name <String> + +The name of the domain. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Force <SwitchParameter> + +Indicates that the domain should be removed although it contains users in that domain. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.String + + Represents the name of a domain. + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* None. + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> Remove-Domain -Name "domainName" +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/security/remove-role.md b/appendix/security/remove-role.md new file mode 100644 index 00000000..2dc3feaa --- /dev/null +++ b/appendix/security/remove-role.md @@ -0,0 +1,70 @@ +# Remove-Role + +Removes a Sitecore role. + +## Syntax + +Remove-Role \[-Identity\] <AccountIdentity> + +Remove-Role -Instance <Role> + +## Detailed Description + +The Remove-Role command removes a Sitecore role. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Identity <AccountIdentity> + +Role name including domain. If no domain is specified - 'sitecore' will be used as the default value + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Instance <Role> + +Role instance like that returned by the Get-Role command. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* 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 + +```powershell +PS master:\> Remove-Role -Identity Michael +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/security/remove-rolemember.md b/appendix/security/remove-rolemember.md new file mode 100644 index 00000000..efd03a18 --- /dev/null +++ b/appendix/security/remove-rolemember.md @@ -0,0 +1,79 @@ +# Remove-RoleMember + +Removes one or more Sitecore users from the specified role. + +## Syntax + +Remove-RoleMember \[-Identity\] <AccountIdentity> -Members <AccountIdentity\[\]> + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Identity <AccountIdentity> + +Specifies the Sitecore role by providing one of the following values. + +```powershell +Local Name + Example: developer +Fully Qualified Name + Example: sitecore\developer +``` + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Members <AccountIdentity\[\]> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.String + + Represents the identity of a role. + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* None. + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> Remove-RoleMember -Identity developer -Members "michael","adam","mike" +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Add-RoleMember](add-rolemember.md) +* [Get-RoleMember](get-rolemember.md) + diff --git a/appendix/security/remove-user.md b/appendix/security/remove-user.md new file mode 100644 index 00000000..c5f1b56d --- /dev/null +++ b/appendix/security/remove-user.md @@ -0,0 +1,97 @@ +# Remove-User + +Removes the Sitecore user. + +## Syntax + +Remove-User \[-Identity\] <AccountIdentity> + +Remove-User -Instance <User> + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Identity <AccountIdentity> + +Specifies the Sitecore user by providing one of the following values. + +```powershell +Local Name + Example: admin +Fully Qualified Name + Example: sitecore\admi +``` + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Instance <User> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.String + + Represents the identity of a user. + +Sitecore.Security.Accounts.User Represents the instance of a user. + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* None. + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\> Remove-User -Identity michael +``` + +### EXAMPLE 2 + +```powershell +PS master:\> "michael","adam","mike" | Remove-User +``` + +### EXAMPLE 3 + +```powershell +PS master:\> Get-User -Filter sitecore\m* | Remove-User +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Get-User](get-user.md) +* [New-User](new-user.md) +* [Set-User](set-user.md) +* [Unlock-User](unlock-user.md) + diff --git a/appendix/security/set-itemacl.md b/appendix/security/set-itemacl.md new file mode 100644 index 00000000..542c2d2c --- /dev/null +++ b/appendix/security/set-itemacl.md @@ -0,0 +1,158 @@ +# Set-ItemAcl + +Sets new security information on an item overwriting the previous settings. + +## Syntax + +```powershell +Set-ItemAcl -AccessRules [-Path] [-PassThru] +Set-ItemAcl -AccessRules -Id [-Database ] [-PassThru] +Set-ItemAcl -AccessRules [-Item] [-PassThru] +``` + +## Detailed Description + +Sets new security information on an item. The new rules will overwrite the existing security descriptors on the item. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -AccessRules <AccessRuleCollection> + +A single or multiple access rules created e.g. through the New-ItemAcl or obtained from other item using the Get-ItemAcl cmdlet. This information will overwrite the existing security descriptors on the item. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -PassThru <SwitchParameter> + +Passes the processed object back into the pipeline. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be processed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be processed. Requires the Database parameter to be specified. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be fetched with Id parameter. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* can be piped from another cmdlet\* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Only if -PassThru is used\* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Take the security information from the Home item and apply it to the Settings item + +```powershell +$acl = Get-ItemAcl -Path master:\content\home +Set-ItemAcl -Path master:\content\Settings -AccessRules $acl -PassThru +``` + +### EXAMPLE 2 + +Allows the "sitecore\adam" user to delete the Home item and all of its children. Denies the "sitecore\mikey" user reading the descendants of the Home item. ;P The security info is created prior to setting it to the item. The item is delivered to the Set-ItemAcl from the pipeline and returned to the pipeline after processing due to the -PassThru parameter. Any previuous security information on the item is removed. + +```powershell +$acl1 = New-ItemAcl -AccessRight item:delete -PropagationType Any -SecurityPermission AllowAccess -Identity "sitecore\adam" +$acl2 = New-ItemAcl -AccessRight item:read -PropagationType Descendants -SecurityPermission DenyAccess -Identity "sitecore\mikey" +Get-Item -Path master:\content\home | Set-ItemAcl -AccessRules $acl1, $acl2 -PassThru + +Name Children Languages Id TemplateName +---- -------- --------- -- ------------ +Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item +``` + +### EXAMPLE 3 + +The following applies a new set of AccessRule to an item using `Set-ItemAcl` and `New-ItemAcl` when the PropogationType and SecurityPermission are the same. + +```powershell +$role = "sitecore\yourrole" +$rights = @("item:create", "item:write", "item:rename", "item:delete") + +Get-Item -Path master:\content\youritem | Set-ItemAcl -AccessRules ($rights | ForEach-Object { New-ItemAcl -AccessRight $_ -PropagationType Any -SecurityPermission AllowAccess -Identity $role }) +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Add-ItemAcl](add-itemacl.md) +* [Clear-ItemAcl](clear-itemacl.md) +* [Get-ItemAcl](get-itemacl.md) +* [New-ItemAcl](new-itemacl.md) +* [Test-ItemAcl](test-itemacl.md) +* [https://sdn.sitecore.net/upload/sitecore6/security\_administrators\_cookbook\_a4.pdf](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/61/security_reference-a4.pdf) +* [https://sdn.sitecore.net/upload/sitecore6/64/content\_api\_cookbook\_sc64\_and\_later-a4.pdf](https://sdn.sitecore.net/upload/sitecore6/64/content_api_cookbook_sc64_and_later-a4.pdf) +* [https://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2013/01/sitecore-security-access-rights.aspx](https://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/](https://briancaos.wordpress.com/2009/10/02/assigning-security-to-items-in-sitecore-6-programatically/) + diff --git a/appendix/security/set-user.md b/appendix/security/set-user.md new file mode 100644 index 00000000..82e690b5 --- /dev/null +++ b/appendix/security/set-user.md @@ -0,0 +1,221 @@ +# Set-User + +Sets the Sitecore user properties. + +## Syntax + +Set-User \[-Identity\] <AccountIdentity> \[-IsAdministrator <Boolean>\] \[-Portrait <String>\] \[-Email <String>\] \[-FullName <String>\] \[-Comment <String>\] \[-ProfileItemId <ID>\] \[-StartUrl <String>\] \[-Enabled\] \[-CustomProperties <Hashtable>\] + +Set-User -Instance <User> \[-IsAdministrator <Boolean>\] \[-Portrait <String>\] \[-Email <String>\] \[-FullName <String>\] \[-Comment <String>\] \[-ProfileItemId <ID>\] \[-StartUrl <String>\] \[-Enabled\] \[-CustomProperties <Hashtable>\] + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -IsAdministrator <Boolean> + +Specifies whether the Sitecore user should be classified as an Administrator. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Portrait <String> + +Specifies the Sitecore user portrait image. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Identity <AccountIdentity> + +Specifies the Sitecore user by providing one of the following values. + +```powershell +Local Name + Example: admin + +Fully Qualified Name + Example: sitecore\admi +``` + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Instance <User> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Email <String> + +Specifies the Sitecore user email address. The value is validated for a properly formatted address. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -FullName <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Comment <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ProfileItemId <ID> + +Specifies the profile id to use for the user. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -StartUrl <String> + +Specifies the url to navigate to once the user is logged in. The values are validated with a pretermined set. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Enabled <SwitchParameter> + +Specifies whether the Sitecore user should be enabled. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -CustomProperties <Hashtable> + +Specifies a hashtable of custom properties to assign to the Sitecore user profile. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.String + + Represents the identity of a user. + +Sitecore.Security.Accounts.User Represents the instance of a user. + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* None. + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\> Set-User -Identity michael -Email michaellwest@gmail.com +``` + +### EXAMPLE 2 + +```powershell +PS master:\> "michael","adam","mike" | Set-User -Enable $false +``` + +### EXAMPLE 3 + +```powershell +PS master:\> Get-User -Filter * | Set-User -Comment "Sitecore user" +``` + +### EXAMPLE 4 + +```powershell +PS master:\> Set-User -Identity michael -CustomProperties @{"Date"=(Get-Date)} +PS master:\>(Get-User michael).Profile.GetCustomProperty("Date") + +7/3/2014 4:40:02 PM +``` + +### EXAMPLE 5 + +```powershell +PS master:\> Set-User -Identity michael -IsAdministrator $true -CustomProperties @{"HireDate"="03/17/2010"} +PS master:\>$user = Get-User -Identity michael +PS master:\>$user.Profile.GetCustomProperty("HireDate") + +03/17/2010 +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Get-User](get-user.md) +* [New-User](new-user.md) +* [Remove-User](remove-user.md) +* [Unlock-User](unlock-user.md) + diff --git a/appendix/security/set-userpassword.md b/appendix/security/set-userpassword.md new file mode 100644 index 00000000..5124f5d1 --- /dev/null +++ b/appendix/security/set-userpassword.md @@ -0,0 +1,109 @@ +# Set-UserPassword + +Sets the Sitecore user password. + +## Syntax + +Set-UserPassword \[-Identity\] <AccountIdentity> -OldPassword <String> \[-NewPassword <String>\] + +Set-UserPassword \[-Identity\] <AccountIdentity> -Reset \[-NewPassword <String>\] + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Identity <AccountIdentity> + +Specifies the Sitecore user by providing one of the following values. + +```powershell +Local Name + Example: admin +Fully Qualified Name + Example: sitecore\admin +``` + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -NewPassword <String> + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -OldPassword <String> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Reset <SwitchParameter> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.String + + Represents the identity of a user. + +Sitecore.Security.Accounts.User Represents the instance of a user. + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* None. + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\> Set-UserPassword -Identity michael -NewPassword pass123 -OldPassword b +``` + +### EXAMPLE 2 + +```powershell +PS master:\> "michael","adam","mike" | Set-UserPassword -NewPassword b -Reset +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Get-User](get-user.md) +* [Set-User](set-user.md) + diff --git a/appendix/security/test-account.md b/appendix/security/test-account.md new file mode 100644 index 00000000..c9b5624f --- /dev/null +++ b/appendix/security/test-account.md @@ -0,0 +1,74 @@ +# 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Identity <AccountIdentity> + +Role or User name including domain. If no domain is specified - 'sitecore' will be used as the default value + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -AccountType <String> + +Specifies which account to check existence. + +* All +* Role +* User + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +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 + +```powershell +PS master:\> Test-Account -Identity Michael + +True +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) + diff --git a/appendix/security/test-itemacl.md b/appendix/security/test-itemacl.md new file mode 100644 index 00000000..d0423a43 --- /dev/null +++ b/appendix/security/test-itemacl.md @@ -0,0 +1,182 @@ +# Test-ItemAcl + +Tests a specific access right for a specified user against the provided item + +## Syntax + +Test-ItemAcl -Item <Item> + +Test-ItemAcl -Item <Item> -AccessRight <String> -Identity <AccountIdentity> + +Test-ItemAcl -Path <String> + +Test-ItemAcl -Path <String> -AccessRight <String> -Identity <AccountIdentity> + +Test-ItemAcl -Id <String> + +Test-ItemAcl -Id <String> \[-Database <String>\] -AccessRight <String> -Identity <AccountIdentity> + +## Detailed Description + +Checks if a user can perform an operation on an item. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Item <Item> + +The item to be tested against. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be tested against. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be tested against. Requires the Database parameter to be specified. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be fetched with Id parameter. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -AccessRight <String> + +The access right to grand or deny. Well known rights are: + +* field:read - "Field Read" - controls whether an account can read a specific field on an item.. +* field:write - "Field Write" - controls whether an account can update a specific field on an item. +* item:read - "Read" - controls whether an account can see an item in the content tree and/or on the published Web site, including all of its properties and field values. +* item:write - "Write" - controls whether an account can update field values. The write access right requires the read access right and field read and field write access rights for individual fields \(field read and field write are allowed by default\). +* item:rename - "Rename" - controls whether an account can change the name of an item. The rename access right requires the read access right. +* item:create - "Create" - controls whether an account can create child items. The create access right requires the read access right. +* item:delete - "Delete" - Delete right for items. controls whether an account can delete an item. The delete access right requires the read access right + + Important! + + The Delete command also deletes all child items, even if the account has been denied Delete + + rights for one or more of the subitems. + +* item:admin - "Administer" - controls whether an account can configure access rights on an item. The administer access right requires the read and write access rights. +* language:read - "Language Read" - controls whether a user can read a specific language version of items. +* language:write - "Language Write" - controls whether a user can update a specific language version of items. +* site:enter - controls whether a user can access a specific site. +* insert:show - "Show in Insert" - Determines if the user can see the insert option +* workflowState:delete - "Workflow State Delete" - controls whether a user can delete items which are currently associated with a specific workflow state. +* workflowState:write - "Workflow State Write" - controls whether a user can update items which are currently associated with a specific workflow state. +* workflowCommand:execute - "Workflow Command Execute" - — controls whether a user is shown specific workflow commands. +* profile:customize - "Customize Profile Key Values" - The right to input out of range values of profile keys, that belong to this profile. +* bucket:makebucket - "Create Bucket" - convert item to bucket. +* bucket:unmake - "Revert Bucket" - convert item back from bucket. +* remote:fieldread - "Field Remote Read" - Field Read right for remoted clients. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Identity <AccountIdentity> + +User name including domain for which the access rule is being created. If no domain is specified - 'sitecore' will be used as the default domain. + +Specifies the Sitecore user by providing one of the following values. + +```powershell +Local Name + Example: adam +Fully Qualified Name + Example: sitecore\adam +``` + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Sitecore.Data.Items.Item + +## 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. + +```powershell +PS master:\> $acl = New-ItemAcl -AccessRight item:rename -PropagationType Descendants -SecurityPermission AllowAccess -Identity "sitecore\author2" +PS master:\> Get-Item -Path master:\content\home | Set-ItemAcl -AccessRules $acl + +# Assuming the Home item has one child and author2 does not have rename rights granted above in the tree and is not an administrator +PS master:\> Get-Item master:\content\home | Test-ItemAcl -Identity "sitecore\author2" -AccessRight item:rename +False + +PS master:\> Get-ChildItem master:\content\home | Test-ItemAcl -Identity "sitecore\author2" -AccessRight item:rename +True +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Add-ItemAcl](add-itemacl.md) +* [Clear-ItemAcl](clear-itemacl.md) +* [Get-ItemAcl](get-itemacl.md) +* [New-ItemAcl](new-itemacl.md) +* [Set-ItemAcl](set-itemacl.md) +* [https://sdn.sitecore.net/upload/sitecore6/security\_administrators\_cookbook\_a4.pdf](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/61/security_reference-a4.pdf) +* [https://sdn.sitecore.net/upload/sitecore6/64/content\_api\_cookbook\_sc64\_and\_later-a4.pdf](https://sdn.sitecore.net/upload/sitecore6/64/content_api_cookbook_sc64_and_later-a4.pdf) +* [https://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2013/01/sitecore-security-access-rights.aspx](https://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/](https://briancaos.wordpress.com/2009/10/02/assigning-security-to-items-in-sitecore-6-programatically/) + diff --git a/appendix/security/unlock-item.md b/appendix/security/unlock-item.md new file mode 100644 index 00000000..05db35be --- /dev/null +++ b/appendix/security/unlock-item.md @@ -0,0 +1,124 @@ +# Unlock-Item + +Unlocks the specified Sitecore item. + +## Syntax + +Unlock-Item \[-Item\] <Item> \[-PassThru\] + +Unlock-Item \[-Path\] <String> \[-PassThru\] + +Unlock-Item -Id <String> \[-Database <String>\] \[-PassThru\] + +## Detailed Description + +The Unlock-Item command unlocks the item specified with parameters. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -PassThru <SwitchParameter> + +Passes the unlocked item back into the pipeline. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be unlocked. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be unlocked - can work with Language parameter to specify the language other than current session language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be unlocked. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be fetched with Id parameter. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* can be piped from another cmdlet\* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Only if -PassThru is used\* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Unlock the Home item providing its path + +```powershell +PS master:\> Unlock-Item -Path master:\content\home +``` + +### EXAMPLE 2 + +Unlock the Home item providing it from the pipeline and passing it back to the pipeline + +```powershell +PS master:\> Get-Item -Path master:\content\home | Unlock-Item -PassThru + +Name Children Languages Id TemplateName +---- -------- --------- -- ------------ +Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Lock-Item](https://github.com/sitecorepowershell/sitecore-powershell-extensions/tree/b6365f8ecf54966c2e1757f549f543976500aa52/appendix/commands/Lock-Item.md) +* Get-Item + diff --git a/appendix/security/unlock-user.md b/appendix/security/unlock-user.md new file mode 100644 index 00000000..f306bc3d --- /dev/null +++ b/appendix/security/unlock-user.md @@ -0,0 +1,84 @@ +# Unlock-User + +Unlocks a Sitecore user using the specified criteria. + +## Syntax + +Unlock-User \[-Identity\] <AccountIdentity> + +Unlock-User -Instance <User> + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Identity <AccountIdentity> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Instance <User> + +Specifies the Sitecore user by providing an instance of a user. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.String + + Represents the identity of a user. + +Sitecore.Security.Accounts.User One or more user instances. + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* None. + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\> Unlock-User -Identity michael +``` + +### EXAMPLE 2 + +```powershell +PS master:\> Get-User -Filter * | Unlock-User +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Get-User](get-user.md) +* [New-User](new-user.md) +* [Remove-User](remove-user.md) +* [Set-User](set-user.md) + diff --git a/appendix/security/unprotect-item.md b/appendix/security/unprotect-item.md new file mode 100644 index 00000000..e3d10477 --- /dev/null +++ b/appendix/security/unprotect-item.md @@ -0,0 +1,124 @@ +# Unprotect-Item + +Unprotects the specified Sitecore item. + +## Syntax + +Unprotect-Item \[-Item\] <Item> \[-PassThru\] + +Unprotect-Item \[-Path\] <String> \[-PassThru\] + +Unprotect-Item -Id <String> \[-Database <String>\] \[-PassThru\] + +## Detailed Description + +The Unprotect-Item command removes protection from the item provided to it. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -PassThru <SwitchParameter> + +Passes the unprotected item back into the pipeline. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +The item to be unprotected. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue, ByPropertyName\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the item to be unprotected - can work with Language parameter to specify the language other than current session language. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String> + +Id of the item to be unprotected. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Database <String> + +Database containing the item to be fetched with Id parameter. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* can be piped from another cmdlet\* Sitecore.Data.Items.Item + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Only if -PassThru is used\* Sitecore.Data.Items.Item + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +Unprotect the Home item providing its path + +```powershell +PS master:\> Unprotect-Item -Path master:\content\home +``` + +### EXAMPLE 2 + +Unprotect the Home item providing it from the pipeline and passing it back to the pipeline + +```powershell +PS master:\> Get-Item -Path master:\content\home | Unprotect-Item -PassThru + +Name Children Languages Id TemplateName +---- -------- --------- -- ------------ +Home False {en, ja-JP, de-DE, da} {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Protect-Item](protect-item.md) +* Get-Item + diff --git a/appendix/session.md b/appendix/session/README.md similarity index 84% rename from appendix/session.md rename to appendix/session/README.md index 82193afd..a8f2100a 100644 --- a/appendix/session.md +++ b/appendix/session/README.md @@ -1,2 +1,4 @@ # Session + + diff --git a/appendix/session/get-scriptsession.md b/appendix/session/get-scriptsession.md new file mode 100644 index 00000000..6e298e89 --- /dev/null +++ b/appendix/session/get-scriptsession.md @@ -0,0 +1,128 @@ +# Get-ScriptSession + +Returns the list of PowerShell Extensions script sessions running in the system. + +## Syntax + +Get-ScriptSession -Current \[-SessionType <String\[\]>\] \[-State <None \| Available \| AvailableForNestedCommand \| Busy \| RemoteDebug>\] + +Get-ScriptSession -Id <String\[\]> \[-SessionType <String\[\]>\] \[-State <None \| Available \| AvailableForNestedCommand \| Busy \| RemoteDebug>\] + +Get-ScriptSession -Session <ScriptSession\[\]> \[-SessionType <String\[\]>\] \[-State <None \| Available \| AvailableForNestedCommand \| Busy \| RemoteDebug>\] + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Current <SwitchParameter> + +Returns current script session if the session is run in a background job. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -SessionType <String\[\]> + +Type of the script session to be retrieved. The SessionType is a string that identifies where the session has been launched. You can type one or more session types \(separated by commas\) and use wildcards to filter. To find currently running types of a script session, type "Get-ScriptSession" without parameters. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -State <RunspaceAvailability> + +Type of the script session to be retrieved. The parameter limits script sessions to be returned to only those in a specific state, the values should be "Busy" or "Available". To find states of currently running script sessions, type "Get-ScriptSession" without parameters. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String\[\]> + +Gets the script session with the specified IDs. The ID is a string that uniquely identifies the script session within the server. You can type one or more IDs \(separated by commas\). To find the ID of a script session, type "Get-ScriptSession" without parameters. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Session <ScriptSession\[\]> + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* None + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Spe.Core.Host.ScriptSession + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\>Get-ScriptSession + +Type Key Location Auto Disposed +---- --- -------- ------------- +Console $scriptSession$|zwlyrcmmzwisv22djsv0ej2a|8d5c3e63-3fed-0532-e7c5-761760567b83 False +Context $scriptSession$|zwlyrcmmzwisv22djsv0ej2a|renderingCopySession master:\content\Home False +Context $scriptSession$|zwlyrcmmzwisv22djsv0ej2a|packageBuilder master:\content\Home False +``` + +### EXAMPLE 2 + +```powershell +PS master:\>Get-ScriptSession -Current + +Type Key Location Auto Disposed +---- --- -------- ------------- +Console $scriptSession$|zwlyrcmmzwisv22djsv0ej2a|8d5c3e63-3fed-0532-e7c5-761760567b83 False +``` + +## Related Topics + +* [Receive-ScriptSession](receive-scriptsession.md) +* [Remove-ScriptSession](remove-scriptsession.md) +* [Start-ScriptSession](start-scriptsession.md) +* [Stop-ScriptSession](stop-scriptsession.md) +* [Wait-ScriptSession](wait-scriptsession.md) +* [https://git.io/spe](https://git.io/spe) +* [https://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/](https://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/) + diff --git a/appendix/session/get-session.md b/appendix/session/get-session.md new file mode 100644 index 00000000..fb052bb6 --- /dev/null +++ b/appendix/session/get-session.md @@ -0,0 +1,107 @@ +# Get-Session + +Returns one or more Sitecore user sessions using the specified criteria. + +## Syntax + +Get-Session \[-Identity <AccountIdentity>\] + +Get-Session -InstanceId <String\[\]> + +## 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-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Identity <AccountIdentity> + +Specifies the Sitecore user by providing one of the following values. + +```powershell +Local Name + Example: admin +Fully Qualified Name + Example: sitecore\admi +``` + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -InstanceId <String\[\]> + +Specifies the Sitecore SessionID. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* None. + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Sitecore.Web.Authentication.DomainAccessGuard.Session + + Returns one or more user sessions. + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\> Get-Session + +Created LastRequest SessionID UserName +------- ----------- --------- -------- +7/3/2014 3:30:39 PM 7/3/2014 3:44:27 PM tekipna1lk0ccr2z1bdjsua2 sitecore\admin +7/3/2014 4:13:55 PM 7/3/2014 4:13:55 PM wq4bfivfm2tbgkgdccpyzczp sitecore\michael +``` + +### EXAMPLE 2 + +```powershell +PS master:\> Get-Session -Identity admin + +Created LastRequest SessionID UserName +------- ----------- --------- -------- +7/3/2014 3:30:39 PM 7/3/2014 3:44:27 PM tekipna1lk0ccr2z1bdjsua2 sitecore\admin +``` + +### EXAMPLE 3 + +```powershell +PS master:\> Get-Session -InstanceId tekipna1lk0ccr2z1bdjsua2,wq4bfivfm2tbgkgdccpyzczp + +Created LastRequest SessionID UserName +------- ----------- --------- -------- +7/3/2014 3:30:39 PM 7/3/2014 3:44:27 PM tekipna1lk0ccr2z1bdjsua2 sitecore\admin +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Remove-Session](remove-session.md) + diff --git a/appendix/session/receive-scriptsession.md b/appendix/session/receive-scriptsession.md new file mode 100644 index 00000000..9c2ad1cc --- /dev/null +++ b/appendix/session/receive-scriptsession.md @@ -0,0 +1,108 @@ +# Receive-ScriptSession + +Gets the results of a script session execution. + +## Syntax + +Receive-ScriptSession -Id <String\[\]> \[-KeepResult\] \[-KeepSession\] \[-HostOutput\] + +Receive-ScriptSession -Session <ScriptSession\[\]> \[-KeepResult\] \[-KeepSession\] \[-HostOutput\] + +## Detailed Description + +The Receive-ScriptSession cmdlet gets the results of Windows PowerShell script sessions, such as those started by using the Start-ScriptSession. You can get the results of all script sessions by their ID or by submitting a script session objects. When you start a new script session, the session starts, but the results do not appear immediately. Instead, the command returns an object that represents the script session. The script session object contains useful information about the script session, but it does not contain the results. This method allows you to continue working in the current session while the script session runs. For more information about script sessions in Windows PowerShell, see about\_script sessions. The Receive-ScriptSession cmdlet gets the results that have been generated by the time that the Receive-ScriptSession command is submitted. If the session is not yet complete an error is raised. You can run additional Receive-ScriptSession commands to get the execution results. By default, script session results and the session itself \(unless it is a persistent session\) are deleted from the system when you receive them, but you can use the KeepResult and KeepSession parameters to save the results so that you can receive them again. To delete the script session results, run the Receive-ScriptSession command again \(without the KeepResult parameter\), close the session, or use the Remove-ScriptSession cmdlet to delete the script session from the server. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -KeepResult <SwitchParameter> + +Saves the script session results in the system, even after you have received them. By default, the script session results and the session itself are deleted when they are retrieved. -KeepResult parameter has the -KeepSession parameter implied in its usage. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -KeepSession <SwitchParameter> + +Causes the receiving of the session results to not destroy the session after the cmdlet has executed. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -HostOutput <SwitchParameter> + +Add this parameter to receive the host output content. The result of the command execution will basically be what the session would print if it was interactive. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String\[\]> + +Gets the results of script session with the specified IDs. The ID is a string that uniquely identifies the script session within the server. You can type one or more IDs \(separated by commas\). To find the ID of a script session, type "Get-ScriptSession" without parameters. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Session <ScriptSession\[\]> + +Specifies the script session for which results are being retrieved. Enter a variable that contains the script session or a command that gets the script session. You can also pipe a script session object to Receive-ScriptSession. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +## 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 + +```powershell +The following will return the output from all available script sessions. + +PS master:\> Get-ScriptSession | Receive-ScriptSession +``` + +## Related Topics + +* [https://git.io/spe](https://git.io/spe) + diff --git a/appendix/session/remove-scriptsession.md b/appendix/session/remove-scriptsession.md new file mode 100644 index 00000000..46fee51d --- /dev/null +++ b/appendix/session/remove-scriptsession.md @@ -0,0 +1,72 @@ +# Remove-ScriptSession + +Removes a persistent Script Session from memory. + +## Syntax + +Remove-ScriptSession -Id <String\[\]> + +Remove-ScriptSession -Session <ScriptSession\[\]> + +## Detailed Description + +Removes a persistent Script Session from memory. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Id <String\[\]> + +Id of the PowerShell session to be removed from memory. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Session <ScriptSession\[\]> + +Session to be removed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.String or Spe.Core.Host.ScriptSession + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +The following removes the script session using the specified Id. + +PS master:\> Remove-ScriptSession -Id "Long running script" +``` + +## Related Topics + +* [Get-ScriptSession](get-scriptsession.md) +* [Receive-ScriptSession](receive-scriptsession.md) +* [Start-ScriptSession](start-scriptsession.md) +* [Stop-ScriptSession](stop-scriptsession.md) +* [Wait-ScriptSession](wait-scriptsession.md) +* [https://git.io/spe](https://git.io/spe) +* [https://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/](https://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/) + diff --git a/appendix/session/remove-session.md b/appendix/session/remove-session.md new file mode 100644 index 00000000..35146895 --- /dev/null +++ b/appendix/session/remove-session.md @@ -0,0 +1,77 @@ +# Remove-Session + +Removes one or more Sitecore user sessions. + +## Syntax + +Remove-Session -InstanceId <String\[\]> + +Remove-Session \[-Instance\] <Session> + +## Detailed Description + +The Remove-Session command removes user sessions in Sitecore. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -InstanceId <String\[\]> + +Specifies the Sitecore SessionID. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Instance <Session> + +Specifies the Sitecore user sessions. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | 1 | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* Accepts a user session.\* Sitecore.Web.Authentication.DomainAccessGuard.Sessio + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* None. + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +PS master:\> Remove-Session -InstanceId tekipna1lk0ccr2z1bdjsua2,wq4bfivfm2tbgkgdccpyzczp +``` + +### EXAMPLE 2 + +```powershell +PS master:\> Get-Session -Identity michael | Remove-Session +``` + +## Related Topics + +* [https://github.com/SitecorePowerShell/Console/](https://github.com/SitecorePowerShell/Console/) +* [Get-Session](get-session.md) + diff --git a/appendix/session/start-scriptsession.md b/appendix/session/start-scriptsession.md new file mode 100644 index 00000000..9cf7ab07 --- /dev/null +++ b/appendix/session/start-scriptsession.md @@ -0,0 +1,230 @@ +# Start-ScriptSession + +Starts a new Script Session and executes a script provided in it. + +## Syntax + +Start-ScriptSession -Id <String\[\]> -Item <Item> \[-JobName <String>\] \[-ArgumentList <Hashtable>\] \[-Identity <AccountIdentity>\] \[-DisableSecurity\] \[-AutoDispose\] \[-Interactive\] \[-ContextItem <Item>\] + +Start-ScriptSession -Id <String\[\]> -ScriptBlock <ScriptBlock> \[-JobName <String>\] \[-ArgumentList <Hashtable>\] \[-Identity <AccountIdentity>\] \[-DisableSecurity\] \[-AutoDispose\] \[-Interactive\] \[-ContextItem <Item>\] + +Start-ScriptSession -Id <String\[\]> -Path <String> \[-JobName <String>\] \[-ArgumentList <Hashtable>\] \[-Identity <AccountIdentity>\] \[-DisableSecurity\] \[-AutoDispose\] \[-Interactive\] \[-ContextItem <Item>\] + +Start-ScriptSession -Session <ScriptSession\[\]> -Item <Item> \[-JobName <String>\] \[-ArgumentList <Hashtable>\] \[-Identity <AccountIdentity>\] \[-DisableSecurity\] \[-AutoDispose\] \[-Interactive\] \[-ContextItem <Item>\] + +Start-ScriptSession -Session <ScriptSession\[\]> -ScriptBlock <ScriptBlock> \[-JobName <String>\] \[-ArgumentList <Hashtable>\] \[-Identity <AccountIdentity>\] \[-DisableSecurity\] \[-AutoDispose\] \[-Interactive\] \[-ContextItem <Item>\] + +Start-ScriptSession -Session <ScriptSession\[\]> -Path <String> \[-JobName <String>\] \[-ArgumentList <Hashtable>\] \[-Identity <AccountIdentity>\] \[-DisableSecurity\] \[-AutoDispose\] \[-Interactive\] \[-ContextItem <Item>\] + +Start-ScriptSession -Item <Item> \[-JobName <String>\] \[-ArgumentList <Hashtable>\] \[-Identity <AccountIdentity>\] \[-DisableSecurity\] \[-AutoDispose\] \[-Interactive\] \[-ContextItem <Item>\] + +Start-ScriptSession -Path <String> \[-JobName <String>\] \[-ArgumentList <Hashtable>\] \[-Identity <AccountIdentity>\] \[-DisableSecurity\] \[-AutoDispose\] \[-Interactive\] \[-ContextItem <Item>\] + +Start-ScriptSession -ScriptBlock <ScriptBlock> \[-JobName <String>\] \[-ArgumentList <Hashtable>\] \[-Identity <AccountIdentity>\] \[-DisableSecurity\] \[-AutoDispose\] \[-Interactive\] \[-ContextItem <Item>\] + +## Detailed Description + +Starts a new Script Session and executes a script provided in it. The session can be a background session or if the caller session is interactive providint the -Interactive switch can open a Windowd for the new sessio + +© 2010-2019 Adam Najmanowicz, 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 | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Session <ScriptSession\[\]> + +Specifies the script session in context of which the script should be executed. Enter a variable that contains the script session or a command that gets the script session. You can also pipe a script session object to Start-ScriptSession. If the session is busy at the moment of the call - an error will be raised instead of running the script. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Item <Item> + +Script item containing the code to be executed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Path <String> + +Path to the script item containing the code to be executed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ScriptBlock <ScriptBlock> + +Script to be executed. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -JobName <String> + +Name of the Sitecore job that will run the script session. This can be used to monitor the session progress. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ArgumentList <Hashtable> + +Hashtable with the additional parameters required by the invoked script. The parameters will be instantiated in the session as variables. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Identity <AccountIdentity> + +User name including domain in context of which the script will be executed. If no domain is specified - 'sitecore' will be used as the default value. If user is not specified the current user will be the impersonation context. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -DisableSecurity <SwitchParameter> + +Add this parameter to disable security in the Job running the script session. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -AutoDispose <SwitchParameter> + +Providing this parameter will cause the session to be automatically destroyed after it has executed. Use this parameter if you're not in need of the results of the script execution. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Interactive <SwitchParameter> + +If the new session is run from an interactive session \(e.g. from desktop, menu item, console or ISE\) using this parameter will cause dialog to be shown to the user to monitor the script progress. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -ContextItem <Item> + +Context item for the script session. The script will start in the location of the item. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +## 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. + +* Spe.Core.Host.ScriptSession + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE 1 + +```powershell +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 + +```powershell +The following starts a script that changes its path to "master:\" and sleeps for 4 seconds. The session will persist in memory as no -AutoDispose parameter has been provided. + +Start-ScriptSession -ScriptBlock { cd master:\; Start-Sleep -Seconds 4 } -Id "Background Task" +``` + +## Related Topics + +* [Get-ScriptSession](get-scriptsession.md) +* [Receive-ScriptSession](receive-scriptsession.md) +* [Remove-ScriptSession](remove-scriptsession.md) +* [Stop-ScriptSession](stop-scriptsession.md) +* [Wait-ScriptSession](wait-scriptsession.md) +* [https://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/](https://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/) +* [https://git.io/spe](https://git.io/spe) + diff --git a/appendix/session/stop-scriptsession.md b/appendix/session/stop-scriptsession.md new file mode 100644 index 00000000..19cd6b07 --- /dev/null +++ b/appendix/session/stop-scriptsession.md @@ -0,0 +1,78 @@ +# Stop-ScriptSession + +Stops executing script session. + +## Syntax + +Stop-ScriptSession -Id <String\[\]> + +Stop-ScriptSession -Session <ScriptSession\[\]> + +## Detailed Description + +Aborts the pipeline of a session that is executing. This will stop the session immediately in its next PowerShell command. Caution! If your script is running a long operation in the .net code rather than in PowerShell - the session will abort after the code has finished and the control was returned to the script. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Id <String\[\]> + +Stops the script session with the specified IDs. The ID is a string that uniquely identifies the script session within the server. You can type one or more IDs \(separated by commas\). To find the ID of a script session, type "Get-ScriptSession" without parameters. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Session <ScriptSession\[\]> + +Specifies the script session to be stopped. Enter a variable that contains the script session or a command that gets the script session. You can also pipe a script session object to Receive-ScriptSession. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.String or Spe.Core.Host.ScriptSession + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Spe.Core.Host.ScriptSession + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +The following stops the script session with the specified Id. + +PS master:\> Stop-ScriptSession -Id "My Background Script Session" +``` + +## Related Topics + +* [Get-ScriptSession](get-scriptsession.md) +* [Receive-ScriptSession](receive-scriptsession.md) +* [Remove-ScriptSession](remove-scriptsession.md) +* [Start-ScriptSession](start-scriptsession.md) +* [Wait-ScriptSession](wait-scriptsession.md) +* [https://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/](https://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/) +* [https://git.io/spe](https://git.io/spe) + diff --git a/appendix/session/wait-scriptsession.md b/appendix/session/wait-scriptsession.md new file mode 100644 index 00000000..5f5872d2 --- /dev/null +++ b/appendix/session/wait-scriptsession.md @@ -0,0 +1,100 @@ +# Wait-ScriptSession + +Suppresses script execution command prompt until one or all of the script sessions provided are complete. + +## Syntax + +Wait-ScriptSession -Id <String\[\]> \[-Timeout <Int32>\] \[-Any\] + +Wait-ScriptSession -Session <ScriptSession\[\]> \[-Timeout <Int32>\] \[-Any\] + +## Detailed Description + +The Wait-ScriptSession cmdlet waits for script session to complete before it displays the command prompt or allows the script to continue. You can wait until any script session is complete, or until all script sessions are complete, and you can set a maximum wait time for the script session. When the commands in the script session are complete, Wait-ScriptSession displays the command prompt and returns a script session object so that you can pipe it to another command. You can use Wait-ScriptSession cmdlet to wait for script sessions, such as those that were started by using the Start-ScriptSession cmdlet. + +© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions + +## Parameters + +### -Timeout <Int32> + +The maximum time to wait for all the other running script sessions to complete. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Any <SwitchParameter> + +Returns control to the script or displays the command prompt \(and returns the ScriptSession object\) when any script session completes. By default, Wait-ScriptSession waits until all of the specified jobs are complete before displaying the prompt. + +| Aliases | | +| :--- | :--- | +| Required? | false | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | false | +| Accept Wildcard Characters? | false | + +### -Id <String\[\]> + +Id\(s\) of the session to be stopped. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +### -Session <ScriptSession\[\]> + +Session\(s\) to be stopped. + +| Aliases | | +| :--- | :--- | +| Required? | true | +| Position? | named | +| Default Value | | +| Accept Pipeline Input? | true \(ByValue\) | +| Accept Wildcard Characters? | false | + +## Inputs + +The input type is the type of the objects that you can pipe to the cmdlet. + +* System.String or Spe.Core.Host.ScriptSession + +## Outputs + +The output type is the type of the objects that the cmdlet emits. + +* Spe.Core.Host.ScriptSession + +## Notes + +Help Author: Adam Najmanowicz, Michael West + +## Examples + +### EXAMPLE + +```powershell +PS master:\> Wait-ScriptSession -Id "My Background Script Session" +``` + +## Related Topics + +* [Get-ScriptSession](get-scriptsession.md) +* [Receive-ScriptSession](receive-scriptsession.md) +* [Remove-ScriptSession](remove-scriptsession.md) +* [Start-ScriptSession](start-scriptsession.md) +* [Stop-ScriptSession](stop-scriptsession.md) +* [https://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/](https://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/) +* [https://git.io/spe](https://git.io/spe) + diff --git a/authoring-tasks.md b/authoring-tasks.md deleted file mode 100644 index da6b52ee..00000000 --- a/authoring-tasks.md +++ /dev/null @@ -1,13 +0,0 @@ -# Authoring Tasks - -The Sitecore task scheduler is capable of running PowerShell scripts when using the task command `PowerShellScriptCommand`. The `Task Management` module includes a few shortcuts to managing tasks. - -The module provides the ability to create, edit, and run scheduled tasks. - -![Scheduled Task Menu](/images/screenshots/content-editor/context-menu-task-scheduler.png) - -![Edit Scheduled Task](/images/screenshots/content-editor/context-menu-task-scheduler-edit.png) - -### References - -* [Custom Scheduled Task by Mike Reynolds](http://sitecorejunkie.com/2014/05/31/execute-powershell-scripts-in-scheduled-tasks-using-sitecore-powershell-extensions/) \ No newline at end of file diff --git a/book.json b/book.json index 3eecf502..7d8fa1a9 100644 --- a/book.json +++ b/book.json @@ -3,7 +3,8 @@ "plugins": [ "image-captions", "gist", - "versions" + "versions", + "anchors" ], "pluginsConfig": { "image-captions": { @@ -14,4 +15,4 @@ "includeFilepath": false } } -} \ No newline at end of file +} diff --git a/code-snippets.md b/code-snippets.md deleted file mode 100644 index a7319638..00000000 --- a/code-snippets.md +++ /dev/null @@ -1,51 +0,0 @@ -**Example:** The following demonstrates the use of the **HtmlAgilityPack** for parsing html. - -```powershell -$html = "
  • foo
  • bar
" -$htmlDocument = New-Object -TypeName HtmlAgilityPack.HtmlDocument -$htmlDocument.LoadHtml($html) -foreach($x in $htmlDocument.DocumentNode.SelectNodes("//li")) { - $x.InnerText; -} -``` - -**Example:** The following prints the workflow history of the home item. - -```powershell -$item = Get-Item -Path "master:" -Id "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" - -$db = Get-Database -Name "master" -$workflowProvider = $db.WorkflowProvider - -foreach($version in $item.Versions.GetVersions()) { - $workflowEvents = $workflowProvider.HistoryStore.GetHistory($version) - foreach($workflowEvent in $workflowEvents) { - "[$($workflowEvent.Date)] ($($workflowEvent.User)) $(($workflowEvent.Text -replace '(\r|\n)',''))" - } -} -``` - -**Example:** The following logs messages to the browser console and then alerts the user with a message. - -```powershell -1..5 | ForEach-Object { - Start-Sleep -Seconds 1 - Invoke-JavaScript -Script "console.log('Hello World! Call #$($_) from PowerShell...');" -} - -Invoke-JavaScript -Script "alert('hello from powershell');" -``` -![Invoke JavaScript](images/screenshots/code-snippets/interact-with-browser-using-js.gif) - -**Gist:** Template Complexity Analysis - -{% gist id="https://gist.github.com/AdamNaj/035366c698ef98e1b00a574eb085e790" %}{% endgist %} - -**Gist:** Remote Package Installation - -{% gist id="https://gist.github.com/michaellwest/14e9ef98f9e8b450c1b39813d13cbc50" %}{% endgist %} - -Not seeing what you are looking for? You can always check out some Github Gists that [Adam][1] and [Michael][2] have shared. - -[1]: https://gist.github.com/adamnaj -[2]: https://gist.github.com/michaellwest diff --git a/code-snippets/README.md b/code-snippets/README.md new file mode 100644 index 00000000..57c07ce4 --- /dev/null +++ b/code-snippets/README.md @@ -0,0 +1,196 @@ +--- +description: Useful code snippets to help you with those complex scripts. +--- + +# Code Snippets + +## List fields on template + +**Example:** The following demonstrates how to list all of the fields of a template excluding the Standard Template fields. + +```powershell +# Create a list of field names on the Standard Template. This will help us filter out extraneous fields. +$standardTemplate = Get-Item -Path "master:" -ID "{1930BBEB-7805-471A-A3BE-4858AC7CF696}" +$standardTemplateTemplateItem = [Sitecore.Data.Items.TemplateItem]$standardTemplate +$standardFields = $standardTemplateTemplateItem.OwnFields + $standardTemplateTemplateItem.Fields | Select-Object -ExpandProperty key -Unique + +$itemTemplate = Get-Item -Path "master:" -ID "{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}" +$itemTemplateTemplateItem = [Sitecore.Data.Items.TemplateItem]$itemTemplate +$itemTemplateFields = $itemTemplateTemplateItem.OwnFields + $itemTemplateTemplateItem.Fields | Select-Object -ExpandProperty key -Unique + +$filterFields = $itemTemplateFields | Where-Object { $standardFields -notcontains $_ } | Sort-Object +``` + +## Media item url + +**Example:** The following demonstrates how to generate the public facing url from a media item. + +```powershell +$item = Get-Item -Path "master:{04DAD0FD-DB66-4070-881F-17264CA257E1}" +$siteName = "website" + +$site = [Sitecore.Sites.SiteContextFactory]::GetSiteContext($siteName) +New-UsingBlock (New-Object Sitecore.Sites.SiteContextSwitcher $site) { + [Sitecore.Resources.Media.MediaManager]::GetMediaUrl($item) +} + +# /-/media/default-website/cover.jpg +``` + +## Parse Html + +**Example:** The following demonstrates the use of the **HtmlAgilityPack** for parsing html. + +```powershell +$html = "
  • foo
  • bar
" +$htmlDocument = New-Object -TypeName HtmlAgilityPack.HtmlDocument +$htmlDocument.LoadHtml($html) +foreach($x in $htmlDocument.DocumentNode.SelectNodes("//li")) { + $x.InnerText; +} +``` + +**Example:** The following demonstrates how to update text in the document and exclude certain nodes. + +```powershell +$html = @" +
+
+
kitchen
+ kitchen +
+ +
+
+"@ + +$htmlDocument = New-Object -TypeName HtmlAgilityPack.HtmlDocument +$htmlDocument.LoadHtml($html) +foreach($x in $htmlDocument.DocumentNode.Descendants()) { + if($x.Name -ne "img" -and ![string]::IsNullOrEmpty($x.Text)) { + $x.Text = $x.Text.Replace("kitchen", "sink") + } +} + +$htmlDocument.DocumentNode.OuterHtml +``` + +**Example:** The following demonstrates how to remove empty paragraph tags in an html field. + +[Sitecore Stack Exchanage](https://sitecore.stackexchange.com/a/20845/95) + +**Example:** The following demonstrates removing style attributes from the html. + +```powershell +$html = @" +
Some Text
+"@ + +$htmlDocument = New-Object -TypeName HtmlAgilityPack.HtmlDocument +$htmlDocument.LoadHtml($html) +$nodes = $htmlDocument.DocumentNode.SelectNodes("//@style"); +foreach($node in $nodes) { + $node.Attributes["style"].Remove() +} +$htmlDocument.DocumentNode.OuterHtml +``` + +## Workflow History + +**Example:** The following prints the workflow history of the home item. + +```powershell +$item = Get-Item -Path "master:" -Id "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" + +$db = Get-Database -Name "master" +$workflowProvider = $db.WorkflowProvider + +foreach($version in $item.Versions.GetVersions()) { + $workflowEvents = $workflowProvider.HistoryStore.GetHistory($version) + foreach($workflowEvent in $workflowEvents) { + "[$($workflowEvent.Date)] ($($workflowEvent.User)) $(($workflowEvent.Text -replace '(\r|\n)',''))" + } +} +``` + +## Restore Recycle bin items + +**Example:** The following restores items in the media library that were removed yesterday. [Credit](https://gist.github.com/technomaz/58890edff903123083c77ad8f1b1b2e2) @technomaz. + +```powershell +Write-Host "Restoring items recycled after $($archivedDate.ToShortDateString())" + +foreach($archive in Get-Archive -Name "recyclebin") { + Write-Host " - Found $($archive.GetEntryCount()) entries" + $entries = $archive.GetEntries(0, $archive.GetEntryCount()) + foreach($entry in $entries) { + if($entry.ArchiveLocalDate -ge $archivedDate) { + Write-Host "Restoring item: $($entry.OriginalLocation) {$($entry.ArchivalId)}on date $($entry.ArchiveLocalDate)" + $archive.RestoreItem($entry.ArchivalId) + } else { + Write-Host "Skipping $($entry.OriginalLocation) on date $($entry.ArchiveLocalDate)" + } + } +} +``` + +## Purge Recycle bin items + +**Example:** The following will incrementally purge items from the recycle bin (master db) with a progress counter. + +```powershell +$database = Get-Database -Name "master" +$archiveName = "recyclebin" +$archive = Get-Archive -Database $database -Name $archiveName +$items = Get-ArchiveItem -Archive $archive + +$count = 0 +$total = $items.Count +foreach($item in $items) { + $count++ + if($count % 100 -eq 0) { + Write-Host "[$(Get-Date -Format 'yyyy-MM-dd hh:mm:ss')] $([math]::round($count * 100 / $total, 2))% complete" + } + $item | Remove-ArchiveItem +} +Write-Host "Completed processing recycle bin" +``` + +## Run JavaScript + +**Example:** The following logs messages to the browser console and then alerts the user with a message. + +```powershell +1..5 | ForEach-Object { + Start-Sleep -Seconds 1 + Invoke-JavaScript -Script "console.log('Hello World! Call #$($_) from PowerShell...');" +} + +Invoke-JavaScript -Script "alert('hello from powershell');" +``` + +![Invoke JavaScript](../.gitbook/assets/interact-with-browser-using-js.gif) + +## Remoting + +**Example:** [Remote Package Installation](https://gist.github.com/michaellwest/14e9ef98f9e8b450c1b39813d13cbc50) + +```powershell +Import-Module -Name SPE -Force + +$packageName = "$($SitecorePackageFolder)\[PACKAGE].zip" + +$session = New-ScriptSession -Username "admin" -Password "b" -ConnectionUri "https://remotesitecore" +Test-RemoteConnection -Session $session -Quiet +$jobId = Invoke-RemoteScript -Session $session -ScriptBlock { + [Sitecore.Configuration.Settings+Indexing]::Enabled = $false + Get-SearchIndex | ForEach-Object { Stop-SearchIndex -Name $_.Name } + Import-Package -Path "$($SitecorePackageFolder)\$($using:packageName)" -InstallMode Merge -MergeMode Merge + [Sitecore.Configuration.Settings+Indexing]::Enabled = $true +} -AsJob +Wait-RemoteScriptSession -Session $session -Id $jobId -Delay 5 -Verbose +Stop-ScriptSession -Session $session +``` + +Not seeing what you are looking for? You can always check out some Github Gists that [Adam](https://gist.github.com/adamnaj) and [Michael](https://gist.github.com/michaellwest) have shared or the [Sitecore Stack Exchange](https://sitecore.stackexchange.com/questions/tagged/powershell-extensions). + diff --git a/code-snippets/field-types.md b/code-snippets/field-types.md new file mode 100644 index 00000000..13a06545 --- /dev/null +++ b/code-snippets/field-types.md @@ -0,0 +1,104 @@ +--- +description: Examples for managing complex field types such as MultilistField and NameValueListField. +--- + +# Field Types + +## Edit MultilistField + +**Example:** The following demonstrates how to set a field to a known list of Ids. The Id is already converted to a GUID string. + +```powershell +# Hardcoded list of Ids. +$item.Editing.BeginEdit() +$item["Allowed Controls"] = "{guid1}|{guid2}|{guid3}" +$item.Editing.EndEdit() +``` + +```powershell +# Array of Ids. +$array = [System.Collections.ArrayList]@() +$array.Add({guid1}) > $null +$array.Add({guid2}) > $null +$ids = [System.String]::Join("|", $array) +$item.Editing.BeginEdit() +$item["Allowed Controls"] = $ids +$item.Editing.EndEdit() +``` + +**Example:** The following replaces an instance of an Id with an alternate Id. The Id is already converted to a GUID string. + +```powershell +[Sitecore.Data.Fields.MultilistField]$field = $item.Fields["Allowed Controls"] +$item.Editing.BeginEdit() +$field.Replace("{493B3A83-0FA7-4484-8FC9-4680991CF742}","{493B3A83-0FA7-4484-8FC9-4680991CF743}") +$item.Editing.EndEdit() +``` + +**Example:** The following adds new Ids to an existing list. Makes use of the `Sitecore.Text.ListString` class. + +```powershell +[Sitecore.Text.ListString]$ids = $item.Fields["Rendering"].Value +$ids.AddAt(0,"{guid1}") > $null +$ids.Add("{guid2}") > $null +$ids.Add("{guid3}") > $null + +$item.Editing.BeginEdit() +$item.Fields["Rendering"].Value = $ids.ToString() +$item.Editing.EndEdit() > $null +``` + +**Example:** The following appends an `ID` to a set of items in all languages. It verifies that the field _Keywords_ exists. + +```powershell +$items = Get-ChildItem -Path "master:\sitecore\content\home" -Recurse -Language * +foreach($item in $items) { + if ($item.Keywords -and $item.Keywords.Length -gt 0) { + $item.Keywords = $item.Keywords + "|{guid}" + } else { + $item.Keywords = "{guid}" + } +} +``` + +**Example:** The following example gets all of the items of a `MultilistField` and append a specific `ID`, ensuring that it's delimited with the `|` character. + +```powershell +$items = Get-ChildItem -Path "master:\sitecore\content\home" -Recurse -Language * +foreach($item in $items) { + $item.Keywords = (@() + $item.Keywords.GetItems().ID + "{6D1EACDD-0DE7-4F3D-B55A-2CAE8EBFF3D0}" | Select-Object -Unique) -join "|" +} +``` + +**Example:** The following example extracts the items from a 'keywords' field, comma separates the values, and then outputs to a report. + +```powershell +function Get-KeywordsAsString($item) { + [Sitecore.Data.Fields.MultilistField] $field = $item.Fields["Keywords"] + $items = $field.GetItems() + $strArray = $items | Foreach { $_.DisplayName } + $strArray -join ', ' +} +Get-ChildItem -Path 'master:\content\home\path-to-item' ` + | Show-ListView -Property Name, Language, Version, ID, TemplateName, ItemPath, ` + @{ Label = "KeywordsAsString"; Expression = { Get-KeywordsAsString($_) } } +``` + +## Edit NameValueListField + +**Example:** The following example gets all of the name/value pairs of a `NameValueListField` and appends a new pair. + +```powershell +$item = Get-Item -Path "master:" -ID "{371EEE15-B6F3-423A-BB25-0B5CED860EEA}" + +$nameValues = [System.Web.HttpUtility]::ParseQueryString($item.UrlMapping) + +# Here you can add or remove name/value pairs +$nameValues["^/ab[cde]/$"] = "/somewhere/fun?lang=en" + +foreach($key in $nameValues.AllKeys) { + $nameValues[$key] = [Uri]::EscapeDataString($nameValues[$key]) +} + +$item.UrlMapping = [Sitecore.StringUtil]::NameValuesToString($nameValues,"&") +``` diff --git a/code-snippets/item-links.md b/code-snippets/item-links.md new file mode 100644 index 00000000..a01eaf3a --- /dev/null +++ b/code-snippets/item-links.md @@ -0,0 +1,63 @@ +--- +description: Examples for managing item referrers maintained by the Link Database. +--- + +# Item Links + +### Relink Item + +**Example:** The following changes the image linked on an item to a new image. Originally posted [here](https://gist.github.com/michaellwest/f563b0b3597f6c0a75d6). + +```powershell +$item = Get-Item -Path "master:\media library\images\koala" +$itemNew = Get-Item -Path "master:\media library\images\penguins" +$links = Get-ItemReferrer -Item $item -ItemLink +foreach($link in $links) { + $linkedItem = Get-Item -Path master:\ -ID $link.SourceItemID + $itemField = $linkedItem.Fields[$link.SourceFieldID] + $field = [Sitecore.Data.Fields.FieldTypeManager]::GetField($itemField) + + $linkedItem.Editing.BeginEdit() + $field.Relink($link, $itemNew) + $linkedItem.Editing.EndEdit() | Out-Null +} +``` + +### Remove Item Link + +Example: The following removes an item link followed by removing the item. Originally posted [here](https://gist.github.com/michaellwest/f563b0b3597f6c0a75d6). + +```powershell +# Crafted by Dylan + +function Remove-ItemLink { + param([Item]$item) + + $linkDb = [Sitecore.Globals]::LinkDatabase + + $links = Get-ItemReferrer -Item $item -ItemLink + + foreach($link in $links) { + $linkedItem = Get-Item -Path master:\ -ID $link.SourceItemID + $itemField = $linkedItem.Fields[$link.SourceFieldID] + $field = [Sitecore.Data.Fields.FieldTypeManager]::GetField($itemField) + + $linkedItem.Editing.BeginEdit() + $field.RemoveLink($link) + $linkedItem.Editing.EndEdit() + } +} + +# Example usage: delete items along with their references that have passed a certain date defined by a 'date' field +$today = Get-Date +$todayIsoDate = [Sitecore.DateUtil]::ToIsoDate($today) +$query = "/sitecore/system/Modules/Mysite/Service Schedules/*[@date < '$($todayIsoDate)']" +$itemsToDelete = Get-Item -Path master: -Query $query + +foreach($item in $itemsToDelete) { + Write-Host "Cleaning up $($itemsToDelete.Paths.Path)" + Remove-ItemLink -Item $item + Remove-Item -Path $item.Paths.Path +} +``` + diff --git a/code-snippets/manage-templates.md b/code-snippets/manage-templates.md new file mode 100644 index 00000000..41f94a7d --- /dev/null +++ b/code-snippets/manage-templates.md @@ -0,0 +1,27 @@ +--- +description: Examples for managing item templates. +--- + +# Manage Templates + +## Change Template + +```powershell +# Sample Item +$sourceTemplate = Get-Item -Path "master:\{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}" +# Sample Content +$targetTemplate = Get-Item -Path "master:\{93A8866B-972F-4FBF-8FD9-D6004B18C0AF}" + +# Use Get-ItemReferrer to find all items referencing the template, rather than scanning the content tree. +$sourceTemplate | Get-ItemReferrer | + Where-Object { $PSItem.TemplateId -eq $sourceTemplate.ID -and $PSItem.Paths.IsContentItem } | + ForEach-Object { + Set-ItemTemplate -Item $PSItem -TemplateItem $targetTemplate + } +``` + +# Sitecore Stack Exchange + +The following examples are best kept on SSE since it provides more context about the problem being solved. + +* [Question](https://sitecore.stackexchange.com/a/15168/95) Find all items based on a template found anywhere in the inheritance chain. \ No newline at end of file diff --git a/community.md b/community.md new file mode 100644 index 00000000..b002f29c --- /dev/null +++ b/community.md @@ -0,0 +1,173 @@ +--- +description: See some of the community contributed modules built for SPE. +--- + +# Community + +There are some really amazing contributions and add-ons to SPE from the community. + +## Unicorn + +![SPE + Unicorn](https://user-images.githubusercontent.com/933163/50198867-4053b380-0313-11e9-9e46-5eb5513417ff.png) + +A well known and widely adopted module [Unicorn](https://github.com/SitecoreUnicorn/Unicorn) has published some SPE commands. These commands are available \(and optional\) after installing Unicorn. Below are some samples ripped off from Kam Figy's blog posts [here](https://kamsar.net/index.php/2017/02/Unicorn-4-Preview-Part-2-SPE-Support/) and [here](https://kamsar.net/index.php/2017/02/Unicorn-4-Preview-Part-2-5-Generating-Packages-with-SPE/). + +### Configurations + +**Example:** The following lists configurations by name. + +```powershell +# Default returns all configurations +Get-UnicornConfiguration + +# Exact match +Get-UnicornConfiguration -Filter "Foundation.Foo" + +# Filter using a wildcard +Get-UnicornConfiguration -Filter "Foundation.*" +``` + +### Syncing + +**Example:** The following syncs configurations just like you would through the Unicorn Control Panel or the PowerShell API. + +```powershell +# Sync one +Sync-UnicornConfiguration "Foundation.Foo" + +# Sync multiple by name +Sync-UnicornConfiguration @("Foundation.Foo", "Foundation.Bar") + +# Sync multiple from pipeline +Get-UnicornConfiguration "Foundation.*" | Sync-UnicornConfiguration + +# Sync all, except transparent sync-enabled configurations +Get-UnicornConfiguration | Sync-UnicornConfiguration -SkipTransparent + +# Optionally set log output level (Debug, Info, Warn, Error) +Sync-UnicornConfiguration -LogLevel Warn +``` + +![Example Syncing](https://user-images.githubusercontent.com/933163/50114210-9ccaac00-0209-11e9-9241-2738b50b1f75.png) + +### Partial Syncing + +```powershell +# Sync a single item (note: must be under Unicorn control) +Get-Item "/sitecore/content" | Sync-UnicornItem + +# Sync multiple single items (note: all must be under Unicorn control) +Get-ChildItem "/sitecore/content" | Sync-UnicornItem + +# Sync an entire item tree, show only warnings and errors +Get-Item "/sitecore/content" | Sync-UnicornItem -Recurse -LogLevel Warn +``` + +### Reserializing + +```powershell +# Reserialize one +Export-UnicornConfiguration "Foundation.Foo" + +# Reserialize multiple by name +Export-UnicornConfiguration @("Foundation.Foo", "Foundation.Bar") + +# Reserialize from pipeline +Get-UnicornConfiguration "Foundation.*" | Export-UnicornConfiguration +``` + +### Partial Reserializing + +```powershell +# Reserialize a single item (note: must be under Unicorn control) +Get-Item "/sitecore/content" | Export-UnicornItem + +# Reserialize multiple single items (note: all must be under Unicorn control) +Get-ChildItem "/sitecore/content" | Export-UnicornItem + +# Reserialize an entire item tree +Get-Item "/sitecore/content" | Export-UnicornItem -Recurse +``` + +### Converting to Raw Yaml + +```powershell +# Convert an item to YAML format (always uses default excludes and field formatters) +Get-Item "/sitecore/content" | ConvertTo-RainbowYaml + +# Convert many items to YAML strings +Get-ChildItem "/sitecore/content" | ConvertTo-RainbowYaml + +# Disable all field formats and field filtering +# (e.g. disable XML pretty printing, +# and don't ignore the Revision and Modified fields, etc) +Get-Item "/sitecore/content" | ConvertTo-RainbowYaml -Raw +``` + +![Converting To Yaml](https://user-images.githubusercontent.com/933163/50114470-32663b80-020a-11e9-917c-6707e85524dd.png) + +### Converting from Raw Yaml + +```powershell +# Get IItemDatas from YAML variable +$rawYaml | ConvertFrom-RainbowYaml + +# Get IItemData and disable all field filters +# (use this if you ran ConvertTo-RainbowYaml with -Raw) +$yaml | ConvertFrom-RainbowYaml -Raw +``` + +![Converting from Yaml](https://user-images.githubusercontent.com/933163/50114544-5cb7f900-020a-11e9-90a7-f5b834eb7285.png) + +### Deserialization + +```powershell +# Deserialize IItemDatas from ConvertFrom-RainbowYaml +$rawYaml | ConvertFrom-RainbowYaml | Import-RainbowItem + +# Deserialize raw YAML from pipeline into Sitecore +# Shortcut bypassing ConvertFrom-RainbowYaml +$yaml | Import-RainbowItem + +# Deserialize and disable all field filters +# (use this if you ran ConvertTo-RainbowYaml with -Raw) +$yaml | Import-RainbowItem -Raw + +# Deserialize multiple at once +$yamlStringArray | Import-RainbowItem + +# Complete example that does nothing but eat CPU +Get-ChildItem "/sitecore/content" | ConvertTo-RainbowYaml | Import-RainbowItem +``` + +![Deserialization](https://user-images.githubusercontent.com/933163/50114603-8bce6a80-020a-11e9-8876-2df4d24e5443.png) + +### Packaging + +```powershell +# Create a new Sitecore Package (SPE cmdlet) +$pkg = New-Package -Name MyCustomPackage + +# Get the Unicorn Configuration(s) we want to package +$configs = Get-UnicornConfiguration "Foundation.*" + +# Pipe the configs into New-UnicornItemSource +# to process them and add them to the package project +# (without -Project, this would emit the source object(s) +# which can be manually added with $pkg.Sources.Add()) +$configs | New-UnicornItemSource -Project $pkg + +# Export the package to a zip file on disk +Export-Package -Project $pkg -Path "C:\foo.zip" -Zip +``` + +## SPE Modules + +The following are Sitecore modules that enhance the SPE experience. + +* [SPE Image Importer](https://marketplace.sitecore.net/en/Modules/S/SPE_Image_Uploader_Module10.aspx) : [Himadri Chakrabarti](https://twitter.com/himadric) +* [Multi-Item Publish](https://www.sitecorenutsbolts.net/2015/12/14/Multi-Item-Publish-with-Sitecore-Powershell-Extensions/) : [Richard Seal](https://twitter.com/rich_seal) +* [Publish Status](http://marketplace.sitecore.net/Modules/P/Publish_Status_for_Sitecore_Powershell_Extensions.aspx?sc_lang=en) : [Morten Engel](https://mortenengel.blogspot.com/2018/11/publish-viewercanceler-using-sitecore.html) +* [Westco Pull Up Fields](https://github.com/michaellwest/westco-spe-pullupfields) : [Michael West](https://twitter.com/MichaelWest101) +* [Westco Image Optimizer](https://github.com/michaellwest/westco-spe-imageoptimizer) : [Michael West](https://twitter.com/MichaelWest101) + diff --git a/console.md b/console.md deleted file mode 100644 index 119bd5c6..00000000 --- a/console.md +++ /dev/null @@ -1,33 +0,0 @@ -# Console - -The SPE Console is a command line interface (CLI) designed for efficiency. The console provides a streamlined tool for working with Windows PowerShell and Sitecore. The default configuration for SPE requires the Console to be in an [Elevated Session State](/security.md) before allowing the execution of commands. - -The following figure shows the Console when the User Account Controls (UAC) are disabled. While this is a common configuration for developers, we highly encourage you to ensure UAC is enabled in higher environments. - -[![PowerShell Console](images/screenshots/cli-empty.png)](https://youtu.be/1TLYyzTw01w "Click for a quick demo") - - -### Shortcuts -Below are the shortcuts available in the console. - -| **Shortcut** | **Usage** | -| -------- | ----- | -| TAB | Autocomplete commands. Press tab again to cycle through commands. | -| Up Arrow/Ctrl-P | Show previous command from history | -| Down Arrow/Ctrl-N | Show next command from history | -| Delete/backspace | Remove one character from right/left to the cursor | -| Left Arrow/Ctrl-B | Move cursor to the left | -| Right Arrow/Ctrl-F | Move cursor to the right | -| Ctrl-Left Arrow | Move cursor to previous word | -| Ctrl-Right Arrow | Move cursor to next word | -| Ctrl-A/Home | Move cursor to the beginning of the line | -| Ctrl-E/End | Move cursor to the end of the line | -| Ctrl-K/Ctrl-H | Remove the text after the cursor | -| Ctrl-U | Remove the text before the cursor | -| Ctrl-V | Insert text from the clipboard | -| Ctrl-Alt-Shift + | Increase the font size | -| Ctrl-Alt-Shift - | Decrease the font size | - -**Note:** The font family, font size, and other settings can be configured through the ISE. - -[1]: https://github.com/SitecorePowerShell/Console/issues/314 \ No newline at end of file diff --git a/content-editor.md b/content-editor.md deleted file mode 100644 index 21282038..00000000 --- a/content-editor.md +++ /dev/null @@ -1,99 +0,0 @@ -# Content Editor - -### Context Menu - -The *Context Menu* integration allows for options in the context menu. Rules can be used to control visiblity and enablement. The script is only executed when the option is clicked. - -1. Begin by adding a new script to the *Context Menu* library. The name of the script will appear in the context menu. -2. Edit the script to perform the appropriate actions. The script can run in the background and show dialogs. -3. Change the icon of the item to match the script purpose. -4. Configure any rules as needed. - -**Note:** Examples included in the following modules -* Authoring Instrumentation -* Copy Renderings -* Index On Demand -* Media Library Maintenance -* Package Generator - - ![Package Generator](images/screenshots/content-editor/context-menu-package-generator.png) -* Task Management - -See how Adam added [context menu PowerShell scripts][2]. - -### Gutter - -The *Gutter* integration allows for full flexibility of adding a gutter element. - -1. Begin by adding a new script to the *Gutters* library. -2. Edit the script to create a new instance of `Sitecore.Shell.Applications.ContentEditor.Gutters.GutterIconDescriptor` if the right conditions are met. - * Set the **Icon**, **Tooltip**, and **Click** properties. - * Return the gutter object -3. Rebuild the gutter integration from within the ISE. - * Settings tab - * Integration chunk - * Sync Library with Content Editor Gutter command - -**Note:** Examples included in the following modules -* Publishing Status Gutter - - ![Publishing Status](images/screenshots/content-editor/gutter-publishing-status.png) - -### Insert Item - -The *Insert Item* integration allows for insert options in the context menu. Rules can be used to control visiblity and enablement. The script is only executed when the option is clicked. - -1. Begin by adding a new script to the *Insert Item* library. The name of the script will appear in the context menu. -2. Edit the script to perform the appropriate actions. The script can run in the background and show dialogs. -3. Change the icon of the item to match the script purpose. -4. Configure any rules as needed. - -**Note:** Examples included in the following modules -* Task Management - - ![Insert Scheduled Task](images/screenshots/content-editor/insert-item-powershell-task.png) -* Platform - -### Ribbon - -The *Ribbon* integration allows for commands in the ribbon. Rules can be used to control visiblity and enablement. The script is only executed when the option is clicked. - -1. Begin by adding a new script library to the *Ribbon* library. The name of the script library will appear in the ribbon as the chunk. -2. Add a new script to the chunk script library. The name of the script will appear in the ribbon chunk as a command. -4. Edit the script to perform the appropriate actions. The script can run in the background and show dialogs. -4. Change the icon of the item to match the script purpose. -5. Configure any rules as needed. - -**Example:** The following script gets the selected Context Menu item and displays an alert using the item name. - -```powershell -# Use the notation "." to get the current directory/item. -$item = Get-Item -Path . -Show-Alert -Title $item.Name -``` - -See the birth of [extending the Sitecore ribbon with powershell scripts][1] by Adam. - -Check out an example of the [5 steps to extending the Sitecore ribbon][3] in the wild by Toby. - -### Warning - -The *Warning* integration allows for notifications and commands in the Content Editor. Rules can be used to control visiblity and enablement. The scripts are only executed when the rule is met and the command is clicked. - -1. Begin by adding a new script library to the *Warning* library. -2. Edit the script to perform the appropriate actions. The script can run in the background and show dialogs. -3. The warning notification title, text and icon should be configured in the script. - - Include options to the warning by adding one or more secondary scripts to the script library. -4. Configure any rules as needed. - -**Note:** Examples included in the following modules -* License Expiration - disabled by default - -![License Expiration Warning](images/screenshots/content-editor/warning-notification-for-licensing.png) - -Alan provided a nice example [here][4] on setting up the warning with commands. - -[1]: http://blog.najmanowicz.com/2011/11/24/extending-sitecore-ribbon-with-powershell-scripts/ -[2]: http://blog.najmanowicz.com/2011/11/22/context-powershell-scripts-for-sitecore/ -[3]: https://sitecoresandbox.com/2016/06/03/content-editor-ribbon-buttons-using-sitecore-powershell-extensions/ -[4]: https://alan-null.github.io/2016/04/content-editor-notifications \ No newline at end of file diff --git a/contributor-guide.md b/contributor-guide.md deleted file mode 100644 index 2e2710f6..00000000 --- a/contributor-guide.md +++ /dev/null @@ -1,82 +0,0 @@ -# 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][1] (written March 2015) that goes into great detail about the installation steps, so we went ahead and added it to the book. - -The solution requires Visual Studio 2015. - -### Single Instance - -1. Meet the prerequisites found [here](installation.md) -2. Install Sitecore 8+ to `C:\inetpub\wwwroot\Console` -3. Fetch source code to installation path -``` - cd "C:\inetpub\wwwroot\Console" - git init - git remote add origin https://github.com/SitecorePowerShell/Console.git - git fetch origin - git checkout -b master --track origin/master - ``` -4. Copy `C:\inetpub\wwwroot\Console\deploy.targets.sample` to `C:\inetpub\wwwroot\Console\deploy.targets` -5. Edit the paths in `deploy.targets` with the appropriate *SitecorePath* and *LibrariesPath* -6. Copy Sitecore dependencies to `C:\inetpub\wwwroot\Console\Libraries` - - Sitecore.Analytics.dll - - Sitecore.Client.dll - - Sitecore.ContentSearch.dll - - Sitecore.ContentSearch.Linq.dll - - Sitecore.ExperienceEditor.dll - - Sitecore.Kernel.dll - - Sitecore.Logging.dll - - Sitecore.NVelocity.dll - - Sitecore.Update.dll - - Sitecore.Zip.dll -7. Run the Windows PowerShell script as an Administrator -```powershell -. C:\inetpub\wwwroot\Console\Setup-Folders.ps1 -``` -8. Compile the solution in Visual Studio - - Because SPE supports Sitecore 7+, you'll need to unload the `Cognfide.PowerShell.Sitecore7` project or setup the reference path for Sitecore 7.x libraries. We'll see that later on in this tutorial. -9. Sync Sitecore items with the Windows PowerShell script as an Administrator -``` -. C:\inetpub\wwwroot\Console\Setup-Module.ps1 -``` -10. Navigate to http://console/sitecore/login and verify that SPE works as expected. - -### Multiple Instance - -1. Meet the prerequisites found [here](installation.md) -2. Install Sitecore 7+ to the following paths - - `C:\inetpub\wwwroot\Sitecore8` - - `C:\inetpub\wwwroot\Sitecore75` - - `C:\inetpub\wwwroot\Sitecore70` -3. Fetch source code to installation path -``` - cd "C:\Projects\SitecorePowerShell\" - git init - git remote add origin https://github.com/SitecorePowerShell/Console.git - git fetch origin - git checkout -b master --track origin/master - ``` -4. Copy `C:\Projects\SitecorePowerShell\deploy.targets.sample` to `C:\Projects\SitecorePowerShell\deploy.targets` -5. Edit the paths in `deploy.targets` with the appropriate *SitecorePath* and *LibrariesPath* -6. Copy Sitecore dependencies to `C:\Projects\SitecorePowerShell\Libraries` with a subfolder for each Sitecore version (i.e. \SC8, \SC75, \SC7). Use the reference path in Visual Studio to match the right assembly versions in `Cognifide.PowerShell.Sitecore7` and `Cognifide.PowerShell.Sitecore8`. Not doing so will result in error messages related to those projects. - - Sitecore.Analytics.dll - - Sitecore.Client.dll - - Sitecore.ContentSearch.dll - - Sitecore.ContentSearch.Linq.dll - - Sitecore.ExperienceEditor.dll - - Sitecore.Kernel.dll - - Sitecore.Logging.dll - - Sitecore.NVelocity.dll - - Sitecore.Update.dll -7. Run the Windows PowerShell script as an Administrator. Modifications to the script may be necessary to support your installation paths. -```powershell -. C:\inetpub\wwwroot\Console\Setup-Folders.ps1 -``` -8. Compile the solution in Visual Studio -9. Sync Sitecore items with the Windows PowerShell script as an Administrator. Modifications to the script may be necessary to support your installation urls. -``` -. C:\inetpub\wwwroot\Console\Setup-Module.ps1 -``` -10. Navigate to each of your installation urls and verify that SPE works as expected. - -[1]: http://blog.najmanowicz.com/2015/03/03/set-up-sitecore-powershell-extensions-development-environment/ diff --git a/data-sources.md b/data-sources.md deleted file mode 100644 index c1f03af9..00000000 --- a/data-sources.md +++ /dev/null @@ -1,52 +0,0 @@ -# Data Sources - -Scripted Data Sources provide a way to use a PowerShell script to perform complex queries. - -Here are some good reasons to use this feature: - -- Delivering complex functionality based on multiple criteria. -- Your field may need to provide different set of items to choose from based on: - - user name or role (in simplest case this can be done using right management, but maybe not always possible in a more elaborate scenario) - - current day or month? - - In a multisite/multimarket scenario you may want to show different items for each site -based on engagement analytics parameters of the page -based on where in the tree an item exist (some of it can be done with use of a “query:”) - - anything you might want to build the code data source for… - -Something that would be beyond the reach of a regular Sitecore query and potentially something that you would really need to deliver code source for. But maybe you’re not in a position to deploy that on your environment? - -### Field Data Source - -Field Data Source provides a great opportunity for a script. - -Below are field types you may wish to use a script: - -- Checklist -- Droplist -- Grouped Droplink -- Grouped Droplist -- Multilist -- Name Lookup Value List -- Droplink - - -1. Begin by adding a new script library called *Data Sources* followed by adding a script. You can call it something like *Get-GlobalOption*. - - The script could look something like: `Get-Childitem "master:\" -ID "{EC4CB37D-90FF-4B0C-BEC5-0A3E73A37F27}"`. -2. Add the path to your script in the *Source* field on the data template. The path should be prefixed with `script:`. -``` -script:/sitecore/system/Modules/PowerShell/Script Library/X-Demo/Data Sources/Get-GlobalOption -``` -3. Enjoy the results. - -![](/images/screenshots/data-sources/droplist.png) - -Rendering Data Source - -//TODO - -### References - -* PowerShell Scripted Data Sources [part 1][1] and [part 2][2] - -[1]: http://blog.najmanowicz.com/2013/04/17/powershell-scripted-datasources-in-sitecore-part-1/ -[2]: http://blog.najmanowicz.com/2013/05/06/powershell-scripted-data-sources-in-sitecore-part-2/ \ No newline at end of file diff --git a/disclaimer.md b/disclaimer.md index e01d55f5..8325c2a6 100644 --- a/disclaimer.md +++ b/disclaimer.md @@ -1,7 +1,8 @@ # Disclaimer -The code examples found in this book may not be tested thoroughly enough for a production environment but are provided to demonstrate out a solution to a problem may be approached. Since every environment is different, they should not be run in your production environment without thoroughly testing them first. We recommended that you use a lab environment such as Development/Staging instances of Sitecore for working through the code and configuration examples. +Since every environment is different, all code should not be run in a production environment without your team or organization thoroughly testing first. We recommend the use of a test lab environment often referred to as a development/staging instance of Sitecore. -The disclaimer below is provided because someone somewhere will inevitably not follow this recommendation and in the event that they do hose their Sitecore environment, they have no one to blame but themselves. +The disclaimer is provided because someone somewhere will inevitably not follow this recommendation and if they do hose their Sitecore environment, they have no one to blame but themselves. + +All data and information provided in this book are for informational purposes only. Adam Najmanowicz, Michael West, and the SPE Team make no representations as to accuracy, completeness, currentness, suitability, or validity of any information in this book and will not be liable for any errors, omissions, or delays in this information or any losses, injuries, or damages arising from its display or use. All information found in this book is provided "as is" with no express or implied warranties. -All data and information provided in this book is for informational purposes only. Adam Najmanowicz, Michael West, and the SPE Team make no representations as to accuracy, completeness, currentness, suitability, or validity of any information in this book and will not be liable for any errors, omissions, or delays in this information or any losses, injuries, or damages arising from its display or use. All information is provided on an as-is basis. \ No newline at end of file diff --git a/event-handlers.md b/event-handlers.md deleted file mode 100644 index 31566937..00000000 --- a/event-handlers.md +++ /dev/null @@ -1,2 +0,0 @@ -# Event Handlers - diff --git a/functions.md b/functions.md deleted file mode 100644 index c7c38a26..00000000 --- a/functions.md +++ /dev/null @@ -1,2 +0,0 @@ -# Functions - diff --git a/images/screenshots/content-editor/ribbon-script-button-size.png b/images/screenshots/content-editor/ribbon-script-button-size.png new file mode 100644 index 00000000..28981715 Binary files /dev/null and b/images/screenshots/content-editor/ribbon-script-button-size.png differ diff --git a/images/screenshots/content-editor/ribbon-script-button-size2.png b/images/screenshots/content-editor/ribbon-script-button-size2.png new file mode 100644 index 00000000..8278dc8a Binary files /dev/null and b/images/screenshots/content-editor/ribbon-script-button-size2.png differ diff --git a/images/screenshots/content-editor/ribbon-script-structure.png b/images/screenshots/content-editor/ribbon-script-structure.png new file mode 100644 index 00000000..6d8d1c20 Binary files /dev/null and b/images/screenshots/content-editor/ribbon-script-structure.png differ diff --git a/images/screenshots/event-handlers/README.md b/images/screenshots/event-handlers/README.md new file mode 100644 index 00000000..e69de29b diff --git a/images/screenshots/event-handlers/event-itemadded.png b/images/screenshots/event-handlers/event-itemadded.png new file mode 100644 index 00000000..c7437efc Binary files /dev/null and b/images/screenshots/event-handlers/event-itemadded.png differ diff --git a/images/screenshots/functions/README.md b/images/screenshots/functions/README.md new file mode 100644 index 00000000..e69de29b diff --git a/images/screenshots/functions/module-sharedfunctions.png b/images/screenshots/functions/module-sharedfunctions.png new file mode 100644 index 00000000..88dea2b4 Binary files /dev/null and b/images/screenshots/functions/module-sharedfunctions.png differ diff --git a/images/screenshots/functions/script-importfunction.png b/images/screenshots/functions/script-importfunction.png new file mode 100644 index 00000000..3f79c963 Binary files /dev/null and b/images/screenshots/functions/script-importfunction.png differ diff --git a/images/screenshots/functions/scriptlibrary-sharedfunctions.png b/images/screenshots/functions/scriptlibrary-sharedfunctions.png new file mode 100644 index 00000000..7bc10eb2 Binary files /dev/null and b/images/screenshots/functions/scriptlibrary-sharedfunctions.png differ diff --git a/images/screenshots/get-sitecorejobs-listview.png b/images/screenshots/get-sitecorejobs-listview.png new file mode 100644 index 00000000..0458d1a0 Binary files /dev/null and b/images/screenshots/get-sitecorejobs-listview.png differ diff --git a/images/screenshots/modaldialog-showinput-errortext.png b/images/screenshots/modaldialog-showinput-errortext.png new file mode 100644 index 00000000..dad3bfc0 Binary files /dev/null and b/images/screenshots/modaldialog-showinput-errortext.png differ diff --git a/installation.md b/installation.md deleted file mode 100644 index 6d5163a4..00000000 --- a/installation.md +++ /dev/null @@ -1,40 +0,0 @@ -# Installation - -### Prerequisites - -* Windows 7+ -* Microsoft .NET Framework 4.5.2+ : [Download][2] -* Windows Management Framework 3+ : [Download][3] - * The link provided will get you up to PowerShell 5 - * [Detecting your PowerShell version][7] -* PowerShell [Execution Policy][8] set to `RemoteSigned` - - -### Download the Module - -The SPE module installs like any other for Sitecore. - -[Download][1] the module from the [Sitecore Marketplace][4] and install through the _Installation Wizard_. - -Following the installation you'll find these new items added to the Sitecore menu: -* Sitecore -> [PowerShell Console](console.md) -* Sitecore -> [PowerShell Toolbox](toolbox.md) -* Sitecore -> Development Tools -> [PowerShell ISE](scripting.md) -* Sitecore -> Reporting Tools -> [PowerShell Reports](reports.md) - -### Compile Your Own Binaries - -You may also clone the project from [GitHub][5] and compile it. This allows you to access the latest functionality without waiting for a new release. See the following [contributor guide](contributor-guide.md) for instructions on how to get up and running. - -### Troubleshooting - -See the troubleshooting section [here](troubleshooting.md) - -[1]: https://marketplace.sitecore.net/Modules/Sitecore_PowerShell_console.aspx -[2]: http://www.microsoft.com/en-us/download/details.aspx?id=30653 "Link to version 4.5" -[3]: https://www.microsoft.com/en-us/download/details.aspx?id=50395 "Link to version 5" -[4]: https://marketplace.sitecore.net/ -[5]: https://git.io/spe -[6]: # -[7]: http://stackoverflow.com/questions/1825585/determine-installed-powershell-version -[8]: https://technet.microsoft.com/en-us/library/ee176961.aspx \ No newline at end of file diff --git a/installation/README.md b/installation/README.md new file mode 100644 index 00000000..fce8f086 --- /dev/null +++ b/installation/README.md @@ -0,0 +1,125 @@ +--- +description: Review prerequisites and details on how to get setup with SPE. +--- + +# Installation + +## Prerequisites + +Take a quick look at the [appendix](../appendix/README.md) to see which version of SPE you should be installing that is compatible with your Sitecore environment. Generally SPE has pretty good backwards compatibility but may require a new version to support the latest Sitecore CMS release. + + +* Windows Management Framework 5.1 (PowerShell) is generally available for most Windows environments. +* PowerShell [Execution Policy](https://technet.microsoft.com/en-us/library/ee176961.aspx) set to `RemoteSigned` \(probably optional\) + +{% hint style="info" %} +The release of SPE 6.0 introduced name changes to some files which are now reflected throughout the documentation. Review [issue #1109](https://github.com/SitecorePowerShell/Console/issues/1109) to see the full scope of what changed. Any place where the name _Cognifide_ or _Cognifide.PowerShell_ was used is now replaced with _Spe_. +{% endhint %} + +## Docker + +Working with Docker is going to be the preferred method of installation. + +You can find two flavors of the images: +* [Community Built](https://hub.docker.com/r/sitecorepowershell/sitecore-powershell-extensions) + * Ex: `docker pull sitecorepowershell/sitecore-powershell-extensions:6.4-1809` +* Sitecore Built + * Ex: `docker pull scr.sitecore.com/sxp/modules/sitecore-spe-assets:6.4-1809` + +With this approach, you essentially add a new layer during your image build to include the files from the asset image. Here are some samples of what you can add to your existing setup. Check out Sitecore's samples for additional guidance. + +**docker-compose.yml** + +```text +services: + mssql-init: + image: ${REGISTRY}${COMPOSE_PROJECT_NAME}-xm1-mssql-init:${VERSION:-latest} + build: + context: ./docker/build/mssql-init + args: + BASE_IMAGE: ${SITECORE_DOCKER_REGISTRY}sitecore-xm1-mssql-init:${SITECORE_VERSION} + SPE_IMAGE: ${SITECORE_MODULE_REGISTRY}sitecore-spe-assets:${SPE_VERSION} + cm: + image: ${REGISTRY}${COMPOSE_PROJECT_NAME}-xm1-cm:${VERSION:-latest} + build: + context: ./docker/build/cm + args: + BASE_IMAGE: ${SITECORE_DOCKER_REGISTRY}sitecore-xm1-cm:${SITECORE_VERSION} + SPE_IMAGE: ${SITECORE_MODULE_REGISTRY}sitecore-spe-assets:${SPE_VERSION} +``` + +**Dockerfile (mssql-init)** + +```text +# escape=` + +ARG BASE_IMAGE +ARG SPE_IMAGE + +FROM ${SPE_IMAGE} as spe +FROM ${BASE_IMAGE} + +COPY --from=spe C:\module\db C:\resources\spe +``` + +**Dockerfile (cm)** + +```text +# escape=` + +ARG BASE_IMAGE +ARG SPE_IMAGE + +FROM ${SPE_IMAGE} as spe +FROM ${BASE_IMAGE} + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +WORKDIR /inetpub/wwwroot + +COPY --from=spe \module\cm\content .\ +``` + +## Installation Wizard + +The SPE module installs like any other for Sitecore. This approach is appropriate for installations not within a containerized environment. + +[Download](https://github.com/SitecorePowerShell/Console/releases) the module from the GitHub releases page and install through the _Installation Wizard_. + +* For Sitecore 10.1 and newer along with Identity Server you should enable the provided configuration _Spe.IdentityServer.config_. +* For Sitecore 10.1 and newer you can leverage the IAR packages. There is still the need for *dacpac* deployments because SPE includes a security user and role. + * An additional patch is required for 10.1 to include the location `/sitecore modules/items/`. See [Gist here](https://gist.github.com/michaellwest/87c26d25407b0a8bcfbcabfabedbbdb7). + + + +## Upgrade + +We've tried to make upgrading SPE as seamless as possible. The following should provide you with some basic information on what to expect when upgrading. + +### From 6.x + +You should be able to install directly over the previous installation of 6.0+. + +* For Sitecore 10.1 and newer along with Identity Server you should enable the provided configuration _Spe.IdentityServer.config_. +* For Sitecore 10.1 and newer you can leverage the IAR packages. There is still the need for *dacpac* deployments because SPE includes a security user and role. + * An additional patch is required for 10.1 to include the location `/sitecore modules/items/`. See [Gist here](https://gist.github.com/michaellwest/87c26d25407b0a8bcfbcabfabedbbdb7). + +{% hint style="info" %} +Using packages with the *Items as Resources* (IAR) files will require additional steps to remove database records that correlate with the contents of the _*.dat_ files. Refer to the Sitecore documentation when upgrading for the process to cleanup the databases. [This post](https://www.maartenwillebrands.nl/2022/02/15/sitecore-removing-iar-items-from-the-database/) may be helpful if you wish to take a more precise approach. +{% endhint %} + +### From 5.x and older + +These versions used a different name for the assemblies and configs. You may find it easier to delete all files originally distributed with SPE before installing a newer version. Here are a few steps to consider: + +* Delete all files in the _bin_ and _App_Config/Include_ directories prefixed with *Cognifide*. +* Delete _/sitecore modules/Shell/PowerShell_ +* Delete _/sitecore modules/PowerShell_ + +Reference the original SPE package (if available) to identify if any other files were included. + +Sitecore items in the content tree will potentially shuffle around into their new location. Be sure to backup your custom scripts first. + +## Troubleshooting + +See the troubleshooting section [here](../troubleshooting.md) diff --git a/installation/contributor-guide.md b/installation/contributor-guide.md new file mode 100644 index 00000000..8ad5a31f --- /dev/null +++ b/installation/contributor-guide.md @@ -0,0 +1,85 @@ +# Contributor Guide + +{% hint style="warning" %} +Support for Sitecore 7 has discontinued with SPE 5.0. +{% endhint %} + +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+. + +The solution requires Visual Studio 2015 or later. + +> This guide assumes a source root location of "C:\Source" and a site root location of "C:\inetput\wwwroot". These are not prerequisites of the project, and you can use whatever folder locations suit you. + +## Single Instance for Sitecore 8 & 9 + +1. Meet the prerequisites found [here](./) +2. Install Sitecore 8+ to a folder of your choice, for example `C:\inetpub\wwwroot\SitecoreSPE_8` +3. Clone the repo to your local development environment + + ```powershell + cd "C:\Source\Console" // Your local source folder, with a new folder for the solution + git init + git remote add origin https://github.com/SitecorePowerShell/Console.git + git fetch origin + git checkout -b master --track origin/master + ``` + +4. Copy `C:\Source\Console\deploy.user.json.sample` to `C:\Source\Console\deploy.user.json`. This will be a file just for your local environment and will be ignored by git. +5. Edit the sites definition in `deploy.user.json` to target your Sitecore web root folder, making sure you use double-slashes for paths like in the existing file. For this site, make sure the `version` property is `8`. Remove any other sites in the file that do not apply. + + > The `deploy.user.json` file supports deploying SPE to multiple Sitecore installations. For now, we are just deploying to a single instance, but later on in the tutorial we will cover multiple instances. + +6. Copy `C:\Source\Console\UserConfiguration\App_Config\Include\z.Spe.Development.User.config.sample` to a file of the same name, without the `.sample` suffix. This file can be edited to add any SPE-specific configuration that you want in your sites, but don't wish to commit back into the repo. + + > You may notice there is a %%sourceFolder%% value in this configuration file. This is a special string that gets replaced as part of the SPE deployment with your source folder location. You don't need to update this manually. + +7. Open the solution in Visual Studio. +8. Compile the solution. Whenever you compile the solution, SPE will be automatically deployed to the site web root paths you have set in `deploy.user.json` +9. Login to Sitecore +10. Navigate to `/Unicorn.aspx`. Use Unicorn to sync all projects into Sitecore. + + > SPE uses Unicorn for serializing Sitecore items to the source folder, and for syncing items from disk into Sitecore. For more information on Unicorn, see [https://github.com/kamsar/Unicorn](https://github.com/kamsar/Unicorn) + +11. SPE is now installed in Sitecore and you're ready for developing! + +Any changes you make going foward just require a build of the solution. Remember that when pulling down updates to the source, you should execute a Unicorn sync to ensure your items are up to date. + +## Multiple Instances + +The SPE deployment process supports multiple sites and multiple versions of Sitecore. The following steps carry on from above to add further support for another Sitecore site, such as 8.x or 9.x. + +1. Complete the steps for a Single Instance. +2. Install Sitecore 8.x/9.x to a folder of your choice, for example `C:\inetpub\wwwroot\SitecoreSPE_91` +3. Edit the sites definition in `deploy.user.json` to add your new Sitecore web root folder. Set the `version` property to `9.0`, `9.1` or `9.2` depending on the major/minor version. +4. Follow steps 7 onward from the **Single Instance** guide above to deploy to your Sitecore 8.x/9.x installation and sync the SPE items into Sitecore. + +> SPE can be deployed to as many Sitecore sites as you like. Each time you first deploy to a new installation, make sure you use Unicorn to sync the latest state of items into Sitecore. + +## Optional: PowerShell Remoting support + +To add the SPE PowerShell Remoting Module scripts into your machine's PowerShell Module path, execute the `.\Setup_Module.ps1` script from the source folder. This will add the `\Modules` folder from source into your `PSModulePath` environment variable. Once this is done, you can use `Import-Module SPE` on your development machine to run the remoting scripts. + +## Optional: Junction Support + +As part of the SPE deployment process, all of the relevant binary, configuration and sitecore module files are copied over from the projects within the solution. This means that any changes to static files such as JS / CSS files require a full build for these to be deployed to the site. As the build triggers an application pool recycle of your site, this can be a little slow for quick changes. + +For more rapid development, you can enable junction deployment on your sites. When this is enabled, rather than copying over the static files, [junction points](https://en.wikipedia.org/wiki/NTFS_junction_point) will be setup for various folders so that the folders within the Sitecore installation are _directly linked_ to the source folder. Any changes made in the solution are seen instantly, because the solution and the site are referencing _the exact same files_. + +To enable a junction deployment for a site, add `junction` property to the site definition and set it to `true`: + +```json +{ + "sites": [ + { + "path": "C:\\inetput\\wwwroot\\SitecoreSPE_8\\Website", + "version": 8, + "junction": true + } + ] +} +``` + +> Note that with junction deployments, a solution build is still required if you want to deploy any code or `.config` changes. +> +> It is not currently supported for a junction deployment site to be changed back into a non-junction deployment site. If you wish to do this, you should manually delete the following folders from your Sitecore installation before updating the `junction` property back to `false`: `sitecore modules\PowerShell` and `sitecore modules\Shell\PowerShell` + diff --git a/integration-points.md b/integration-points.md deleted file mode 100644 index 0ec78f46..00000000 --- a/integration-points.md +++ /dev/null @@ -1,41 +0,0 @@ -# Integration Points - -The SPE Modules support a wide variety of predefined script libraries to help with exposing scripts to the Sitecore interface. - -The following list outlines the available libraries for *Integration Points* that may be added to modules. These may also be generated automatically when creating or updating modules. - -**Note:** Be certain to enable the module when you need to use it. - -* **[Content Editor](content-editor.md)** - * Context Menu - Visibility can be control using rules made available from within the *Interactive* field section. - * Gutters - Requires the library to be synced. - * Insert Item - Visibility can be control using rules made available from within the *Interactive* field section. - * Ribbon - Requires the library to be synced. Visibility can be control using rules made available from within the *Interactive* field section. - * Warning - Appears as a warning message beneath the ribbon in the *Content Editor*. -* **[Control Panel](control-panel.md)** - Requires the library to be synced. -* **[Data Sources](date-sources.md)** - Not a formal integration point library, but a good place to add scripts used for Data Source Scripts. Read more about how they work [here][3] and [here][4]. The *Source* field simply references the script like *script:/sitecore/system/Modules/PowerShell/Script Library/[MODULE NAME]/Data Sources/[SCRIPT NAME]*. -* **[Event Handlers](event-handlers.md)** - Requires a patch file to enable the desired events. Read more about it [here][2]. -* **[Functions](functions.md)** - Exposes scripts to the command *Import-Function*. -* **Internal** - * ISE Plugins - Appears as a button in the ISE *Settings* tab. - * List View - Represents the ribbon buttons such as for **Actions** and **Exports**. -* **[Page Editor](page-editor.md)** (Experience Editor) - * Notification - Appears as a notification message beneath the ribbon in the *Experience Editor*. -* **[Pipelines](pipelines.md)** - * LoggedIn - * LoggingIn - * Logout -* **[Reports](reports.md)** - Appears as a shortcut under *Sitecore -> Reporting Tools -> PowerShell Reports*. -* **[Toolbox](toolbox.md)** - Appears as a shortcut under *Sitecore -> Toolbox*. Visibility can be control using rules made available from within the *Interactive* field section. -* **[Tasks](tasks.md)** - Not a formal integration point library, but a good place to add scripts used for Scheduled Tasks. SPE includes a `PowerShellScriptCommand` found under */sitecore/system/Tasks/Commands/PowerShellScriptCommand* which is used to run scripts from within scheduled tasks. -* **[Web API](web-api.md)** - Exposes scripts than can be consumed through [SPE Remoting](remoting.md). The script can be executed by requesting a specific url. -* **[Workflows](workflows.md)** - Not a formal integration point library, but a good place to add scripts used for Workflow Action Scripts. Read more about how they work [here][1]. - -### Other Integrations - -* **Remoting** - Interact with SPE through the provided web services as described [here](remoting.md). A Windows PowerShell module is made available to encapsulate the web service calls into PowerShell commands. - -[1]: http://blog.najmanowicz.com/2014/11/09/introducing-powershell-actions-for-sitecore-workflows/ -[2]: http://blog.najmanowicz.com/2013/05/27/react-to-sitecore-events-with-powershell-scripts/ -[3]: http://blog.najmanowicz.com/2013/04/17/powershell-scripted-datasources-in-sitecore-part-1/ -[4]: http://blog.najmanowicz.com/2013/05/06/powershell-scripted-data-sources-in-sitecore-part-2/ \ No newline at end of file diff --git a/interfaces.md b/interfaces.md deleted file mode 100644 index 1258596f..00000000 --- a/interfaces.md +++ /dev/null @@ -1,49 +0,0 @@ -# Interfaces - -Here we'll discuss the Console, ISE, and other dialogs made available through SPE. - -[![The Sitecore PowerShell Console is a command line interface that many power users find great for quickly running commands.](images/screenshots/cli-empty.png)](https://youtu.be/1TLYyzTw01w "Click for a quick demo") - -[![The Sitecore PowerShell ISE is a scripting interface for running commands and authoring scripts.](images/screenshots/ise-empty.png)](http://youtu.be/RCDprfRsbSU "Click for a quick demo") - -### Providers -You can interact with the providers typically available in the standard Windows PowerShell Console. Below are some of the important providers. Run the command ` Get-PSProvider ` to see the complete list. - * **FileSystem** - Supports interacting with files and folders. - * **CmsItemProvider** - Supports interacting with the Sitecore content items. - -The console prompt typically begins with ` PS master:\> `. The present working directory is using the *CmsItemProvider* and set to the *master* database. - - **Example:** Change directories between providers. - ```powershell - 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][1]. - -### 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\ | -| HostSettings | ...
FontSize : 12
FontFamily : Wingdings
... | -| me | sitecore\admin | -| PWD | master:\ | -| ScriptSession | ...
ID : e9fedd64-cad0-4c43-b950-9cd361b151fd
... | -| SitecoreAuthority | https://console | -| 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 | -| SitecoreScriptRoot | master:\system\Modules\PowerShell\Script Library\Task Management\Toolbox | -| SitecoreCommandPath | master:\system\Modules\PowerShell\Script Library\Task Management\Toolbox\Task Manager | -| SitecoreSerializationFolder | C:\Inetpub\wwwroot\Console\Data\serialization | -| SitecoreTempFolder | C:\Inetpub\wwwroot\Console\Website\temp | -| SitecoreVersion | 8.2.160729 | - - **Note:** Any new variables created are stored within the session of console instance; when the session ends the variables are removed. You'll also need to be careful not to overwrite the built-in variables. diff --git a/interfaces/README.md b/interfaces/README.md new file mode 100644 index 00000000..3c85dc02 --- /dev/null +++ b/interfaces/README.md @@ -0,0 +1,12 @@ +--- +description: SPE includes several built-in interfaces for managing and executing scripts, as well as provides tools for modifying content. +--- + +# Interfaces + +Here we'll discuss the Console, ISE, and other dialogs made available through SPE. + +![The Sitecore PowerShell Console is a command line interface that many power users find great for quickly running commands.](../.gitbook/assets/cli-empty.png) + +![The Sitecore PowerShell ISE is a scripting interface for running commands and authoring scripts.](../.gitbook/assets/ise-empty.png) + diff --git a/interfaces/console.md b/interfaces/console.md new file mode 100644 index 00000000..410b431a --- /dev/null +++ b/interfaces/console.md @@ -0,0 +1,41 @@ +# Console + +The Console is a command line interface \(CLI\) designed for efficiency, providing a streamlined tool for working with Windows PowerShell and Sitecore. + +The default security configuration for SPE requires the Console to be in an [Elevated Session State](../security/) before allowing the execution of commands. The following figure shows the Console when the User Account Controls \(UAC\) are disabled. While this is a common configuration for developers, we highly encourage you to ensure UAC is enabled in higher environments. + +![PowerShell Console](../.gitbook/assets/cli-empty%20%281%29.png) + +## Shortcuts + +Below are the shortcuts available in the console. + +| **Shortcut** | **Usage** | +| :--- | :--- | +| Enter | Submits line for execution. | +| Tab | Autocomplete commands. Press tab again to cycle through commands. | +| Shift+Tab | Reverse cycle through Autocomplete commands. | +| Shift+Enter | Inserts new line. Works when the backtick is used. | +| ArrowUp/Ctrl+P | Show previous command from history | +| ArrowDown/Ctrl+N | Show next command from history | +| Delete/backspace | Remove one character from right/left to the cursor | +| ArrowLeft/Ctrl+B | Move cursor to the left | +| ArrowRight/Ctrl+F | Move cursor to the right | +| Ctrl+ArrowLeft | Move cursor to previous word | +| Ctrl+ArrowRight | Move cursor to next word | +| Ctrl+A/Home | Move cursor to the beginning of the line | +| Ctrl+E/End | Move cursor to the end of the line | +| Ctrl+K/Alt+D | Remove the text after the cursor | +| Ctrl+H | Remove character before the cursor | +| Ctrl+D/Delete | Remove character selected by the cursor | +| Ctrl+C/Escape | Remove all text in the line | +| Ctrl+U | Remove the text before the cursor | +| Ctrl+V/Shift+Insert | Insert text from the clipboard | +| Ctrl+Alt+Shift + | Increase the font size | +| Ctrl+Alt+Shift - | Decrease the font size | +| PageUp | Scroll console up | +| PageDown | Scroll console down | +| Ctrl+R | Reverse search history | + +**Note:** The font family, font size, and other settings can be configured through the ISE. + diff --git a/interfaces/help.md b/interfaces/help.md new file mode 100644 index 00000000..8031bd55 --- /dev/null +++ b/interfaces/help.md @@ -0,0 +1,79 @@ +# Help + +There are multiple methods of accessing help documentation in SPE to provide you with information on the commands available to you. + +## Viewing all available commands + +A report is available which will show you all available SPE commands: + +![Accessing the report](../.gitbook/assets/reports-commands.png) + +When executed, this report provides a paged view of the SPE commands. + +![Paged results of commands](../.gitbook/assets/reports-commands-result.png) + +## Viewing command help + +### Console + +To display the available help for a command in the Console, simply use the Get-Help command: + +```powershell +Get-Help Get-Rendering +``` + +For full documentation, including examples, use the `-Full` parameter: + +```powershell +Get-Help Get-Rendering -Full +``` + +### ISE + +Through the Integrated Scripting Environment \(ISE\), SPE provides a method of acccessing help for available commands. To view the help for a command, simply highlight the command and press Ctrl + Enter. + +![Highlight the command and press Ctrl + Enter](../.gitbook/assets/ise-help-select.png) + +After doing this, a dialog will appear with the relevant help information: + +![A help dialog for Get-Rendering](../.gitbook/assets/ise-help-dialog.png) + +## Documenting functions + +When writing scripts, you are able to include formatted comments that will be used to provide help text for functions. If formatted correctly, this help text will be available through the methods described above. + +**Example:** A simple function with documentation: + +```powershell +<# + .SYNOPSIS + A short synopsis of this function. + .DESCRIPTION + A much more detailed description of this function, which outputs a value. + .PARAMETER Value + The value that will be output + .EXAMPLE + PS> Output-Value "My value" + My value +#> +Function Output-String +{ + param( + [string]$value + ) + + Write-Host $value +} +``` + +Once the script containing this function has been invoked, the help text will be available: + +```powershell +Get-Help Output-String +``` + +For further information on comment-based help, refer to the [official PowerShell documentation](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help). + +## Online appendix + +Online help is additionaly available for all SPE commands in this documentation, with detailed explanations of commands and their parameters, along with useful examples. These can be found in the [Command Appendix](../appendix). \ No newline at end of file diff --git a/interactive-dialogs.md b/interfaces/interactive-dialogs.md similarity index 59% rename from interactive-dialogs.md rename to interfaces/interactive-dialogs.md index 9a8f9f5e..8f7ec0b3 100644 --- a/interactive-dialogs.md +++ b/interfaces/interactive-dialogs.md @@ -8,47 +8,64 @@ Simple in the sense that the dialogs present the user with a short message and o ### Alert -The *Alert* dialog is a way to notify the user of important information with an "OK" button. +The _Alert_ dialog is a way to notify the user of important information with an "OK" button. **Example:** The following display a modal dialog. + ```powershell Show-Alert -Title "SPE is great!" ``` No return value. -![Show Alert](images/screenshots/modaldialog-showalert.png) +![Show Alert](../.gitbook/assets/modaldialog-showalert.png) ### Confirmation -The *Confirmation* dialog is a way to verify with the user before proceeding. +The _Confirmation_ dialog is a way to verify with the user before proceeding. **Example:** The following displays a modal dialog with an OK or Cancel confirmation. + ```powershell Show-Confirm -Title "Click OK to acknowledge SPE is great!" ``` | Button Name | Return Value | -| -- | -- | +| :--- | :--- | | OK | yes | | Cancel | no | -![Show Confirm](images/screenshots/modaldialog-showconfirm.png) +![Show Confirm](../.gitbook/assets/modaldialog-showconfirm.png) ### User Input **Example:** The following displays an input dialog for text. + ```powershell Show-Input "Please provide 5 characters at most" -MaxLength 5 ``` | Button Name | Return Value | -| -- | -- | -| OK | < user input > | +| :--- | :--- | +| OK | < user input > | | Cancel | $null | +![Show Input](../.gitbook/assets/modaldialog-showinput.png) + +**Example:** The following displays an input dialog with a error validation message. + +```powershell +$inputProps = @{ + Prompt = "Enter a new name for the item:" + Validation = [Sitecore.Configuration.Settings]::ItemNameValidation + ErrorMessage = "'`$Input' is not a valid name." + MaxLength = [Sitecore.Configuration.Settings]::MaxItemNameLength +} + +Show-Input @inputProps +``` -![Show Input](images/screenshots/modaldialog-showinput.png) +![Show Input](../.gitbook/assets/modaldialog-showinput-errortext.png) ## Advanced Dialogs @@ -58,7 +75,8 @@ The `Read-Variable` command provides a way to prompt the user for information an **Example:** The following displays a dialog with a dropdown. -**Note:** The name *selectedOption* will result in a variable that contains the selected option. +**Note:** The name _selectedOption_ will result in a variable that contains the selected option. + ```powershell $options = @{ "A"="a" @@ -80,110 +98,129 @@ Read-Variable @props ``` | Button Name | Return Value | -| -- | -- | +| :--- | :--- | | OK | ok | | Cancel | cancel | -| < variables > | < selection > | +| < variables > | < selection > | -![Read Variable](images/screenshots/modaldialog-readvariable.png) +![Read Variable](../.gitbook/assets/modaldialog-readvariable.png) **Supported Parameter Values** | Key | Type | Description | Example | -| -- | -- | -- | -- | +| :--- | :--- | :--- | :--- | | Name | string | Variable name | isSilent | | Value | bool string int float datetime Item | Default value | $true | | Title | string | Header or Label | "Proceed Silently | -| Tooltip (optional) | string | Short description or tooltip | "Check to run quietly | -| Tab (optional) | string | Tab title | "Simple" | -| Placeholder (optional) | string | Textbox placeholder | "Search text..." | -| Lines (optional) | int | Line count | 3 | -| Editor (optional) | string | Control type | "date time" | -| Domain (optional) | string | Domain name for security editor | "sitecore" | -| Options (optional) | string OrderedDictionary Hashtable | Data for checklist or dropdown | @{"Monday"=1;"Tuesday"=2} | +| Tooltip \(optional\) | string | Short description or tooltip | "Check to run quietly | +| Tab \(optional\) | string | Tab title | "Simple" | +| Placeholder \(optional\) | string | Textbox placeholder | "Search text..." | +| Lines \(optional\) | int | Line count | 3 | +| Editor \(optional\) | string | Control type | "date time" | +| Domain \(optional\) | string | Domain name for security editor | "sitecore" | +| Options \(optional\) | string OrderedDictionary Hashtable | Data for checklist or dropdown | @{"Monday"=1;"Tuesday"=2} | | Columns | int string | Number between 1 and 12 and string 'first' or 'last' | 6 first | **Editor Types** + * bool * check * date * date time * droplist * droptree +* email +* groupeddroplink +* groupeddroplist * info +* item +* link +* marquee * multilist +* multilist search * multiple user * multiple user role * multiple role +* multitext +* number +* pass * radio * rule +* rule action +* tree * treelist +* tristate * time - ### Confirmation Choice -The *Confirmation Choice* dialog allows for multiple combinations like that seen with a "Yes, Yes to all, No, No to all" scenario. +The _Confirmation Choice_ dialog allows for multiple combinations like that seen with a "Yes, Yes to all, No, No to all" scenario. **Example:** The following displays a modal dialog with choices. + ```powershell -Show-ModalDialog -Control "ConfirmChoice" -Parameters @{btn_0="Yes (returns btn_0)"; btn_1="No (returns btn_1)"; btn_2="returns btn_2"; te="Have you downloaded SPE?"; cp="Important Questions"} -Height 120 -Width 400 +Show-ModalDialog -Control "ConfirmChoice" -Parameters @{btn_0="Yes - returns btn_0"; btn_1="No - returns btn_1"; btn_2="returns btn_2"; te="Have you downloaded SPE?"; cp="Important Questions"} -Height 120 -Width 650 ``` -**Note:** The hashtable keys should be incremented like *btn_0*, *btn_1*, and so on. The return value is the key name. +**Note:** The hashtable keys should be incremented like _btn\_0_, _btn\_1_, and so on. The return value is the key name. | Button Name | Return Value | -| -- | -- | -| < first button > | btn_0 | -| < second button > | btn_1 | -| < third button > | btn_2 | +| :--- | :--- | +| < first button > | btn\_0 | +| < second button > | btn\_1 | +| < third button > | btn\_2 | -![Show Confirm Choice](images/screenshots/modaldialog-showconfirmchoice.png) +![Show Confirm Choice](../.gitbook/assets/modaldialog-showconfirmchoice.png) ### Upload -The *Upload* dialog provides a way to upload files from a local filesystem to the media library or server filesystem. +The _Upload_ dialog provides a way to upload files from a local filesystem to the media library or server filesystem. **Example:** The following displays an advanced upload dialog. + ```powershell Receive-File (Get-Item "master:\media library\Files") -AdvancedDialog ``` + No return value. -![Receive File](images/screenshots/modaldialog-receivefileadvanced.png) +![Receive File](../.gitbook/assets/modaldialog-receivefileadvanced.png) ### Download -The *Download* dialog provides a way to download files from the server to a local filesystem. +The _Download_ dialog provides a way to download files from the server to a local filesystem. **Example:** The following displays a download dialog. + ```powershell Get-Item -Path "master:\media library\Files\readme" | Send-File ``` -![Download](images/screenshots/modaldialog-download.png) +![Download](../.gitbook/assets/modaldialog-download.png) ### Field Editor -The *Field Editor* dialog offers a convenient way to present the user with fields to edit. +The _Field Editor_ dialog offers a convenient way to present the user with fields to edit. **Example:** The following displays a field editor dialog. + ```powershell Get-Item "master:\content\home" | Show-FieldEditor -Name "*" -PreserveSections ``` | Button Name | Return Value | -| -- | -- | +| :--- | :--- | | OK | ok | | Cancel | cancel | -![Show Field Editor](images/screenshots/modaldialog-showfieldeditor.png) +![Show Field Editor](../.gitbook/assets/modaldialog-showfieldeditor.png) ### File Browser -The *File Browser* is an obvious choice when you need to upload, download, or delete files. +The _File Browser_ is an obvious choice when you need to upload, download, or delete files. **Example:** The following displays a file browser dialog for installation packages. + ```powershell Show-ModalDialog -HandleParameters @{ "h"="Create an Anti-Package"; @@ -197,13 +234,14 @@ Show-ModalDialog -HandleParameters @{ ``` | Button Name | Return Value | -| -- | -- | -| OK | < selected file > | +| :--- | :--- | +| OK | < selected file > | | Cancel | undetermined | -![Show File Browser](images/screenshots/modaldialog-showfilebrowser.png) +![Show File Browser](../.gitbook/assets/modaldialog-showfilebrowser.png) **Example:** The following displays a simple file browser dialog. + ```powershell Show-ModalDialog -HandleParameters @{ "h"="FileBrowser"; @@ -211,15 +249,16 @@ Show-ModalDialog -HandleParameters @{ ``` | Button Name | Return Value | -| -- | -- | -| OK | < selected file > | +| :--- | :--- | +| OK | < selected file > | | Cancel | undetermined | -![Show File Browser](images/screenshots/modaldialog-simplefilebrowser.png) +![Show File Browser](../.gitbook/assets/modaldialog-simplefilebrowser.png) **Example:** The following displays a Sheer UI control without any additional parameters. + ```powershell -Show-ModalDialog -Control "ControlPanel" +Show-ModalDialog -Control "SetIcon" ``` ### Data List @@ -227,17 +266,19 @@ Show-ModalDialog -Control "ControlPanel" The "Data List" is essentially a report viewer which supports custom actions, exporting, and filtering. **Example:** The following displays a list view dialog with the child items under the Sitecore tree. + ```powershell Get-Item -Path master:\* | Show-ListView -Property Name, DisplayName, ProviderPath, TemplateName, Language ``` -![Show List View](images/screenshots/modaldialog-showlistview.png) +![Show List View](../.gitbook/assets/modaldialog-showlistview.png) ### Results -The *Results* dialog resembles the Console but does not provide a prompt to the user. This is useful for when logging messages. +The _Results_ dialog resembles the Console but does not provide a prompt to the user. This is useful for when logging messages. **Example:** The following displays a dialog with the all the information written to the ScriptSession output buffer. + ```powershell for($i = 0; $i -lt 10; $i++) { Write-Verbose "Index = $($i)" -Verbose @@ -246,4 +287,5 @@ for($i = 0; $i -lt 10; $i++) { Show-Result -Text ``` -![Show Result Text](images/screenshots/modaldialog-showresulttext.png) \ No newline at end of file +![Show Result Text](../.gitbook/assets/modaldialog-showresulttext.png) + diff --git a/interface-configuration.md b/interfaces/interface-configuration.md similarity index 84% rename from interface-configuration.md rename to interfaces/interface-configuration.md index 3d11e7d1..20e5758b 100644 --- a/interface-configuration.md +++ b/interfaces/interface-configuration.md @@ -1,8 +1,8 @@ # Interface Configuration -### Colors +## Colors -The Console, ISE, and Result dialog all provide a way a way to view output data. The `$host` variable provides access to configuring the colors for this output data. +The Console, ISE, and Result dialog all provide a way a way to view output data. The `$host` variable provides access to configuring the colors for this output data. **Example:** The following configures colors for the background and forground text in multiple streams. @@ -19,4 +19,5 @@ Write-Warning " Write-Warning " Show-Result -Text -Width 500 -Height 300 ``` -![Host output using Show-Result](images/screenshots/modaldialog-showresultcolors.png) \ No newline at end of file +![Host output using Show-Result](../.gitbook/assets/modaldialog-showresultcolors.png) + diff --git a/interfaces/scripting.md b/interfaces/scripting.md new file mode 100644 index 00000000..443fb01a --- /dev/null +++ b/interfaces/scripting.md @@ -0,0 +1,71 @@ +# Scripting + +The Integrated Scripting Environment \(ISE\) is a great way to group together commands and save for later use. This tool helps you write scripts in Powerful Ways! + +The default security configuration for SPE requires the ISE to be in an [Elevated Session State](../security/) before executing scripts. The following figure shows the ISE when the User Account Controls \(UAC\) are disabled. While this is a common configuration for developers, we highly encourage you to ensure UAC is enabled in higher environments. + +Let's have a quick walk through of each ribbon tab available. + +### Home Tab + +![PowerShell ISE](../.gitbook/assets/ise-empty.png) + +* **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. +* **Script Execution:** + * **Execute** - Runs the current script as a background job or in the `HttpContext`. + * **Selection** - Runs the selected text of the current script. + * **Debug** - Runs the current script with the debugging mode enabled. A temporary file is generated on the file system to support the use of breakpoints. + * **Abort** - Stops the execution of an executing script. +* **Context:** + * **Context** - Specifies the current item in the script. Helpful if you write a script dependent on a specific path, or the current directory is denoted as a `.` \(dot\) or \_`$pwd` \(\_present working directory\). An MRU and tree view are provided for choosing a path. + * **Session** - Specifies the session to use when executing the script. Reused sessions live in the `HttpSession`. Options include the session created for the _ISE instance_, _One-Time session_, or the _Persistent Session ID_ configured on the script. +* **UI Context:** + * **Language** - Specifies the context language to use when executing the script. + * **User** - Specifies the context user to impersonate when executing the script. This can be used to emulate `UserSwitcher` code. + +### Settings Tab + +![ISE Settings Tab](../.gitbook/assets/ise-settings.png) + +* **Preferences:** + * **Settings** - This is where you configure the Console and ISE font family, font size, and other useful things. +* **Integration:** + * **Rebuild All** - This is where you rebuild the integration points for Control Panel, Gutters, and Ribbons. Without running this you will not see those integrations appear \(or disappear\). + +### Plugins Tab + +The plugins feature is a great way to add custom behaviors while in the ISE. Any plugin added can make use of the **Enable** or **Show** rules to control how it appears in the ribbon. + +![ISE Plugins Tab](../.gitbook/assets/ise-plugins.png) + +* **Platform:** Custom scripts added to the _ISE Plugins_ integration point script library will appear here. + +The _Open_ dialog provides both a search and tree view of the scripts stored in the script libraries. + +![Open Script Dialog](../.gitbook/assets/ise-opendialog.png) + +## Shortcuts + +Below are the shortcuts available in the ISE. + +| **Shortcut** | **Usage** | +| :--- | :--- | +| TAB | Indent | +| Ctrl-Space | Autocomplete commands. Use the up or down direction keys to cycle through options. | +| Ctrl-Enter | Displays the command help window. | +| Ctrl-Z | Undo the previous change. | +| Ctrl-Alt-Shift + | Increase the font size | +| Ctrl-Alt-Shift - | Decrease the font size | +| Ctrl-E | Executes the script | +| Alt-E | Executes the selected text in the script | +| Ctrl-D | Debugs the script | +| Ctrl-Shift-E | Aborts the running script | +| Ctrl-F | Search for keywords in the script | + +For more commands built into the script editor see [here](https://github.com/ajaxorg/ace/wiki/Default-Keyboard-Shortcuts) + diff --git a/item-languages.md b/item-languages.md deleted file mode 100644 index 64bf6179..00000000 --- a/item-languages.md +++ /dev/null @@ -1,83 +0,0 @@ -# Item Languages - -The section on [working with items](working-with-items.md) provided a variety of examples in retrieving items based on their language. In this section will show how to manage items and their languages. - -### Add Language Version - -**Example:** The following example queries all of the content items and adds a new language version of "en-ca", while overwriting any that exist. - -```powershell -Get-ChildItem "master:\content" -Recurse | - Add-ItemLanguage -Language "en-us" -TargetLanguage "en-ca" -IfExist OverwriteLatest -``` - -**Example:** The following example adds a language version from English to US and Polish while leaving the ```Title``` field blank. If a version already exists nothing happens. - -```powershell -$languageParameters = @{ - Path = "master:\content\home" - Language = "en" - TargetLanguage = @("pl-pl","en-us") - IfExist = "Skip" - IgnoredFields = @("Title") -} -Add-ItemLanguage @languageParameters -``` - -**Example:** The following example adds a language version from English to Polish of Template Name *Sample Item*. If the version exists a new version is created for that language. Finally the results are displayed as a table showing only the ```Name```, ```Language```, and ```Version```. -```powershell -Get-ChildItem "master:\content\home" -Language "en" -Recurse | - Where-Object { $_.TemplateName -eq "Sample Item" } | - Add-ItemLanguage -TargetLanguage "pl-pl" -IfExist Append | - Format-Table Name, Language, Version -AutoSize -``` - -**Example:** The following example adds a language version in Polish to the *Home* item and all its children. If the version exists nothing happens. No fields were harmed in the making of this version. - -```powershell -Add-ItemLanguage -Path "master:\content\home" -TargetLanguage "pl-pl" -IfExist Skip -DoNotCopyFields -Recurse -``` - -### Remove Language Version - -**Example:** The following example queries all of the content items and removes the language version of "fr-CA". - -```powershell -Get-ChildItem "master:\content" -Recurse | - Remove-ItemLanguage -Language "fr-CA" -``` - -### Parameters and Configuration - -Supported parameters: -- ```-Recurse``` Translates item and its children -- ```-IfExist``` Accepts one of 3 pretty self explanatory actions: ```Skip```, ```Append``` or ```OverwriteLatest``` -- ```-TargetLanguage``` accepts a list of languages that should be created -- ```-DoNotCopyFields``` creates a new version but does not copy field values from original language -- ```-IgnoredFields``` list of fields that should not be copied over from original item this can contain e.g. ```__Security``` if you don't want the new version to have the same restrictions as the original version. - -On top of the ignored fields in the ```-IgnoredFields``` the following fields are ignored as configured within the ```Cognifide.PowerShell.config``` file: -```xml - - - - - - __Archive date - __Archive Version date - __Lock - __Owner - __Page Level Test Set Definition - __Reminder date - __Reminder recipients - __Reminder text - - - - - -``` - -#### References -* [Issue 184](https://github.com/SitecorePowerShell/Console/issues/184) -* [Remove All Content items in French](http://stackoverflow.com/questions/29928540/powershell-script-to-remove-all-content-items-for-french-version-in-sitecore) \ No newline at end of file diff --git a/item-renderings.md b/item-renderings.md deleted file mode 100644 index d4ae2dd8..00000000 --- a/item-renderings.md +++ /dev/null @@ -1,49 +0,0 @@ -# Item Renderings - -In this section we'll show how to manage item renderings. - -**Example:** The following demonstrates the use of `Get-Rendering` and `Set-Rendering` for updating values on templates. - -```powershell -$rendering = Get-Item -Path "master:\sitecore\layout\Sublayouts\Sample Sublayout" - -$items = Get-ChildItem -Path "master:\sitecore\templates\Sample Item" -Recurse -foreach($item in $items) { - $renderingInstance = Get-Rendering -Item $_ -Rendering $rendering - if ($renderingInstance) { - Set-Rendering -Item $_ -Instance $renderingInstance -Parameter @{ - "Lorem" = "Ipsum" - } - Write-Host "Updated $($_.Paths.FullPath)" - } -} -``` - -**Example:** The following demonstrates how to report on pages referencing the specified rendering. - -```powershell -Get-Item "master:\layout\Renderings\Feature\Experience Accelerator\Page Content\Page Content" | - Get-ItemReferrer | Where-Object { $_.ContentPath.StartsWith("/Demo/usa/Home") } | Show-ListView -``` - -**Example:** The following demonstrates how to report on which renderings are globally set to "Cacheable". - -```powershell -Get-ChildItem -Path "master:\layout\Renderings" -Recurse | - Where-Object { $_.Cacheable -eq "1" } | - Select-Object -Property Name, Cacheable, ClearOnIndexUpdate, VaryBy* | - Sort-Object -Property Name | Show-ListView -``` - -**Example:** The following demonstrates how to disable global caching on all renderings. - -```powershell -$VerbosePreference = "Continue" -Get-ChildItem -Path "master:\layout\Renderings" -Recurse | - Where-Object { $_.Cacheable -eq "1" } | - ForEach-Object { Write-Verbose "Disabled global caching on $($_.Name)"; $_.Cacheable = "0" } - -# VERBOSE: Disabled global caching on Navigation -``` - - diff --git a/libraries-and-scripts.md b/libraries-and-scripts.md deleted file mode 100644 index ce9d06d3..00000000 --- a/libraries-and-scripts.md +++ /dev/null @@ -1,90 +0,0 @@ -# Libraries and Scripts - -Modules may contain *PowerShell Script Library* items and *PowerShell Script* items. The following section outlines some of the basic concepts you need to know for the following chapters. - -### PowerShell Script Library - -The library items represent a collection of scripts, and may be structured with one or more levels of libraries. - -#### Naming Convention - -You'll find that with the *Integration Points* some libraries should be created with specific names (i.e. Content Editor, Control Panel). - -As a best practice we recommend that the *Function* library consist of reusable functions while other libraries contain the solution specific scripts. - -**Example:** The following demonstrates the use of the *Function* script library containing *Get-DateMessage*. - -```powershell -# /sitecore/system/modules/powershell/script library/spe rocks/functions/get-datemessage -function Get-DateMessage { - "The current date and time is: $(Get-Date)" -} -``` - -```powershell -# /sitecore/system/modules/powershell/script library/spe rocks/alerts/show-datemessage -Import-Function -Name Get-DateMessage - -Show-Alert (Get-DateMessage) -``` - -Some names we've used include: -* Beginner Tutorials -* **Content Editor** -* Content Maintenance -* Content Interrogation -* Development -* **Event Handlers** -* **Functions** -* **Internal** -* **Page Editor** -* **Pipelines** -* Profile and Security -* **Reports** -* Script Testing -* **Tasks** -* **Toolbox** -* User Interaction -* **Web API** - -Many of the of the libraries are integration points for the module. - -#### Fields - -**Interactive** : The following fields support the two custom rules as well as a variety of out-of-the-box rules. - -* **ShowRule** (Show if rules are met or not defined) - * **PowerShell** - * where *specific* persistent PowerShell session was already initiated - * where *specific* persistent PowerShell session was already initiated and has the *specific* variable defined and not null - * where exposed in a *specific* view - * **PowerShell ISE** - * when *length* script length is *compares to* *number* characters long - * when the edited script is *in a state* -* **EnableRule** (Enable if rules are met or not defined) - * ***Same as above*** - -### PowerShell Script - -The script items represent the code that will be executed. - -#### Naming Convention - -There are three conventions that we recommend you follow which are shown with an example below. - -* **Title Casing** - This should be used when the name will be exposed in places such as the *Content Editor*, script library names, and *Reports* root directory. -* **Sentence casing** - This should be used when the name is long and will not be visible to the user or is a report with a very long name. -* **Noun-Verb** - This should be used when the script is stored within the *Functions* script library and will be imported using the command *Import-Function*. - -#### Fields - -**Interactive** : Refer to the description shown for *PowerShell Script Library* fields. - -**Scripting** - -* **Script** (Script body) : This is a multi-line text than should be edited using the **PowerShell ISE** application. - -**Session Persistency** - -* **PersistentSessionId** (Persistent Session ID) : Context scripts using this ID will execute in a single session and be reused; leaving empty will cause the session to be discarded after execution. This value should be used for rules requesting the session ID. - diff --git a/modules.md b/modules.md deleted file mode 100644 index 5810a2d4..00000000 --- a/modules.md +++ /dev/null @@ -1,27 +0,0 @@ -# Modules - -Sitecore PowerShell Extensions provides a way to organize your scripts into *modules*. - -Some benefits to using modules: -* The integration points contained within each module can be enabled or disabled globally. For this to take full affect the integration should be rebuilt in the ISE. -* Organization of custom scripts is a cinch. -* More reasons can be found in Adam's [post][1]. - -**Note:** The *Platform* module is one you should avoid changing. - -### Create a custom module -Getting started with your own module is a short process and something you should do for all of your custom scripts. - -1. Navigate to the *Script Library* item and *Insert -> PowerShell Script Module*. -![New Module](images/screenshots/library-createnewmodule.png) -2. Enter the name for the new module and click *OK*. -3. Right click the new module and *Scripts -> Create libraries for integration points*. -![Integration Points](images/screenshots/module-createlibraries.png) -4. Select the appropriate integration points for your module. -![Integration Point Libraries](images/screenshots/module-createtoolboxlibrary.png) -5. Select the module and enable for use. -![Module Activation](images/screenshots/module-activationdisabled.png) -6. Open the ISE, switch to the *Settings* tab, and rebuild integrations. - - -[1]: http://blog.najmanowicz.com/2014/11/01/sitecore-powershell-extensions-3-0-modules-proposal/ \ No newline at end of file diff --git a/modules/README.md b/modules/README.md new file mode 100644 index 00000000..c0dd197f --- /dev/null +++ b/modules/README.md @@ -0,0 +1,37 @@ +# Modules + +Sitecore PowerShell Extensions provides an organization structure composed of _modules_, _libraries_, and _scripts_. Modules make up the highest level and can be grouped together by module folders. + +Some benefits to using modules: + +* The [integration points](integration-points/) contained within each module can be enabled or disabled globally. For this to take full affect the integration should be rebuilt in the ISE. +* Organization of custom scripts is a cinch. +* More reasons can be found in Adam's [post](https://github.com/SitecorePowerShell/Book/tree/9c7126d7a38df6ef372e8baef52f9a02baabd550/modules/[https:/blog.najmanowicz.com/2014/11/01/sitecore-powershell-extensions-3-0-modules-proposal/]/README.md). + +{% hint style="warning" %} +The _Platform_ module is one you should avoid changing. +{% endhint %} + +## Create a custom module + +Getting started with your own module is a short process and something you should do for all of your custom scripts. + +1. Navigate to the _Script Library_ item and _Insert -> PowerShell Script Module_. + + ![New Module](../.gitbook/assets/library-createnewmodule.png) + +2. Enter the name for the new module and click _OK_. +3. Right click the new module and _Scripts -> Create libraries for integration points_. + + ![Integration Points](../.gitbook/assets/module-createlibraries.png) + +4. Select the appropriate integration points for your module. + + ![Integration Point Libraries](../.gitbook/assets/module-createtoolboxlibrary.png) + +5. Select the module and enable for use. + + ![Module Activation](../.gitbook/assets/module-activationdisabled.png) + +6. Open the ISE, switch to the _Settings_ tab, and rebuild integrations. + diff --git a/modules/integration-points/README.md b/modules/integration-points/README.md new file mode 100644 index 00000000..39a9885b --- /dev/null +++ b/modules/integration-points/README.md @@ -0,0 +1,42 @@ +# Integration Points + +The SPE Modules support a wide variety of predefined script libraries to help with exposing scripts to the Sitecore interface. + +The following list outlines the available libraries for _Integration Points_ that may be added to modules. These may also be generated automatically when creating or updating modules. + +{% hint style="info" %} +Be certain to enable the module when you need to use it. +{% endhint %} + +* [**Content Editor**](content-editor.md) + * Context Menu - Visibility can be control using rules made available from within the _Interactive_ field section. + * Gutters - Requires the library to be [synced (see below)](#syncing-integrations). + * Insert Item - Visibility can be control using rules made available from within the _Interactive_ field section. + * Ribbon - Requires the library to be [synced (see below)](#syncing-integrations). Visibility can be control using rules made available from within the _Interactive_ field section. + * Warning - Appears as a warning message beneath the ribbon in the _Content Editor_. +* [**Control Panel**](control-panel.md) - Requires the library to be [synced (see below)](#syncing-integrations). +* [**Data Sources**](https://github.com/sitecorepowershell/sitecore-powershell-extensions/tree/b6365f8ecf54966c2e1757f549f543976500aa52/date-sources.md) - Not a formal integration point library, but a good place to add scripts used for Data Source Scripts. Read more about how they work [here](https://blog.najmanowicz.com/2013/04/17/powershell-scripted-datasources-in-sitecore-part-1/) and [here](https://github.com/SitecorePowerShell/Book/tree/9c7126d7a38df6ef372e8baef52f9a02baabd550/modules/integration-points/[https:/blog.najmanowicz.com/2013/05/06/powershell-scripted-data-sources-in-sitecore-part-2/]/README.md). The _Source_ field simply references the script like _script:/sitecore/system/Modules/PowerShell/Script Library/\[MODULE NAME\]/Data Sources/\[SCRIPT NAME\]_. +* [**Event Handlers**](event-handlers.md) - Requires a patch file to enable the desired events. Read more about it [here](https://blog.najmanowicz.com/2013/05/27/react-to-sitecore-events-with-powershell-scripts/). +* [**Functions**](functions.md) - Exposes scripts to the command _Import-Function_. +* **Internal** + * [ISE Plugins](ise-plugins.md) - Appears as a button in the ISE _Settings_ tab. + * List View - Represents the ribbon buttons such as for **Actions** and **Exports**. +* [**Page Editor**](page-editor.md) \(Experience Editor\) + * Notification - Appears as a notification message beneath the ribbon in the _Experience Editor_. +* [**Pipelines**](pipelines.md) + * LoggedIn + * LoggingIn + * Logout +* [**Reports**](reports/) - Appears as a shortcut under _Sitecore -> Reporting Tools -> PowerShell Reports_. +* [**Toolbox**](toolbox.md) - Appears as a shortcut under _Sitecore -> Toolbox_. Visibility can be control using rules made available from within the _Interactive_ field section. +* [**Tasks**](tasks/) - Not a formal integration point library, but a good place to add scripts used for Scheduled Tasks. SPE includes a `PowerShellScriptCommand` found under _/sitecore/system/Tasks/Commands/PowerShellScriptCommand_ which is used to run scripts from within scheduled tasks. +* [**Web API**](web-api.md) - Exposes scripts than can be consumed through [SPE Remoting](../../remoting.md). The script can be executed by requesting a specific url. +* [**Workflows**](workflows.md) - Not a formal integration point library, but a good place to add scripts used for Workflow Action Scripts. Read more about how they work [here](https://blog.najmanowicz.com/2014/11/09/introducing-powershell-actions-for-sitecore-workflows/). + +## Other Integrations + +* **Remoting** - Interact with SPE through the provided web services as described [here](../../remoting.md). A Windows PowerShell module is made available to encapsulate the web service calls into PowerShell commands. + +## Syncing Integrations +Some integrations need to be synced with the Core database through the ISE. See the [Settings](https://github.com/SitecorePowerShell/Book/blob/f781a87f549920aab0a7dede0ddf4c261e1aecb4/interfaces/scripting.md#settings-tab) section of the Scripting documents for instructions. + diff --git a/modules/integration-points/content-editor.md b/modules/integration-points/content-editor.md new file mode 100644 index 00000000..e23f4b9c --- /dev/null +++ b/modules/integration-points/content-editor.md @@ -0,0 +1,134 @@ +--- +description: Visual components made available to users in the Content Editor. +--- + +# Content Editor + +## Context Menu + +The _Context Menu_ integration reveals a list of options to the user in the context menu under a special node called _Scripts_. The Sitecore rules engine may be used to control visibility and enabled state. The script is only executed when the option is clicked. + +1. Begin by adding a new script to the _Context Menu_ library. The name of the script will appear in the context menu. +2. Edit the script to perform the appropriate actions. The script can run in the background and show dialogs. +3. Change the icon of the item to match the script purpose. +4. Configure any **Enable** or **Show** rules as needed. + +**Note:** Examples included in the following modules + +* Authoring Instrumentation +* Copy Renderings +* Index On Demand +* Media Library Maintenance +* Package Generator + + ![Package Generator](../../.gitbook/assets/context-menu-package-generator.png) + +* Task Management + +See how Adam added [context menu PowerShell scripts](https://blog.najmanowicz.com/2011/11/22/context-powershell-scripts-for-sitecore/). + +## Gutter + +The _Gutter_ integration reveals a visual notification to the user in the far left gutter. The Sitecore rules engine may be used to control enabled state. + +1. Begin by adding a new script to the _Gutters_ library. +2. Edit the script to create a new instance of `Sitecore.Shell.Applications.ContentEditor.Gutters.GutterIconDescriptor` if the right conditions are met. + * Set the **Icon**, **Tooltip**, and **Click** properties. + * Return the gutter object +3. Configure any **Enable** rules to ensure the script runs only when necessary. +4. Rebuild the gutter integration from within the ISE. + * Settings tab + * Integration chunk + * Sync Library with Content Editor Gutter command + +**Note:** Examples included in the following modules + +* Publishing Status Gutter + + ![Publishing Status](../../.gitbook/assets/gutter-publishing-status.png) + +## Insert Item + +The _Insert Item_ integration reveals a list of options to the user in the context menu under the node called _Insert_. The Sitecore rules engine may be used to control visibility and enabled state. The script is only executed when the option is clicked. + +1. Begin by adding a new script to the _Insert Item_ library. The name of the script will appear in the context menu. +2. Edit the script to perform the appropriate actions. The script can run in the background and show dialogs. +3. Change the icon of the item to match the script purpose. +4. Configure any **Show** rules as needed. + +**Note:** Examples included in the following modules + +* Task Management + + ![Insert Scheduled Task](../../.gitbook/assets/insert-item-powershell-task.png) + +* Platform + +## Ribbon + +The _Ribbon_ integration reveals commands to the user in the ribbon. The Sitecore rules engine may be used to control visibility and enabled state. The script is only executed when the option is clicked. + +1. Begin by adding a new child script library to the _Ribbon_ library; we'll refer to this library as the **Tab** library. Choose a name that matches an existing tab to be used, such as _Home_ or _Developer_, or a new name to create a new tab. +2. Add a child script library to the **Tab** library; we'll call this the **Chunk** library. Choose a name such as _Edit_ or _Tools_. +3. Add a new script to the **Chunk** script library; we'll refer to this library as the **Command** library. The name of the script will appear in the ribbon chunk as a command. +4. Optionally add a short description on the item, which is found as a standard field on the item. The description will appear as a tooltip on the ribbon button. +5. Edit the script to perform the appropriate actions. The script can run in the background and show dialogs. +6. Change the icon of the item to match the script purpose. +7. Configure any **Enable** or **Show** rules as needed. + +![Ribbon Script Library Structure](../../.gitbook/assets/ribbon-script-structure.png) + +**Example:** The following script gets the selected Context Menu item and displays an alert using the item name. + +```powershell +# Use the notation "." to get the current directory/item. +$item = Get-Item -Path . +Show-Alert -Title $item.Name +``` + +**Button Size:** + +There is a way to generate small buttons and combo buttons. You simply need to prefix the script name and SPE will generate accordingly. + +* `Small$[SCRIPT_NAME]` +* `Combo$[SCRIPT_NAME]` +* `SmallCombo$[SCRIPT_NAME]` + +![Small and Combo Buttons](../../.gitbook/assets/ribbon-script-button-size.png) + +![Buttons in the Ribbon](../../.gitbook/assets/ribbon-script-button-size2.png) + +See the birth of [extending the Sitecore ribbon with powershell scripts](https://blog.najmanowicz.com/2011/11/24/extending-sitecore-ribbon-with-powershell-scripts/) by Adam. + +Check out an example of the [5 steps to extending the Sitecore ribbon](https://sitecoresandbox.com/2016/06/03/content-editor-ribbon-buttons-using-sitecore-powershell-extensions/) in the wild by Toby. + +### Contextual Ribbon + +Similar to the _Ribbon_ integration, this provides a way to show buttons when certain contextual conditions are met. Most common is with media items. The steps are the same as with the standard _Ribbon_, but the structure is slightly changed. + +In the following example, we have a ribbon button that appears whenever the selected item in the Content Editor is a media item. Take note of the "Optimize" button. + +![Contextual Ribbon Command](https://user-images.githubusercontent.com/933163/51213796-8a639100-18e1-11e9-858a-f5611cc71f0b.png) + +The ribbon structure would look like the following: + +![Script Library Structure](https://user-images.githubusercontent.com/933163/51213924-f5ad6300-18e1-11e9-9aa8-42020f849a10.png) + +## Warning + +The _Warning_ integration reveals a notification to the user above content. The Sitecore rules engine can be used to control visibility and enabled state. The scripts are only executed when the rule is met and the command is clicked. + +1. Begin by adding a new script library to the _Warning_ library. +2. Edit the script to perform the appropriate actions. The script can run in the background and show dialogs. +3. The warning notification title, text and icon should be configured in the script. + * Include options to the warning by adding one or more secondary scripts to the script library. +4. Configure any **Enable** rules to ensure the script only runs when required. + +**Note:** Examples included in the following modules + +* License Expiration - disabled by default + +![License Expiration Warning](../../.gitbook/assets/warning-notification-for-licensing.png) + +Alan provided a nice example [here ](https://alan-null.github.io/2016/04/content-editor-notifications)on setting up the warning with commands. + diff --git a/control-panel.md b/modules/integration-points/control-panel.md similarity index 62% rename from control-panel.md rename to modules/integration-points/control-panel.md index 38f3e37c..607af18e 100644 --- a/control-panel.md +++ b/modules/integration-points/control-panel.md @@ -1,21 +1,24 @@ # Control Panel -### Administration +## Administration **Note:** Examples included in the following modules + * System Maintenance -### Analytics +## Analytics -### Database +## Database -### Globalization +## Globalization -### Preferences +## Preferences -### Reports +## Reports **Note:** Examples included in the following modules + * System Maintenance -### Security \ No newline at end of file +## Security + diff --git a/modules/integration-points/data-sources.md b/modules/integration-points/data-sources.md new file mode 100644 index 00000000..82b234d8 --- /dev/null +++ b/modules/integration-points/data-sources.md @@ -0,0 +1,63 @@ +# Data Sources + +Scripted Data Sources provide a way to use a PowerShell script to perform complex queries. + +Here are some good reasons to use this feature: + +* Delivering complex functionality based on multiple criteria. +* Your field may need to provide different set of items to choose from based on: + * user name or role \(in simplest case this can be done using right management, but maybe not always possible in a more elaborate scenario\) + * current day or month? + * In a multisite/multimarket scenario you may want to show different items for each site + + based on engagement analytics parameters of the page + + based on where in the tree an item exist \(some of it can be done with use of a “query:”\) + + * anything you might want to build the code data source for… + +Something that would be beyond the reach of a regular Sitecore query and potentially something that you would really need to deliver code source for. But maybe you’re not in a position to deploy that on your environment? + +## Field Data Source + +Field Data Source provides a great opportunity for a script. + +Below are field types you may wish to use a script: + +* Checklist +* Droplist +* Grouped Droplink +* Grouped Droplist +* Multilist +* Name Lookup Value List +* Droplink +* Begin by adding a new script library called _Data Sources_ followed by adding a script. You can call it something like _Get-GlobalOption_. + + ```powershell + # The script must return an item. This is useful for populating a Droplink. + Get-ChildItem -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" + ``` + +* Add the path to your script in the _Source_ field on the data template. The source should be prefixed with `script:` followed by the path. + + ```powershell + script:/sitecore/system/Modules/PowerShell/Script Library/X-Demo/Data Sources/Get-GlobalOption + ``` + +* Enjoy the results. + +![Droplink query](../../.gitbook/assets/droplist.png) + +## Rendering Data Source Roots + +//TODO + +## Rendering Data Source Items + +//TODO + +## References + +* PowerShell Scripted Data Sources [part 1](https://blog.najmanowicz.com/2013/04/17/powershell-scripted-datasources-in-sitecore-part-1/) and [part 2](https://blog.najmanowicz.com/2013/05/06/powershell-scripted-data-sources-in-sitecore-part-2/) +* Sitecore Spark [article](https://github.com/SitecorePowerShell/Book/tree/5daee3160885dadd7031fee723dccf12a33abd7b/modules/integration-points/[https:/www.sitecorespark.com/blog/2018/3/using-sitecore-powershell-scripts-for-datasources]/README.md) on using scripted datasources + diff --git a/modules/integration-points/event-handlers.md b/modules/integration-points/event-handlers.md new file mode 100644 index 00000000..346a6bf8 --- /dev/null +++ b/modules/integration-points/event-handlers.md @@ -0,0 +1,36 @@ +# Event Handlers + +The Event Handler integration provides a way to execute scripts when defined events are fired. + +Steps required to activate this integration include the following: + +1. Enable the _Spe.Events.config_ or apply your own patch with the required events enabled. +2. Add a new integration point library to your new or existing module. +3. Add a new script to the appropriate event library. +4. Configure an **Enable Rule** if needed. +5. Profit! + +## Enable Configuration + +While SPE comes with an example configuration, which is disabled by default, it contains several events that may not meet your requirements. + +An event configuration patch may look like the following: + +```xml + + + + + + + + + +``` + +## Add Event Script + +To mimic the event _item:added_ you should create nested script libraries such as _Event Handlers -> Item -> Added_ followed by a script. + +![Item Added Event Handler](../../.gitbook/assets/event-itemadded.png) + diff --git a/modules/integration-points/functions.md b/modules/integration-points/functions.md new file mode 100644 index 00000000..b6f67fb1 --- /dev/null +++ b/modules/integration-points/functions.md @@ -0,0 +1,22 @@ +# Functions + +The _Functions_ integration allows for scripts to be discoverable through autocomplete while authoring scripts. Functions can be "disabled" by disabling the containing module. + +1. Begin by adding a script library called "Functions" to a module. This can be created by the new module wizard. +2. Add a script to the "Functions" script library with a name that represents the purpose. +3. Use the command `Import-Function` to discover the available functions. + +![Module Creation](../../.gitbook/assets/module-sharedfunctions.png) + +**Note:** It's best practice to create function scripts that follow the `Verb-Noun` pattern as outlined by Microsoft. + +![Shared Functions Library](../../.gitbook/assets/scriptlibrary-sharedfunctions.png) + +![Autocomplete in ISE](../../.gitbook/assets/script-importfunction.png) + +Here's a short video on authoring custom functions. + +![Creating Functions](https://img.youtube.com/vi/bn4LSDF8p4g/0.jpg) + +[Click for a demo](https://www.youtube.com/watch?v=bn4LSDF8p4g) + diff --git a/modules/integration-points/ise-plugins.md b/modules/integration-points/ise-plugins.md new file mode 100644 index 00000000..f5506efa --- /dev/null +++ b/modules/integration-points/ise-plugins.md @@ -0,0 +1,37 @@ +--- +description: Custom ribbon commands for use in the ISE. +--- + +# ISE Plugins + +You can include custom ribbon commands in the ISE to aid in improving the script authoring experience. + +![ISE Plugins](https://user-images.githubusercontent.com/933163/61412200-dea9f680-a8ad-11e9-8ba8-2610d6f63a39.png) + +## Add a custom plugin + +For this example, we wish to have a plugin that analyzes the script and reports on any errors. + +Create a new script stored under the following structure: + +![Analyze Script](https://user-images.githubusercontent.com/933163/61412797-680df880-a8af-11e9-9656-e1cc609d26fe.png) + +{% hint style="info" %} +The path structure needs to follow `[MODULE]/Internal/ISE Plugins/[PLUGIN_NAME]`. Here we have `X-Demo/Internal/ISE Plugins/Analyze Script`. +{% endhint %} + +Use the following sample to fill in the script body. + +```powershell +if([string]::IsNullOrWhiteSpace($scriptText)){ + Show-Alert "Script is empty - nothing to format." + exit +} + +Import-Module -Name PSScriptAnalyzer +Invoke-ScriptAnalyzer -ScriptDefinition $scriptText +``` + +Now you can run the command from the ribbon and see the results in the ISE. + +![Example results](https://user-images.githubusercontent.com/933163/61413046-1fa30a80-a8b0-11e9-84ac-bcd536f18b42.png) \ No newline at end of file diff --git a/page-editor.md b/modules/integration-points/page-editor.md similarity index 66% rename from page-editor.md rename to modules/integration-points/page-editor.md index 938c7be2..503dc58b 100644 --- a/page-editor.md +++ b/modules/integration-points/page-editor.md @@ -1,12 +1,13 @@ # Page Editor -### Notification +## Notification -The *Notification* integration adds a notification to the Page Editor. The script is executed every time the page loads. +The _Notification_ integration reveals to the user a notification above the content. The Sitecore rules engine may be used to control the enabled state; simply configure the **Enable** rule on the script. The script is executed every time the page loads. -![A Notification for the current date](images/screenshots/page-editor/notification-information.png) +![A Notification for the current date](../../.gitbook/assets/notification-information.png) **Example:** The following adds an information notification to the page for Sitecore 8 and a warning for Sitecore 7. + ```powershell $title = "Thank you for using SPE!" $text = "Today is $([datetime]::Now.ToLongDateString())" @@ -19,21 +20,22 @@ $pipelineArgs.Notifications.Add($notification) ``` **Note:** Examples included in the following modules + * License Expiration -### Experience Button +## Experience Button -The *Experience Button* integration adds a button to the Page Editor. Rules can be used to control visiblity and enablement. The script is only executed when the button is clicked. +The _Experience Button_ integration adds a button to the Page Editor. Rules can be used to control visiblity and enablement. The script is only executed when the button is clicked. -1. Begin by adding a new script to the *Experience Button* library. The name of the script will appear in the tooltip. +1. Begin by adding a new script to the _Experience Button_ library. The name of the script will appear in the tooltip. 2. Edit the script to perform the appropriate actions. The script can run in the background and show dialogs. 3. Change the icon of the item to match the script purpose. -4. Configure any rules as needed. - -![An Experience Button for sending emails](images/screenshots/page-editor/experience-button-with-tooltip.png) +4. Configure any **Enable** or **Show** rules as needed. +![An Experience Button for sending emails](../../.gitbook/assets/experience-button-with-tooltip.png) **Example:** The following adds a command which will display a dialog asking a question, then send an email with the response. + ```powershell $item = Get-Item -Path . $response = Show-Input -Prompt "What's the message for $($item.Name)?" @@ -44,7 +46,7 @@ if($response) { BodyAsHtml = $true SmtpServer = "localhost" } - + $subject = "Message sent regarding item $($item.Name) from $($SitecoreAuthority)" $response += "
$($item.ItemPath)" Send-MailMessage @mailSettings -Subject $subject -Body $response @@ -53,6 +55,7 @@ if($response) { Close-Window ``` -![Message Input](images/screenshots/page-editor/message-input-with-ok-cancel.png) +![Message Input](../../.gitbook/assets/message-input-with-ok-cancel.png) + +![Email Response](../../.gitbook/assets/papercut-email-response.png) -![Email Response](images/screenshots/page-editor/papercut-email-response.png) \ No newline at end of file diff --git a/modules/integration-points/pipelines.md b/modules/integration-points/pipelines.md new file mode 100644 index 00000000..9ed8cc69 --- /dev/null +++ b/modules/integration-points/pipelines.md @@ -0,0 +1,40 @@ +# Pipelines + +Use the following in your scripts to get access to the arguments passed to the processor. + +```powershell + $pipelineArgs = Get-Variable -Name pipelineArgs -ValueOnly +``` + +Configure any **Enable** rules to ensure your script only runs when necessary. + +## Logging In + +**Note:** Examples included in the following modules + +* Enforce user password expiration + +```powershell +$pipelineArgs.Username +$pipelineArgs.Password +$pipelineArgs.Success +$pipelineArgs.StartUrl +``` + +## Logged In + +**Note:** Examples included in the following modules + +* Automatically show quick info section + +```powershell +$pipelineArgs.Username +$pipelineArgs.StartUrl +``` + +## Logout + +**Note:** Examples included in the following modules + +* Unlock user items on logout + diff --git a/modules/integration-points/reports/README.md b/modules/integration-points/reports/README.md new file mode 100644 index 00000000..61038c68 --- /dev/null +++ b/modules/integration-points/reports/README.md @@ -0,0 +1,83 @@ +# 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](https://github.com/SitecorePowerShell/Book/tree/9c7126d7a38df6ef372e8baef52f9a02baabd550/modules/integration-points/reports/[https:/marketplace.sitecore.net/en/Modules/A/Advanced/_System/_Reporter.aspx]) \(ASR\) module. + +## Running a Report + +The custom reports can be found by navigating to _Sitecore -> Reporting Tools -> PowerShell Reports_. + +![Reports](../../../.gitbook/assets/reports.png) + +As an example, let's run the Unused media items report. + +![Unused Media Items](../../../.gitbook/assets/reports-unusedmedia.png) + +Once the report completes, the results appear in a report window. + +![Unused Media Items Output](../../../.gitbook/assets/reports-output.png) + +## Reports in SPE like ASR + +While SPE contains many reports, they don't match identical to ASR reports. We've done our best to build those that seem most relevant or likely to be used. If you find a report in ASR that you would like to exist in SPE please submit a request. + +| **SPE Report** | **ASR Report** | +| :--- | :--- | +| | Active Aliases | +| | Aliases | +| | Audit | +| Broken Links2 | Broken Links | +| | Broken Links in publishable items | +| | Item History | +| | Items with Invalid Names | +| Items with security for an account2 | Items with Security for an account | +| | Items with Tokens in Fields | +| | Links | +| Locked Items2 | Locked Items | +| | Logged errors | +| Logged in Session Manager5 | Logged in Users | +| Limit number of versions4 | Multiple versions | +| | My Owned Items | +| Media items last updated before date3 | Not recently modified | +| Media items not used by content items3 | Orphaned media assets report | +| | Owned items | +| Recent workflow history2 | Recent Workflow History | +| Media items last updated after date3 | Recently Modified | +| | Regex Item Searcher | +| | Renderings | +| Index Viewer5 | - | +| Rules based report5 | - | +| Task Manager report5 | - | + +Check the reports in SPE under these sections to see the full list. + +* 1 Configuration Audit report +* 2 Content Audit report +* 3 Media Audit report +* 4 Solution Audit report +* 5 Toolbox + +**Note:** Examples included are in the following modules + +* Content Reports + +## Reports Security + +You may wish to expose the reports to users such as Content Authors. Here are the steps required to grant access to users in the `sitecore\Sitecore Client Authoring` role. + +Here is what users may see in the event they do not have the appropriate access. + +![Reports without Access](../../../.gitbook/assets/reports-menuwithoutaccess.png) + +1. Navigate to the item `/sitecore/content/Documents and settings/All users/Start menu/Right/Reporting Tools/PowerShell Reports` +2. Grant access to `sitecore\Sitecore Client Authoring` + + ![Report Viewer Access](../../../.gitbook/assets/reports-vieweraccess.png) + +3. Verify the reports are now visible to the Authoring users. + + ![Reports with Access](../../../.gitbook/assets/reports-menuwithaccess.png) + +**Note:** In verson 6.4 the default access changed from `sitecore\Sitecore Client Maintaining` to a lower privileged account `sitecore\Sitecore Client Authoring`. + diff --git a/authoring-reports.md b/modules/integration-points/reports/authoring-reports.md similarity index 78% rename from authoring-reports.md rename to modules/integration-points/reports/authoring-reports.md index e6e8e732..af688c8c 100644 --- a/authoring-reports.md +++ b/modules/integration-points/reports/authoring-reports.md @@ -2,31 +2,31 @@ Building reports is a straightforward task. We've provided a variety of examples for you to model when designing your own. -### Dynamic Reports +## 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. +The **Authorable Reports** module includes reports such as _Index Viewer_ and _Rules based report_ that provide input dialogs to help make the reports dynamic. **Note:** The **Index Viewer** and **Rules Based Report** are bundled as separate a package on the Sitecore Marketplace. -#### Index Viewer +### Index Viewer The _Index Viewer_ report provides a great example at how to build a generic report that queries against the Sitecore index. By navigating to _Sitecore -> Toolbox -> Index Viewer_ you can conveniently launch the report. First you will be prompted with a dialog to select the index to search. -![Choose report index](images/screenshots/authoring-reports/toolbox-indexviewer-chooseindex.png) +![Choose report index](../../../.gitbook/assets/toolbox-indexviewer-chooseindex.png) Next you will be prompted with a variety of buttons and knobs to narrow down the search results. -![Filter report results](images/screenshots/authoring-reports/toolbox-indexviewer-filterresults.png) +![Filter report results](../../../.gitbook/assets/toolbox-indexviewer-filterresults.png) Finally the report is shown. Each row has an option to show more field results. -![Final results](images/screenshots/authoring-reports/toolbox-indexviewer-results.png) +![Final results](../../../.gitbook/assets/toolbox-indexviewer-results.png) The _Show Full Info_ link will then returns the additional fields not shown in the report. -![Show Full Info](images/screenshots/authoring-reports/toolbox-indexviewer-showinfo.png) +![Show Full Info](../../../.gitbook/assets/toolbox-indexviewer-showinfo.png) The **Authorable Reports** module has a few points of interest. @@ -35,24 +35,26 @@ The **Authorable Reports** module has a few points of interest. **Examples:** -* [Creating Beautiful Sitecore Reports Easily with PowerShell Extensions](http://blog.najmanowicz.com/2014/10/25/creating-beautiful-sitecore-reports-easily-with-powershell-extensions/) +* [Creating Beautiful Sitecore Reports Easily with PowerShell Extensions](https://blog.najmanowicz.com/2014/10/25/creating-beautiful-sitecore-reports-easily-with-powershell-extensions/) -### Static Reports +## Static Reports -The **Content Reports** module includes other reports used for auditing. Below are some examples on how to create your own. +The **Content Reports** module includes other reports used for auditing. Below are some examples on how to create your own. You can control the report menu with the **Enable** and **Show** rules. This can be helpful if you want to secure specific reports with security roles. + +The rules engine can be used the control the report export and action commands. Use the **Enable** and **Show** rules to make the necessary changes. **Examples:** -* [Images with an empty alt field](http://sitecorejunkie.com/2014/05/28/create-a-custom-report-in-sitecore-powershell-extensions) -* [Unused media items](http://michaellwest.blogspot.com/2014/04/reports-with-sitecore-powershell.html) +* [Images with an empty alt field](https://sitecorejunkie.com/2014/05/28/create-a-custom-report-in-sitecore-powershell-extensions) +* [Unused media items](https://michaellwest.blogspot.com/2014/04/reports-with-sitecore-powershell.html) -### Report Actions +## Report Actions -Content extracted from [Turn Your Sitecore Powershell Reports into Applications with Action Scripts](http://blog.najmanowicz.com/2015/05/05/turn-your-sitecore-powershell-reports-into-applications-with-action-scripts/) article written by Adam. +Content extracted from [Turn Your Sitecore Powershell Reports into Applications with Action Scripts](https://blog.najmanowicz.com/2015/05/05/turn-your-sitecore-powershell-reports-into-applications-with-action-scripts/) article written by Adam. Actions are simply commands powered by scripts and with visibility dependent on certain conditions like the .Net class of the object that is displayed or perhaps other session settings. -![Actions seen for scheduled task items](images/screenshots/authoring-reports/reports-action-scripts.png) +![Actions seen for scheduled task items](../../../.gitbook/assets/reports-action-scripts.png) You define an action as a script located in an SPE script library and appears in the Actions panel. In the simplest scenario the action would appear when the script library name matches the .Net class name of the items displayed. In the above scenario the actions are placed under `/Platform/Internal/List View/Ribbon/Item/` where _Platform_ is the module and _Item_ is a script library. Let's take a look at the script here `/Platform/Internal/List View/Ribbon/Item/Open` @@ -69,7 +71,7 @@ Show-Application ` The variable `$selectedData` is provided to the script automatically by SPE in context of the content of the results on `Show-ListView`. -##### What input is passed to an action script? +#### What input is passed to an action script? When your action script is executed the environment is initialized with a number of variables at your disposal as seen below: @@ -85,7 +87,7 @@ When your action script is executed the environment is initialized with a number Consequently you get the full state of the report the user sees in the UI and you can act upon it. -##### How the report determines if your action is visible? +#### How the report determines if your action is visible? You can have multiple actions defined with dynamic visibility. The actions are generally only relevant in the context of your report. This is done on two levels. The first level happens based on the location of the script and .Net object type you are displaying in the report. The second level is based on Sitecore rules. For the action to appear all of the following conditions must be met: @@ -93,15 +95,15 @@ You can have multiple actions defined with dynamic visibility. The actions are g * The action script should be within the path `/Internal/List View/Ribbon/[Object type]`. The `[Object type]` is the name of the .Net class for which the action is valid. For example, if you want your action to be visible for `Sitecore.Data.Items.Item` then save the script at the path `/Internal/List View/Ribbon/Item`. * If the action script has no rules defined in the "Show if rules are met or not defined" field it will appear for all objects passed to `Show-ListView` that are of the type based on location. Rules will provide more granular control and allow for rule-based conditions that determine action visibility. -##### Using rules to control action visibility +#### Using rules to control action visibility -Rules add the full power of the Sitecore rules engine – similarly to what you can do on context menu items or ribbon actions in Content Editor. Some examples where this can be useful include only enabling or disabling the action for items located under a specific branch of the tree or if a [persistent session](http://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/) exists. +Rules add the full power of the Sitecore rules engine – similarly to what you can do on context menu items or ribbon actions in Content Editor. Some examples where this can be useful include only enabling or disabling the action for items located under a specific branch of the tree or if a [persistent session](https://blog.najmanowicz.com/2014/10/26/sitecore-powershell-extensions-persistent-sessions/) exists. The following screenshot shows how to create an action that only appears in reports that list objects of type `Item` that are of template `Schedule`. -![Rules configuration for actions](images/screenshots/authoring-reports/reports-schedule-action.png) +![Rules configuration for actions](../../../.gitbook/assets/reports-schedule-action.png) -For specific reports this global state might not always be enough. You can narrow down the rules further by using the report name. Name your report by providing an additional parameter to `Show-ListView`. +For specific reports this global state might not always be enough. You can narrow down the rules further by using the report name. Name your report by providing an additional parameter to `Show-ListView`. Consider the following script: @@ -111,19 +113,19 @@ Get-ChildItem master:\ | Show-ListView -ViewName ListChildren The output of the report will be like any other unnamed report but adds support for additional rules. Let's say I want my action to open a new report that lists all the children of the selected items in the report "ListChildren". After running the action my script should display the new report with the children and close the "ListChildren" report. Not very useful but illustrates the point. -![Action script](images/screenshots/authoring-reports/reports-action-script1.png) +![Action script](../../../.gitbook/assets/reports-action-script1.png) Now I need to save my script in the proper Script Library in my enabled module: -![Save action script](images/screenshots/authoring-reports/reports-action-save.png) +![Save action script](../../../.gitbook/assets/reports-action-save.png) At this point my action will show on all reports what list Item objects. But now that my script is saved I can modify its rules to narrow it down only to Show for reports named "ListChildren". For this I can click the **Runtime** button in the ISE ribbon and edit the _Show if rules are met or not defined_ field. -![Open rules editor for report](images/screenshots/authoring-reports/reports-script-runtime-settings.png) +![Open rules editor for report](../../../.gitbook/assets/reports-script-runtime-settings.png) Now you can specify that you want the action to only appear when the report is named "ListChildren". -![Add rules for report](images/screenshots/authoring-reports/reports-script-rule.png) +![Add rules for report](../../../.gitbook/assets/reports-script-rule.png) Confirm the save on all dialogs to persist your changes. Now our action appears when we run this script in ISE. @@ -131,7 +133,7 @@ Confirm the save on all dialogs to persist your changes. Now our action appears Get-ChildItem master:\ | Show-ListView -ViewName ListChildren -Property Name, ProviderPath ``` -![Now the List Children action is available](images/screenshots/authoring-reports/reports-action-now-you-see-me1.png) +![Now the List Children action is available](../../../.gitbook/assets/reports-action-now-you-see-me1.png) The action does not appear if no view name is provided to the `-ViewName` parameter. Running the script below will produce a report with the action not shown: @@ -139,17 +141,17 @@ The action does not appear if no view name is provided to the `-ViewName` parame Get-ChildItem master:\ | Show-ListView -Property Name, ProviderPath ``` -![Now the action is unavailable](images/screenshots/authoring-reports/reports-action-now-you-dont1.png) +![Now the action is unavailable](../../../.gitbook/assets/reports-action-now-you-dont1.png) -##### Updating report in place +#### Updating report in place The above action works just fine but will close the previous report and open a new report window in the Sitecore desktop. That's not a great user experience. What if you want to update the content of the report in place using the action? That's possible using the `Update-ListView` command. Consider the following script: -![Updating report content](images/screenshots/authoring-reports/reports-action-update-listview.png) +![Updating report content](../../../.gitbook/assets/reports-action-update-listview.png) In this case we're not closing the existing report but rather updating the list in place, all you need to do is send the new data to the `Update-ListView` command. -##### Showing user progress for long running scripts +#### Showing user progress for long running scripts One last thing that you might wonder is if the Write-Progress command works as it does in case of ISE or the dialog that runs scripts from Content Editor context menu. Let’s copy the following script into your action: @@ -179,23 +181,23 @@ Write-Progress -Completed -Activity "Done." And you will see the following output: -![Show progress of long running actions](images/screenshots/authoring-reports/reports-action-write-progress.png) +![Show progress of long running actions](../../../.gitbook/assets/reports-action-write-progress.png) -##### Showing other PowerShell dialogs +#### Showing other PowerShell dialogs The action runs fully asynchronously so you’re free to show any of the power of the provided commands. This means that you can ask for additional input using the `Read-Variable` command or Show alert using the `Show-Alert` command or do just about anything possible otherwise from the context menu, ribbon or other interactive integration points. -##### Passing additional data to actions +#### Passing additional data to actions The `Show-ListView` command has one more useful parameter named `-ActionData` which I mentioned above but is worth mentioning again. Anything passed using this parameter will be set as the `$actionData` variable – this means your report and actions can pass custom data in them it can be as simple as an object or as complex as a hashtable so there is really no hard limit on what can progress from a report to report. Any object that was passed to `Show-ListView` using the `-ActionData` parameter will be available to your action. -##### Actions running in persistent sessions +#### Actions running in persistent sessions The persistent session ID will be respected and your script will run in that persistent session if it's already in memory or create a persistent session if it's not. Alternatively you can elect to simply freeze the session the initial script that generated report was running in and run actions in that same frozen session by using the `-ActionsInSession` parameter. -#### UI Elements +### UI Elements The `Show-ListView` command provides the _Hide_ parameter to control visibility of the UI elements. @@ -220,7 +222,7 @@ Get-ChildItem master:\ | ![Report with all UI elements hidden](https://cloud.githubusercontent.com/assets/1209953/11334655/bfede644-91d6-11e5-8473-6f94be74b3e5.png) -### Examples from the community! +## Examples from the community! -[Active Commerce](http://www.activecommerce.com/) for Sitecore product has published reports on Github that you can checkout [here](https://github.com/ActiveCommerce/activecommerce-powershell-extensions). +[Active Commerce](https://www.activecommerce.com/) for Sitecore product has published reports on Github that you can checkout [here](https://github.com/ActiveCommerce/activecommerce-powershell-extensions). diff --git a/modules/integration-points/tasks/README.md b/modules/integration-points/tasks/README.md new file mode 100644 index 00000000..03d37a8f --- /dev/null +++ b/modules/integration-points/tasks/README.md @@ -0,0 +1,61 @@ +# Tasks + +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 + +![Scheduled Task Editor](https://img.youtube.com/vi/Q6QKqRwrkuU/0.jpg) + +[Click for a demo](https://www.youtube.com/watch?v=Q6QKqRwrkuU) + +## Scheduled Task Command + +To help make the setup simple, we've provided a _Task Command_. + +![PowerShell Script Command](../../../.gitbook/assets/tasks-powershellscriptcommand.png) + +The command shown above is simply a type exposed as a public method in the _Spe_ 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. + +![PowerShell Script Task](../../../.gitbook/assets/tasks-archiveschedule.png) + +The _Items_ field contains the path to a script in the _Script Library_. + +Below are some of the scripts found out-of-the-box with SPE. + +| Module | Script | +| :--- | :--- | +| System Maintenance | Archive Sitecore logs, Clean up deleted items older than 30 days | +| User Session Management | Remove idle user sessions | + +## Create and Manage Tasks + +We've added a context menu item to provide you with a shortcut to the Task Scheduler Editor. + +Create a new scheduled task: + +![Insert Option for Task](../../../.gitbook/assets/task-inserttask.png) + +Run or edit the scheduled task: + +![Run or Edit Task Schedule](../../../.gitbook/assets/task-runedittask.png) + +The scheduled task is capable of running 1-to-many scripts. Choose all that apply for the selected task. Each script runs within a shared session, making it possible to share results between scripts. + +**Note:** Make use of the **Enable Rule** to take advantage of the rules engine. + +![Dialog to Select Task Scripts](../../../.gitbook/assets/task-createtaskwithscripts.png) + +The task schedule has an intuitive dialog for working with and changing the frequency. + +![Dialog to Edit Task Schedule](../../../.gitbook/assets/task-edittaskschedule.png) + +**Note:** Examples included are in the following modules + +* License Expiration +* Media Library Maintenance +* System Maintenance + +See how Adam added [powershell driven Sitecore scheduled tasks](https://github.com/SitecorePowerShell/Book/tree/a1cbd06eba0aad8913e553f4aaa08de0412c635a/modules/integration-points/tasks/[https:/blog.najmanowicz.com/2011/11/29/powershell-driven-sitecore-scheduled-tasks/]/README.md). + diff --git a/modules/integration-points/tasks/authoring-tasks.md b/modules/integration-points/tasks/authoring-tasks.md new file mode 100644 index 00000000..567da45c --- /dev/null +++ b/modules/integration-points/tasks/authoring-tasks.md @@ -0,0 +1,14 @@ +# Authoring Tasks + +The Sitecore task scheduler is capable of running PowerShell scripts when using the task command `PowerShellScriptCommand`. The `Task Management` module includes a few shortcuts to managing tasks. + +The module provides the ability to create, edit, and run scheduled tasks. + +![Scheduled Task Menu](../../../.gitbook/assets/context-menu-task-scheduler.png) + +![Edit Scheduled Task](../../../.gitbook/assets/context-menu-task-scheduler-edit.png) + +## References + +* [Custom Scheduled Task by Mike Reynolds](https://sitecorejunkie.com/2014/05/31/execute-powershell-scripts-in-scheduled-tasks-using-sitecore-powershell-extensions/) + diff --git a/modules/integration-points/toolbox.md b/modules/integration-points/toolbox.md new file mode 100644 index 00000000..7d8d9131 --- /dev/null +++ b/modules/integration-points/toolbox.md @@ -0,0 +1,90 @@ +# 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: + +![Toolbox](https://user-images.githubusercontent.com/933163/50113236-fda4b500-0206-11e9-8997-c629927a5148.png) + +**Note:** Examples included in the following modules + +* Authorable Reports +* Logged in Session Manager +* Package Generator +* Task Management +* Platform + +## Available Tools + +### Index Viewer + +This tool provides similar functionality to the [Index Viewer](https://marketplace.sitecore.net/en/Modules/I/Index_Viewer.aspx) module. Search and rebuild the index on-demand. + +![Index Viewer](https://user-images.githubusercontent.com/933163/50112430-d351f800-0204-11e9-9d5c-07c99c163205.png) + +### Logged in Session Manager + +View the list of user sessions and "kick" them out as needed. + +![Logged in Session Manager](https://user-images.githubusercontent.com/933163/50112838-e1ecdf00-0205-11e9-8959-9d4332859162.png) + +### Rules based report + +Generate a report using the Sitecore Rules Engine. + +![Rules based report](https://user-images.githubusercontent.com/933163/50112876-fd57ea00-0205-11e9-89ac-f407ada390a8.png) + +### PowerShell Background Session Manager + +View the list of SPE sessions and "kill" them as needed. + +![PowerShell Background Session Manager](https://user-images.githubusercontent.com/933163/50112986-51fb6500-0206-11e9-8c4e-2905f1378dc9.png) + +### Create Anti-Package + +This tool provides similar functionality to the [Sitecore Rocks](https://github.com/SitecorePowerShell/Book/tree/9c7126d7a38df6ef372e8baef52f9a02baabd550/modules/integration-points/[https:/marketplace.sitecore.net/en/Modules/S/Sitecore/_Rocks.aspx]) module. + +![Create Anti-Package](https://user-images.githubusercontent.com/933163/50112920-1fea0300-0206-11e9-9a37-138c9cb9f273.png) + +### Re-create Site from Sitemap + +Simple tool for generating a site tree using an existing sitemap. + +![Re-create Site from Sitemap](https://user-images.githubusercontent.com/933163/50113021-68a1bc00-0206-11e9-8f82-e7bc1d8eaefd.png) + +### Task Manager + +View and manage the configured scheduled tasks. + +![Task Manager](https://user-images.githubusercontent.com/933163/50113111-a30b5900-0206-11e9-84b1-5ce866bb1d85.png) + +## Create Tools for the Toolbox + +To create your own Toolbox item take the following steps: 1. Create the _Toolbox_ folder under an SPE module. Use the context menu to simplify the process. + +* Right click the module name and choose Scripts -> Create libraries for integration points. + + ![Module Libraries](../../.gitbook/assets/module-createlibraries.png) + +* Select the _Toolbox_ item and click _Proceed_. + + ![Module Toolbox Library](../../.gitbook/assets/module-createtoolboxlibrary.png) + + 1. Create a _PowerShell Script_ under the _Toolbox_ item. + +* Right click the _Toolbox_ library and choose _PowerShell Script_. + + ![Libary Script](../../.gitbook/assets/library-createscript.png) + + 1. Open and edit the _PowerShell Script_ using the ISE. + + ![ISE Edit](../../.gitbook/assets/script-editise.png) + + 2. 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. + + ![ISE Settings Tab](../../.gitbook/assets/ise-settingstab.png) + + 3. Verify the new toolbox item appears in the Toolbox. + + ![Toolbox](https://user-images.githubusercontent.com/933163/50113236-fda4b500-0206-11e9-8997-c629927a5148.png) + diff --git a/modules/integration-points/web-api.md b/modules/integration-points/web-api.md new file mode 100644 index 00000000..fdfd47d4 --- /dev/null +++ b/modules/integration-points/web-api.md @@ -0,0 +1,51 @@ +# Web API + +The **Web API** integration point exposes scripts through a url. This can be especially helpful when a script needs to be executed on the server but without knowledge of the script contents. + +The url will look something like the following: [https://remotesitecore/-/script/v2/master/homeanddescendants?user=sitecore\admin&password=b](https://remotesitecore/-/script/v2/master/homeanddescendants?user=sitecore\admin&password=b) + +Here's the url broken down: + +* **API Version** - Specifies which service is being requested. + * `v2` - This is the service that executes scripts stored in the integration point library. +* **Database** - Specifies which database contains the script. + * `master` - This database requires the credentials to be provided. +* **Script** - Specifies the name of the script contained in the database. The SPE module containing the script needs to be enabled otherwise you'll receive a 404 error. + * `homeanddescendants` - Replace this name with whatever your script is called in the Web API library. +* **Query String Parameters (deprecated)** - Specifies the additional bits of data for use by the web service. + * `user` and `password` - Authenticates the request and in most cases will be needed. If the script is published to the _web_ database the credentials are not required. You should use the **Basic** header instead of the query string. + * All of the query string parameters added to the variable `scriptArguments`. Use this PowerShell hashtable inside of your scripts. Check out the function `Invoke-ApiScript` for an example of how these parameters can be put to good use. + +Headers: + +Use the **Basic** header to provide authentication information. Here is an example of how to build that for a script. + +```powershell +$username = "admin" +$password = "b" + +$pair = "$($username):$($password)" + +$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair)) + +$basicAuthValue = "Basic $encodedCreds" + +$headers = @{ + Authorization = $basicAuthValue +} + +Invoke-RestMethod -Headers $headers -Uri "https://spe.dev.local/-/script/v2/master/TrainingWebApi?offset=3&limit=2&fields=(Name,ItemPath,Id)" +``` + +**Note:** Examples included in the following modules + +* Getting Started + +## Security + +The integration point is disabled by default and can be enabled through configuration as described [here](../../security/). See **Restfulv2**. Be sure to enable the SPE script module in the content tree. + +## References + +* Watch Adam present this and much more on Sitecore! Experienced [here](https://vimeo.com/134196432). + diff --git a/modules/integration-points/workflows.md b/modules/integration-points/workflows.md new file mode 100644 index 00000000..f720137f --- /dev/null +++ b/modules/integration-points/workflows.md @@ -0,0 +1,29 @@ +# Workflows + +The _Workflows_ integration allows for scripts to run like workflow commands. Rules can be used to control visiblity and enablement. The script is only executed when the command is triggered. + +1. Begin by adding a new item to a workflow command of template type `/Modules/PowerShell Console/PowerShell Script Workflow Action`. We've added an insert option to help with this. +2. Edit the _Type string_ field to your custom type or to the built in type `Spe.Integrations.Workflows.ScriptAction, Spe`. +3. Edit the _Script body_ with the appropriate script. I like to save my workflow scripts in a library called _Workflows_. +4. Configure the **Enable** rules on the workflow action item to specify when to execute. Leave the rule alone if you wish for it to execute any time the command is activated. +5. Edit the script in your _Workflows_ library to perform the appropriate actions. The script can run in the background and show dialogs. +6. Change the icon of the workflow action item to match the script purpose. +7. Celebrate your success with the team! + +**Example:** The following requests input from the user then writes to the workflow history. + +```powershell +$item = $SitecoreContextItem +$comment = Show-Input -Prompt "Enter a comment:" +if($comment) { + New-ItemWorkflowEvent -Item $item -Text $comment +} +Close-Window +``` + +See how Adam integrated [workflow actions](https://blog.najmanowicz.com/2014/11/09/introducing-powershell-actions-for-sitecore-workflows/) if you are really curious to know more. + +## References + +* [Fixing problematic content or Workflow state](https://www.cognifide.com/blogs/sitecore/feel-the-power-in-powershell/) + diff --git a/modules/libraries-and-scripts.md b/modules/libraries-and-scripts.md new file mode 100644 index 00000000..5029c738 --- /dev/null +++ b/modules/libraries-and-scripts.md @@ -0,0 +1,120 @@ +# Libraries and Scripts + +Modules may contain _PowerShell Script Library_ items and _PowerShell Script_ items. The following section outlines some of the basic concepts you need to know for the following chapters. + +## PowerShell Script Library + +The library items represent a collection of scripts, and may be structured with one or more levels of libraries. + +### Naming Convention + +You'll find that with the _Integration Points_ some libraries should be created with specific names \(i.e. Content Editor, Control Panel\). + +As a best practice we recommend that the _Functions_ library consist of reusable scripts containing PowerShell functions \(i.e. `Do-Something`\) while other libraries contain the solution specific scripts \(i.e. `MakeScriptingGreatAgain`\). + +**Example:** The following demonstrates the use of the _Functions_ script library containing _Get-DateMessage_. + +```powershell +# /sitecore/system/modules/powershell/script library/spe rocks/functions/get-datemessage +function Get-DateMessage { + "The current date and time is: $(Get-Date)" +} +``` + +```powershell +# /sitecore/system/modules/powershell/script library/spe rocks/alerts/show-datemessage +Import-Function -Name Get-DateMessage + +Show-Alert (Get-DateMessage) +``` + +Some names we've used included: + +* Beginner Tutorials +* **Content Editor** +* Content Maintenance +* Content Interrogation +* Development +* **Event Handlers** +* **Functions** +* **Internal** +* **Page Editor** +* **Pipelines** +* Profile and Security +* **Reports** +* Script Testing +* **Tasks** +* **Toolbox** +* User Interaction +* **Web API** + +{% hint style="info" %} +Many of the libraries are integration points for the module. When the integration point wizard runs, you will see that these can be generated automatically. +{% endhint %} + +### Fields + +**Interactive** : The following fields support the two custom rules as well as a variety of out-of-the-box rules. + +* **ShowRule** \(Show if rules are met or not defined\) - typically controls visibility of integration points. + * **PowerShell** + * where _specific_ persistent PowerShell session was already initiated + * where _specific_ persistent PowerShell session was already initiated and has the _specific_ variable defined and not null + * where exposed in a _specific_ view + * **PowerShell ISE** + * when _length_ script length is _compares to_ _number_ characters long + * when the edited script is _in a state_ +* **EnableRule** \(Enable if rules are met or not defined\) - typically controls enabled state of integration points. + * _**Same as above**_ + +#### Rules Usage + +There are a number of use cases for the **EnableRule** and **ShowRule**. + +* If there is a UI component the **ShowRule** can be used to ensure it appears while the **EnableRule** can toggle when it can be clicked. +* If there is no UI component, the **EnableRule** is used to determine when the script should be executed; useful to limit creation of PowerShell runspaces. + +| ShowRule | EnableRule | +| :--- | :--- | +| Content Editor [Context Menu](integration-points/content-editor.md#context-menu) | Content Editor [Context Menu](integration-points/content-editor.md#context-menu) | +| | Content Editor [Gutter](integration-points/content-editor.md#gutter) | +| Content Editor [Insert Item](integration-points/content-editor.md#insert-item) | | +| Content Editor [Ribbon](integration-points/content-editor.md#ribbon) | Content Editor [Ribbon](integration-points/content-editor.md#ribbon) | +| | Content Editor [Warning](integration-points/content-editor.md#warning) | +| | [DataSources](integration-points/data-sources.md) | +| | [Event Handlers](integration-points/event-handlers.md) | +| ISE Plugin | ISE Plugin | +| [Reports](integration-points/reports/) | [Reports](integration-points/reports/) | +| Reports List View Action | Reports List View Action | +| Reports List View Export | Reports List View Export | +| | Page Editor [Notification](integration-points/page-editor.md#notification) | +| | Page Editor [Experience Button](integration-points/page-editor.md#experience-button) | +| | [Pipelines](integration-points/pipelines.md) | +| | [Tasks](integration-points/tasks/) | +| [Toolbox](integration-points/toolbox.md) | | +| | [Workflow Action](integration-points/workflows.md) | + +## PowerShell Script + +The script items represent the code that will be executed. + +### Naming Convention + +There are three conventions that we recommend you follow which are shown with an example below. + +* **Title Casing** - This should be used when the name will be exposed in places such as the _Content Editor_, script library names, and _Reports_ root directory. +* **Sentence casing** - This should be used when the name is long and will not be visible to the user or is a report with a very long name. +* **Noun-Verb** - This should be used when the script is stored within the _Functions_ script library and will be imported using the command _Import-Function_. + +### Fields + +**Interactive** : Refer to the description shown for _PowerShell Script Library_ [fields](libraries-and-scripts.md#fields). + +**Scripting** + +* **Script** \(Script body\) : This is a multi-line text than should be edited using the **PowerShell ISE** application. + +**Session Persistency** + +* **PersistentSessionId** \(Persistent Session ID\) : Context scripts using this ID will execute in a single session and be reused; leaving empty will cause the session to be discarded after execution. This value should be used for rules requesting the session ID. + diff --git a/modules/packaging.md b/modules/packaging.md new file mode 100644 index 00000000..7b179d28 --- /dev/null +++ b/modules/packaging.md @@ -0,0 +1,108 @@ +# Packaging + +Ever wanted to package up items and files without opening the Sitecore Package Designer each time? There are a number of commands available for generating packages. + +## Package Creation + +**Example:** The following example demonstrates how to generate a package. + +```powershell +$package = New-Package "Package-of-Stuff" +$package.Sources.Clear() + +$package.Metadata.Author = "Michael West" +$package.Metadata.Publisher = "Team Awesome" +$package.Metadata.Version = "1.0" +$package.Metadata.Readme = @" +Set of instructions for the user. +"@ + +# Items using New-ItemSource and New-ExplicitItemSource +$source = Get-Item -Path "master:\templates\Feature\Forms" | + New-ItemSource -Name 'Feature Forms Items' -InstallMode Overwrite +$package.Sources.Add($source) + +# Files using New-FileSource and New-ExplicitFileSource +$source = Get-Item -Path "$AppPath\App_Config\Include\Feature\Forms\Company.Feature.Forms.config" | + New-ExplicitFileSource -Name "Feature Forms Files" +$package.Sources.Add($source) + +Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).xml" +Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip +Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip" +``` + +## Post Step + +**Example:** The following adds a Post Step and custom attributes. + +```powershell +$package = New-Package "Package-of-Stuff" +$package.Sources.Clear() + +$package.Metadata.Author = "Michael West" +$package.Metadata.Publisher = "Team Awesome" +$package.Metadata.Version = "1.0" +$package.Metadata.Readme = @" +Set of instructions for the user. +"@ +$package.Metadata.PostStep = "Some.Library.Class,Some.Library" +$package.Metadata.Attributes = "scriptId={9b9a3906-1979-11e7-8c9d-177c30471cec}|width=50|height=200" + +Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).xml" +``` + +**Example:** The following adds a Post Step included with SPE to delete a file. The SPE Post Step code reads xml data stored in the comment section of the package. + +```powershell +Import-Function -Name New-PackagePostStep + +$package = New-Package "Package-of-Stuff" +$package.Sources.Clear() + +$package.Metadata.Author = "Michael West" +$package.Metadata.Publisher = "Team Awesome" +$package.Metadata.Version = "1.0" +$package.Metadata.Readme = @" +Set of instructions for the user. +"@ +$newPackageFiles = @([PSCustomObject]@{"FileName"="/bin/Company.Feature.Unused.dll"}) +$package.Metadata.PostStep = "Spe.Package.Install.PackagePostStep, Spe.Package" +$package.Metadata.Comment = New-PackagePostStep -PackageFiles $newPackageFiles +``` + +**Example:** The following adds a Post Step Script included with SPE to change icons. The SPE Post Step code executes a script included with the package as stored in the attributes section. + +```powershell +$package = New-Package "Package-of-Stuff" +$package.Sources.Clear() + +$package.Metadata.Author = "Michael West" +$package.Metadata.Publisher = "Team Awesome" +$package.Metadata.Version = "1.0" +$package.Metadata.Readme = @" +Set of instructions for the user. +"@ +$package.Metadata.PostStep = "Spe.Integrations.Install.ScriptPostStep, Spe" +$package.Metadata.Attributes = "scriptId={737CD0CC-12F7-4528-8FBD-E0FDEFC41325}" +``` + +```powershell +Write-Log "Processing changes to ensure backwards compatibility." +$oldVersion = New-Object System.Version(10,0) +if($PSVersionTable["SitecoreVersion"] -lt $oldVersion) { + $iseButton = Get-Item -Path "core:{bfc79034-857c-4432-a5c2-2d93af784384}" + $iseButton.Editing.BeginEdit() + $iseButton.Fields["{D25B56D4-23B6-4462-BE25-B6A6D7F38E13}"].Value = "powershell/32x32/ise8.png" + $iseButton.Editing.EndEdit() > $null + + $reportButton = Get-Item -Path "core:{74744022-353c-43f1-b8e4-5bc569ca9348}" + $reportButton.Editing.BeginEdit() + $reportButton.Fields["{D25B56D4-23B6-4462-BE25-B6A6D7F38E13}"].Value = "Office/32x32/chart_donut.png" + $reportButton.Editing.EndEdit() > $null + Write-Log "Changes complete." +} else { + Write-Host "No changes required." +} +Close-Window +``` diff --git a/pipelines.md b/pipelines.md deleted file mode 100644 index 253a2704..00000000 --- a/pipelines.md +++ /dev/null @@ -1,16 +0,0 @@ -# Pipelines - -### Logged In - -**Note:** Examples included in the following modules -* Automatically show quick info section - -### Logging in Piepline - -**Note:** Examples included in the following modules -* Enforce user password expiration - -### Logout Pipeline - -**Note:** Examples included in the following modules -* Unlock user items on logout \ No newline at end of file diff --git a/releases.md b/releases.md index 631c82f8..ed087dff 100644 --- a/releases.md +++ b/releases.md @@ -1,203 +1,10 @@ # 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][1] or report issues on [Github][2]. +Thank you for taking the time to check out the latest and greatest changes for SPE. Send a tweet sharing how much you love the module on [Twitter](https://twitter.com/scriptingspe). -## Version 4.5 +The following links provide a way to report issues and get the latest release. +* [Book issue tracker](https://github.com/SitecorePowerShell/Book/issues) +* [Module issue tracker](https://github.com/SitecorePowerShell/Console/issues) +* [Module releases](https://github.com/SitecorePowerShell/Console/releases) -- [Full issue list available on GitHub](https://github.com/SitecorePowerShell/Console/issues?q=is%3Aissue+is%3Aclosed+milestone%3A4.5) -- [Release highlights](https://github.com/SitecorePowerShell/Console/issues?q=is%3Aissue+label%3A-release-highlight+is%3Aclosed+milestone%3A4.5) - -### Summary of important changes - -#### [Breaking Changes](https://github.com/SitecorePowerShell/Console/issues?q=is%3Aissue+is%3Aclosed+milestone%3A4.5+is%3Aissue%20label%3Aimpact-breaking-change) -- no breaking changes - -#### [Major new Features](https://github.com/SitecorePowerShell/Console/issues?q=is%3Aissue+label%3A-release-highlight+is%3Aclosed+milestone%3A4.5) - -- SPE learned how to merge Shared and Final layouts using `Merge-Layout`. [[669](https://github.com/SitecorePowerShell/Console/issues/669)] -- SPE learned how to copy fields when using `Set-ItemTemplate`. [[847](https://github.com/SitecorePowerShell/Console/issues/847)] -- The `User` and `Role` objects now contain a properties for membership. Use either `Roles`, `Users`, or `MemberOf`. [[842](https://github.com/SitecorePowerShell/Console/issues/842)] -- Scripted datasources now work with multiple roots. [[845](https://github.com/SitecorePowerShell/Console/issues/845)] - -#### [All improvements](https://github.com/SitecorePowerShell/Console/issues?q=is%3Aissue+label%3Aimprovement+is%3Aclosed+milestone%3A4.5) - -- The Toolbox item **Background Session Manager** and ISE command **Rebuild Integration Points** are now hidden for users not in the developers group. [[850](https://github.com/SitecorePowerShell/Console/issues/850)] -- The ISE command **Rebuild Integration Points** is now available as a Toolbox item. [[849](https://github.com/SitecorePowerShell/Console/issues/849)] -- A new report added for custom template usage count. [[818](https://github.com/SitecorePowerShell/Console/issues/818)] - -#### [All Fixes](https://github.com/SitecorePowerShell/Console/issues?q=is%3Aissue+label%3Abug+is%3Aclosed+milestone%3A4.5) - -*** - -## Version 4.4 - -Improvements for SXA 1.3, security feature updates and remoting fixes! - -This release major focus was stability and overcoming any problems that were reported by our users. -- [Full issue list available on GitHub](https://github.com/SitecorePowerShell/Console/issues?q=is%3Aissue+is%3Aclosed+milestone%3A4.4) -- [Release highlights](https://github.com/SitecorePowerShell/Console/issues?q=is%3Aissue+label%3A-release-highlight+is%3Aclosed+milestone%3A4.4) - -### Summary of important changes - -#### [Breaking Changes](https://github.com/SitecorePowerShell/Console/issues?q=is%3Aissue+is%3Aclosed+milestone%3A4.4+is%3Aissue%20label%3Aimpact-breaking-change) -- no breaking changes - -#### [Major new Features](https://github.com/SitecorePowerShell/Console/issues?q=is%3Aissue+label%3A-release-highlight+is%3Aclosed+milestone%3A4.4) - -- It's now possible to access custom fields on items using the syntax using `._` and `.PSFields`. The properties are returned using the appropriate field type such as `ImageField`. [[810](https://github.com/SitecorePowerShell/Console/issues/810)] -- A new command `Invoke-JavaScript` was added to enable scripts to interact with the browser. [[803](https://github.com/SitecorePowerShell/Console/issues/803)] -- `Update-ListView` command learned to update the banner text in the report viewer. [[789](https://github.com/SitecorePowerShell/Console/issues/789)] -- `Copy-Item` command learned to move blob data between databases. [[782](https://github.com/SitecorePowerShell/Console/issues/782)] -- PowerShell previously included the `-Depth` parameter to limit the recursive nature of the command. The CMS provider is now able to work that magic. [[769](https://github.com/SitecorePowerShell/Console/issues/769)] - -#### [All improvements](https://github.com/SitecorePowerShell/Console/issues?q=is%3Aissue+label%3Aimprovement+is%3Aclosed+milestone%3A4.4) - -#### [All Fixes](https://github.com/SitecorePowerShell/Console/issues?q=is%3Aissue+label%3Abug+is%3Aclosed+milestone%3A4.4) - -*** - -## Version 4.3 - -Security, Security, security! This release major focus was security. - -- [Full issue list available on GitHub](https://github.com/SitecorePowerShell/Console/issues?q=is%3Aissue+is%3Aclosed+milestone%3A4.3) -- [Release highlights](https://github.com/SitecorePowerShell/Console/issues?q=is%3Aissue+label%3A-release-highlight+is%3Aclosed+milestone%3A4.3) - -### Summary of important changes - -#### [Breaking Changes](https://github.com/SitecorePowerShell/Console/issues?q=is%3Aissue+is%3Aclosed+milestone%3A4.3+is%3Aissue%20label%3Aimpact-breaking-change) -- Removed the lingering nVelocity template presentation -- ISE and Console now require scripters to be in `Sitecore\Developer` role - -#### [Major new Features](https://github.com/SitecorePowerShell/Console/issues?q=is%3Aissue+label%3A-release-highlight+is%3Aclosed+milestone%3A4.3) -- All arbitrary script executions, saves, and session elevation events are now logged in the SPE Sitecore logs[763](https://github.com/SitecorePowerShell/Console/issues/763) -- Added ability to specify that an endpoint can only be accessed over a secure connection [759](https://github.com/SitecorePowerShell/Console/issues/759) -- Executing scripts through Integration points now verify the item templates so no unprotected scripts can be executed. [757](https://github.com/SitecorePowerShell/Console/issues/757) -- Saving a script in library requires additional authentication (Session elevation) [756](https://github.com/SitecorePowerShell/Console/issues/756) -- Executing a script in ISE or Console now require additional authentication. [755](https://github.com/SitecorePowerShell/Console/issues/756) -- Send-File cmdlet dialog no longer uses URL parameters for paths.[744](https://github.com/SitecorePowerShell/Console/issues/744) - -#### [All improvements](https://github.com/SitecorePowerShell/Console/issues?q=is%3Aissue+label%3Aimprovement+is%3Aclosed+milestone%3A4.3) -#### [All Fixes](https://github.com/SitecorePowerShell/Console/issues?q=is%3Aissue+label%3Abug+is%3Aclosed+milestone%3A4.3) - -*** - -## Version 4.2 - -This release major focus was security and making your scripting testable and better functional for users in different roles and languages. We've also improved cmdlets for working with templates and as always improved our remoting module to make it even more functional in your CI scenarios. - -[Full issue list available on GitHub](https://github.com/SitecorePowerShell/Console/issues?q=is%3Aissue+is%3Aclosed+milestone%3A4.2) - 38 issues. - -### Summary of important changes - -#### [Breaking Changes](https://github.com/SitecorePowerShell/Console/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3Aimpact-breaking-change%20is%3Acosed%20milestone%3A%224.2%22) - -- You might want to check how your scripts behave for users in other languages as we're now setting the context language on the Job, which e.g. impacts how items are retrieved. [694] -- All remotely accessible services are now disabled by default [716](https://github.com/SitecorePowerShell/Console/issues/716) so you need to provide a patch config file if you want to use SPE in your CI environment out-of-the-box. - -#### [Major new Features](https://github.com/SitecorePowerShell/Console/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3A-release-highlight%20is%3Acosed%20milestone%3A%224.2%22%20) - -- `Read-Variable` cmdlet now supports validation on field and form level [728](https://github.com/SitecorePowerShell/Console/issues/728). -- ISE now allows you to emulate script execution in context of any user or language [726](https://github.com/SitecorePowerShell/Console/issues/726). -- Added `Update-ItemReferrer` cmdlet that allows you to re-link an item to another item or delete references to an item before e.g. deleting it. [726](https://github.com/SitecorePowerShell/Console/issues/726). -- Introduced Role/User based restriction for user access to endpoints. [715](https://github.com/SitecorePowerShell/Console/issues/715) - -#### Enhancements -- Full list of improvements can be found [here](https://github.com/SitecorePowerShell/Console/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3Aimprovement%20is%3Acosed%20milestone%3A%224.2%22%20) - -#### Fixes -- Full list of bugs fixed can be found [here](https://github.com/SitecorePowerShell/Console/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3Abug%20is%3Acosed%20milestone%3A%224.2%22%20) - -*** - -## Version 4.1 - -Another solid release. Yet again a fairly long wait but we;ve fixed a ton of bugs and did some solid improvements. Happy scripting! - -[Full issue list available on GitHub](https://github.com/SitecorePowerShell/Console/issues?q=is%3Aissue+is%3Aclosed+milestone%3A4.1) - over 60 issues. - -### Summary of important changes - -#### Breaking Changes - -- Get-RoleMember should return Role and User rather than AccountList [637](https://github.com/SitecorePowerShell/Console/issues/637). -- Publish-Item publishing behaviour was tuned to handle typical scenarios better [620](https://github.com/SitecorePowerShell/Console/issues/620). - -#### New Features -- Support for Sitecore 8.2 - -#### Enhancements -- ... - -#### Fixes - -- ... - -*** - -## Version 4.0 - -A lot of hard work went into this release. Wasn't released as soon as we hoped, but we are certain many of you will be pleased with the results. Happy coding! - -[Full issue list available on GitHub](https://github.com/SitecorePowerShell/Console/issues?q=is%3Aissue+is%3Aclosed+milestone%3A4.0) - 90+ issues. - -### Summary of important changes - -#### Breaking Changes - -- The `Rebuild-SearchIndex` command now returns an existing job [558](https://github.com/SitecorePowerShell/Console/issues/558) for an index if currently rebuilding. -- Request related variables such as `$HttpContext` are no longer added to the session [557](https://github.com/SitecorePowerShell/Console/issues/557) but can still be accessed through their static context properties. -- The `Publish-Item` command now supports the additional publishing options [539](https://github.com/SitecorePowerShell/Console/issues/539) introduced in Sitecore 7.1. The default behavior was changed to synchronous and requires the `AsJob` parameter to run asynchronously. -- The `Add-ItemLanguage` and `Remove-ItemLanguage` commands were renamed [532](https://github.com/SitecorePowerShell/Console/issues/532) to `Add-ItemVersion` and `Remove-ItemVersion` since item versions and languages are managed almost the same. -- The user management commands received an adjustment [520](https://github.com/SitecorePowerShell/Console/issues/520) [498](https://github.com/SitecorePowerShell/Console/issues/498) [497](https://github.com/SitecorePowerShell/Console/issues/497) in which `New-Role` no longer requires `-Passthru` to output the resulting account. Also, the `Remove-User` command now accepts the `User` object as input. -- User reported [511](https://github.com/SitecorePowerShell/Console/issues/511) that SPE conflicted with the **InSite Commerce** product due to the 2.x services location so we went ahead and broke compatibility. -- Some users have encountered items with multiple fields of the same name [575](https://github.com/SitecorePowerShell/Console/issues/575) so we changed the behavior by prefixing the name with and underscore recurrently to disambiguate them. -- Stop using `$PSScriptRoot` and `$PSCommandPath` and start using `$SitecoreScriptRoot` and `$SitecoreCommandPath` [588](https://github.com/SitecorePowerShell/Console/issues/588). - -#### New Features - -- A new Experience Button integration point was added [546](https://github.com/SitecorePowerShell/Console/issues/546). -- Method signature in the ISE received a face lift [541](https://github.com/SitecorePowerShell/Console/issues/541). Now you can see the argument data types! -- Type names now autocomplete [540](https://github.com/SitecorePowerShell/Console/issues/540). -- SPE Remoting now supports uploading large files [528](https://github.com/SitecorePowerShell/Console/issues/528). -- Rebuilding the index for single items is now possible [523](https://github.com/SitecorePowerShell/Console/issues/523) with `Rebuild-SearchIndexItem` and removing with `Remove-SearchIndexItem`. -- Added a report [513](https://github.com/SitecorePowerShell/Console/issues/513) for unpublished items in one or more targets. -- Users can now peek the session variable values by way of a tooltip [495](https://github.com/SitecorePowerShell/Console/issues/495). -- The ISE now shows when a script is modified or not yet saved [458](https://github.com/SitecorePowerShell/Console/issues/458). -- New variable `$SitecoreAuthority` is initialized with the site hostname [591](https://github.com/SitecorePowerShell/Console/issues/591). - -#### Enhancements - -- We went crazy on the styling of the console windows so now you can [565](https://github.com/SitecorePowerShell/Console/issues/565) configure the foreground and background colors. The `Show-Result` command also retains [566](https://github.com/SitecorePowerShell/Console/issues/566) the colors of the host session. -- Variables are now hidden from the autocomplete [560](https://github.com/SitecorePowerShell/Console/issues/560) unless the token begins with a `$`. -- The `ScriptSession` now contains a property *LastErrors* [559](https://github.com/SitecorePowerShell/Console/issues/559) that contains the errors encountered in a script rather than cluttering the log. -- The `Publish-Item` command suggests database names [553](https://github.com/SitecorePowerShell/Console/issues/553) and *filesystem* is no longer an option. -- The export command in reports no longer require a temporary file [551](https://github.com/SitecorePowerShell/Console/issues/551). This should now add support in hosted environments such as Azure [549](https://github.com/SitecorePowerShell/Console/issues/549)[529](https://github.com/SitecorePowerShell/Console/issues/529). -- The `Show-ListView` command now enumerates collections [544](https://github.com/SitecorePowerShell/Console/issues/544) rather than printing the class name. -- The `UseDefaultCredentials` parameter is now supported [531](https://github.com/SitecorePowerShell/Console/issues/531) when using the `New-ScriptSession` command in SPE Remoting. -- The `Publish-Item` command will not publish to all targets by default [530](https://github.com/SitecorePowerShell/Console/issues/530) without requiring the target to be specified. -- Some of the UI elements using `Show-ListView` can be hidden when using the *Hide* parameter [521](https://github.com/SitecorePowerShell/Console/issues/521). -- Your favorite commands `Get-Item` and `Get-ChildItem` now have [519](https://github.com/SitecorePowerShell/Console/issues/519) tab completion on the `-Language` and `-Database` parameters. -- SPE Remoting supports `$using:[variablename]` in the scriptblock [499](https://github.com/SitecorePowerShell/Console/issues/499). -- Changed the behavior of `Add-ItemLanguage` so that it outputs the existing latest version if it exists [578](https://github.com/SitecorePowerShell/Console/issues/578). -- Sometimes you need to grant Acls for System Roles like *Everyone* and *Creator-Owner* so we've updated [596](https://github.com/SitecorePowerShell/Console/issues/596) [595](https://github.com/SitecorePowerShell/Console/issues/595) our security commands like `Get-Role` and `New-ItemAcl` to support that scenario. -- `ScriptSession` can now load type info without the need for `Set-ExecutionPolicy` changes [590](https://github.com/SitecorePowerShell/Console/issues/590). -- The Live Autocomplete feature when typing was so powershell we decided to allow you to enable or disable [584](https://github.com/SitecorePowerShell/Console/issues/584). -- Save time with `Get-ChildItem` by using the `-WithParent` parameter [580](https://github.com/SitecorePowerShell/Console/issues/580). -- Specifying the `ProfileItemId` when using `New-User` is now possible through [573](https://github.com/SitecorePowerShell/Console/issues/573). -- Downloading a file is a little more secure as the download form displayed by `Send-File` hides the file path by default. You can however still show it with `-ShowFullPath` switch [568](https://github.com/SitecorePowerShell/Console/issues/568). - -#### Fixes - -- The SPE Remoting commands `Send-RemoteItem` and `Receive-RemoteItem` now use `Write-Error` when an error is encountered [564](https://github.com/SitecorePowerShell/Console/issues/564). -- The `Show-Result` command was not adhering to the font settings [552](https://github.com/SitecorePowerShell/Console/issues/552). -- The `GetItemWorkflowEvent` command threw exceptions for missing optional parameters [545](https://github.com/SitecorePowerShell/Console/issues/545). -- Automatic properties no longer require a restart to update [534](https://github.com/SitecorePowerShell/Console/issues/534). -- Creating new branch items now respects [577](https://github.com/SitecorePowerShell/Console/issues/577) the specified language. -- Adam was going crazy trying to resolve an issue [579](https://github.com/SitecorePowerShell/Console/issues/579) where `Set-Layout` wasn't working. We think he's better now and the doctor released him from the clinic. -- - Through SPE Remoting you are now able to cleanup background `ScriptSessions` through the use of `Stop-ScriptSession` [594](https://github.com/SitecorePowerShell/Console/issues/594) [593](https://github.com/SitecorePowerShell/Console/issues/593). -- Users with more restricted access caused an issue with function caching [592](https://github.com/SitecorePowerShell/Console/issues/592). - - -[1]: https://marketplace.sitecore.net/en/Modules/Sitecore_PowerShell_console.aspx -[2]: https://git.io/spe \ No newline at end of file +See the [Appendix](/appendix) for a compatibility matrix. diff --git a/remoting.md b/remoting.md index 40e0f390..14ed5c11 100644 --- a/remoting.md +++ b/remoting.md @@ -2,27 +2,28 @@ There are a number of use cases where you need to remotely run scripts within SPE. Here we will try to cover a few of those use cases. -### Remoting Automation Service +## Remoting Automation Service We have provided a handy way of executing scripts via web service using the Remoting Automation Service. -#### Remoting Module Setup +### Remoting Module Setup -The setup of the module only requires a few steps: -1. In the Sitecore instance install the Sitecore module package. -2. On the local desktop or server install the SPE Remoting module. - * After downloading you may need to *unblock* the file by right-clicking the zip and unblocking. - * Ensure that you have run `Set-ExecutionPolicy RemoteSigned` in order for the SPE Remoting module will run. This typically requires elevated privileges. -3. Enable the *remoting* service through a configuration patch. See the [Security](/security.md) page for more details. -4. Grant the *remoting* service user account through a configuration patch and granting acess to the appropriate role. See the [Security](/security.md) page for more details. +The setup of the module only requires a few steps: 1. In the Sitecore instance install the Sitecore module package. 2. On the local desktop or server install the SPE Remoting module. -[![SPE Remoting Module](http://img.youtube.com/vi/fGvT8eDdWrg/0.jpg)](http://www.youtube.com/watch?v=fGvT8eDdWrg "Click for a quick demo") +* After downloading you may need to _unblock_ the file by right-clicking the zip and unblocking. +* Ensure that you have run `Set-ExecutionPolicy RemoteSigned` in order for the SPE Remoting module will run. This typically requires elevated privileges. + 1. Enable the _remoting_ service through a configuration patch. See the [Security](security/) page for more details. + 2. Grant the _remoting_ service user account through a configuration patch and granting acess to the appropriate role. See the [Security](security/) page for more details. -The remoting services use a combination of a SOAP service (ASMX) and HttpHandler (ASHX). Remoting features are disabled by default and should be configured as needed as can be seen in the [security section here](security.md). The SOAP service may require additional Windows authentication using the `-Credential` parameter which is common when logged into a Windows Active Directory domain. +![SPE Remoting Module](https://img.youtube.com/vi/fGvT8eDdWrg/0.jpg) -#### Windows Authenticated Requests +[Click for a demo](https://www.youtube.com/watch?v=fGvT8eDdWrg) -If you have configured the web services to run under *Windows Authentication* mode in IIS then you'll need to use the **Credential** parameter for the commands. +The remoting services use a combination of a SOAP service \(ASMX\) and HttpHandler \(ASHX\). Remoting features are disabled by default and should be configured as needed as can be seen in the [security section here](security/). The SOAP service may require additional Windows authentication using the `-Credential` parameter which is common when logged into a Windows Active Directory domain. + +### Windows Authenticated Requests + +If you have configured the web services to run under _Windows Authentication_ mode in IIS 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: @@ -41,7 +42,7 @@ Stop-ScriptSession -Session $session # Name Domain IsAdministrator IsAuthenticated # ---- ------ --------------- --------------- -# sitecore\admin sitecore True False +# sitecore\admin sitecore True False ``` **Example:** The following connects to several remote instances of Sitecore and returns the server name. @@ -54,11 +55,11 @@ Invoke-RemoteScript -Session $session -ScriptBlock { $env:computername } Stop-ScriptSession -Session $session ``` -#### File and Media Service +### File and Media Service -We have provided a service for downloading all files and media items from the server. This disabled by default and can be enabled using a patch file. See the [Security](security.md) page for more details about the services available and how to configure. +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](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 file from the _Package_ directory. ```powershell Import-Module -Name SPE @@ -76,11 +77,13 @@ Receive-RemoteItem -Session $session -Path "/Default Website/cover" -Destination Stop-ScriptSession -Session $session ``` -#### Script Sessions and Web API Tutorial +### Script Sessions and Web API Tutorial + +![SPE Web API](https://img.youtube.com/vi/SmZBGKOryzQ/0.jpg) -[![SPE Web API](http://img.youtube.com/vi/SmZBGKOryzQ/0.jpg)](https://www.youtube.com/watch?v=SmZBGKOryzQ "Click for a quick demo") +[Click for a demo](https://www.youtube.com/watch?v=SmZBGKOryzQ) -### Advanced Script Sessions +## Advanced Script Sessions Inevitably you will need to have long running processes triggered remotely. In order to support this functionality without encountering a timeout using `Invoke-RemoteScript` you can use the following list of commands. @@ -91,9 +94,12 @@ Inevitably you will need to have long running processes triggered remotely. In o * `Stop-ScriptSession` - Terminates an existing script session. * `Wait-ScriptSession` - Waits for all the script sessions to complete before continuing. -**Note:** These commands are not only used for remoting, we just thought it made sense to talk about them here. - +{% hint style="info" %} +These commands are not only used for remoting, we just thought it made sense to talk about them here. +{% endhint %} + **Example:** The following remotely runs the id of a `ScriptSession` and polls the server until completed. + ```powershell Import-Module -Name SPE $session = New-ScriptSession -Username admin -Password b -ConnectionUri https://remotesitecore @@ -107,7 +113,8 @@ Wait-RemoteScriptSession -Session $session -Id $jobId -Delay 5 -Verbose Stop-ScriptSession -Session $session ``` -**Example:** The following remotely runs a script and checks for any output errors. The *LastErrors* parameter is available for `ScriptSession` objects. +**Example:** The following remotely runs a script and checks for any output errors. The _LastErrors_ parameter is available for `ScriptSession` objects. + ```powershell $jobId = Invoke-RemoteScript -Session $session -ScriptBlock { Get-Session -ParameterDoesNotExist "SomeData" @@ -125,7 +132,8 @@ Invoke-RemoteScript -Session $session -ScriptBlock { } ``` -**Example:** The following redirects messages from `Write-Verbose` to the remote session. The data returned will be both `System.String` and `Deserialized.System.Management.Automation.VerboseRecord` so be sure to filter it out when needed. More information about the redirection `4>&1` can be read [here][4]. +**Example:** The following redirects messages from `Write-Verbose` to the remote session. The data returned will be both `System.String` and `Deserialized.System.Management.Automation.VerboseRecord` so be sure to filter it out when needed. More information about the redirection `4>&1` can be read [here](https://github.com/SitecorePowerShell/Book/tree/a1cbd06eba0aad8913e553f4aaa08de0412c635a/[https:/blogs.technet.microsoft.com/heyscriptingguy/2014/03/30/understanding-streams-redirection-and-write-host-in-powershell/]/README.md). + ```powershell Invoke-RemoteScript -ScriptBlock { Write-Verbose "Hello from the other side" -Verbose 4>&1 @@ -135,24 +143,44 @@ Invoke-RemoteScript -ScriptBlock { ``` **Example:** The following improves upon the previous example. + ```powershell Invoke-RemoteScript -ScriptBlock { function Write-Verbose { param([string]$Message) Microsoft.PowerShell.Utility\Write-Verbose -Message $Message -Verbose 4>&1 } - + Write-Verbose "Hello from the other side" "data" Write-Verbose "Goodbye from the other side" } -Session $session ``` -### References: -* Michael's follow up post on [Remoting][2] -* Adam's initial post on [Remoting][1] +## Troubleshooting + +If you receive the following error when trying to run a script (note the namespace is `Microsoft.PowerShell.Commands` instead of `Spe` or similar): + +``` + + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.NewItemCommand +``` + +then add the following line as the first line within the Invoke-RemoteScript block: `Set-Location -Path "master:"` + +**Example:** +``` +Invoke-RemoteScript -ScriptBlock { + Set-Location -Path "master:" + ... + [The rest of your script] + ... +} +``` + +This issue occurs due to the fact that the remoting session defaults to the `FileSystem` provider. Changing the location activates the custom provider included with SPE. As part of the custom provider there are additional parameters added to commands native to PowerShell. + +## References + +* Michael's follow up post on [Remoting](https://michaellwest.blogspot.com/2015/07/sitecore-powershell-extensions-remoting.html) +* Adam's initial post on [Remoting](https://blog.najmanowicz.com/2014/10/10/sitecore-powershell-extensions-remoting/) -[1]: http://blog.najmanowicz.com/2014/10/10/sitecore-powershell-extensions-remoting/ -[2]: http://michaellwest.blogspot.com/2015/07/sitecore-powershell-extensions-remoting.html -[3]: https://msdn.microsoft.com/en-us/library/dd878350(v=vs.85).aspx -[4]: https://blogs.technet.microsoft.com/heyscriptingguy/2014/03/30/understanding-streams-redirection-and-write-host-in-powershell/ \ No newline at end of file diff --git a/reports.md b/reports.md deleted file mode 100644 index 35216fb4..00000000 --- a/reports.md +++ /dev/null @@ -1,80 +0,0 @@ -# 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][1] (ASR) module. - -### Running a Report - -The custom reports can be found by navigating to *Sitecore -> Reporting Tools -> PowerShell Reports*. - -![Reports](images/screenshots/reports/reports.png) - -As an example, let's run the Unused media items report. - -![Unused Media Items](images/screenshots/reports/reports-unusedmedia.png) - -Once the report completes, the results appear in a report window. - -![Unused Media Items Output](images/screenshots/reports/reports-output.png) - -### Reports in SPE like ASR - -While SPE contains many reports, they don't match identical to ASR reports. We've done our best to build those that seem most relevant or likely to be used. If you find a report in ASR that you would like to exist in SPE please submit a request. - -| **SPE Report** | **ASR Report** | -| -- | -- | -| | Active Aliases | -| | Aliases | -| | Audit | -| Broken Links2 | Broken Links | -| | Broken Links in publishable items | -| | Item History | -| | Items with Invalid Names | -| Items with security for an account2 | Items with Security for an account | -| | Items with Tokens in Fields | -| | Links | -| Locked Items2 | Locked Items | -| | Logged errors | -| Logged in Session Manager5 | Logged in Users | -| Limit number of versions4 | Multiple versions | -| | My Owned Items | -| Media items last updated before date3 | Not recently modified | -| Media items not used by content items3 | Orphaned media assets report | -| | Owned items | -| | Recent Workflow History | -| Media items last updated after date3 | Recently Modified | -| | Regex Item Searcher | -| | Renderings | -| Index Viewer5 | - | -| Rules based report5 | - | -| Task Manager report5 | - | - -Check the reports in SPE under these sections to see the full list. - -* 1 Configuration Audit report -* 2 Content Audit report -* 3 Media Audit report -* 4 Solution Audit report -* 5 Toolbox - -**Note:** Examples included are in the following modules -* Content Reports - -### Reports Security - -You may wish to expose the reports to users such as Content Authors. Here are the steps required to grant access to users in the `sitecore\Sitecore Client Authoring` role. - -Here is what users may see in the event they do not have the appropriate access. - -![Reports without Access](images/screenshots/reports/reports-menuwithoutaccess.png) - -1. Navigate to the item `/sitecore/content/Documents and settings/All users/Start menu/Right/Reporting Tools/PowerShell Reports` - -2. Grant access to `sitecore\Sitecore Client Authoring` -![Report Viewer Access](images/screenshots/reports/reports-vieweraccess.png) - -3. Verify the reports are now visible to the Authoring users. -![Reports with Access](images/screenshots/reports/reports-menuwithaccess.png) - -[1]: https://marketplace.sitecore.net/en/Modules/A/Advanced_System_Reporter.aspx \ No newline at end of file diff --git a/scripting.md b/scripting.md deleted file mode 100644 index a6f03220..00000000 --- a/scripting.md +++ /dev/null @@ -1,64 +0,0 @@ -# Scripting - -The Integrated Scripting Environment (ISE) is a great way to group together commands and save for later use. Think of the ISE as a beefed up version of the Console. The default configuration for SPE requires the ISE to be in an [Elevated Session State](/security.md) before executing scripts. - -The following figure shows the ISE when the User Account Controls (UAC) are disabled. While this is a common configuration for developers, we highly encourage you to ensure UAC is enabled in higher environments. - -[![PowerShell ISE](images/screenshots/ise-empty.png)](http://youtu.be/RCDprfRsbSU "Click for a quick demo") - -#### Home Tab -* **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. -* **Script Execution:** - * Execute - Runs the current script as a background job or in the http context. - * Selection - Runs the selected text of the current script. - * Debug - Runs the current script with the debugging mode enabled. - * Abort - Stops the execution of an executing script. -* **Context:** - * Context - Specifies the current item in the script. Often denoted as a *.* (dot) or *$pwd* (present working directory). An MRU and tree view are provided for choosing a path. - * Session - Specifies the session to use when executing the script. Reused sessions live in the *HttpSession*. Options include the session created for the ISE instance, One-Time session, or the Persistent Session ID configured on the script. -* **UI Context:** - * Language - Specifies the context language to use when executing the script. - * User - Specifies the context user to impersonate when executing the script. This can be used to emulate `UserSwitcher` code. - -![ISE Settings Tab](images/screenshots/scripting/ise-settings.png) - -#### Settings Tab -* **Preferences:** - * Settings - This is where you configure the Console and ISE font family, font size, and other useful things. -* **Integration:** - * Rebuild All - This is where you rebuild the integration points for Control Panel, Gutters, and Ribbons. Without running this you will not see those integrations appear (or disappear). - -![ISE Plugins Tab](images/screenshots/scripting/ise-plugins.png) - -#### Plugins Tab -* **Platform:** Custom scripts added to the *ISE Plugins* integration point script library will appear here. - -The *Open* dialog provides both a search and tree view of the scripts stored in the script libraries. - -![Open Script Dialog](images/screenshots/ise-opendialog.png) - -### Shortcuts -Below are the shortcuts available in the ISE. - -| **Shortcut** | **Usage** | -| -------- | ----- | -| TAB | Indent | -| Ctrl-Space | Autocomplete commands. Use the up or down direction keys to cycle through options. | -| Ctrl-Enter | Displays the command help window. | -| Ctrl-Z | Undo the previous change. | -| Ctrl-Alt-Shift + | Increase the font size | -| Ctrl-Alt-Shift - | Decrease the font size | -| Ctrl-E | Executes the script | -| Alt-E | Executes the selected text in the script | -| Ctrl-D | Debugs the script | -| Ctrl-Shift-E | Aborts the running script | -| Ctrl-F | Search for keywords in the script | - -For more commands built into the script editor see [here][1] - -[1]: https://github.com/ajaxorg/ace/wiki/Default-Keyboard-Shortcuts \ No newline at end of file diff --git a/security.md b/security/README.md similarity index 52% rename from security.md rename to security/README.md index f46ce9e8..4460caf5 100644 --- a/security.md +++ b/security/README.md @@ -1,6 +1,14 @@ +--- +description: View important details on how to keep Sitecore secure while using SPE. +--- + # Security -You need to be mindful that Sitecore PowerShell Extensions is a very sharp tool and while it can be leveraged to do great things, it can also be a vector of dangerous attacks if not secured properly. This is why we recommend that you **do not install** it on Content Delivery instances and if possible avoid deploying it on servers that face Internet altogether. +You need to be mindful that Sitecore PowerShell Extensions is a very sharp tool and while it can be leveraged to do great things, it can also be a vector of dangerous attacks if not secured properly. This is why we recommend that you **do not install** it on Content Delivery instances and if possible avoid deploying it on servers that face Internet altogether. + +{% hint style="danger" %} +Installing SPE in internet facing \(DMZ\) scenarios is not recommend. Please avoid installing in the Content Delivery instances. Implement a strategy which provides the least amount of access required. Consider locking down the web server to only allow connections to your databases and preapproved web services. +{% endhint %} ## Security Policies @@ -13,43 +21,47 @@ 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, but you should perform a due dilligence to make sure this is the case! You may also notice that the _$HOME_ variable is empty; this is because only named service accounts have profiles. +When using the IIS identities such as _ApplicationPoolIdentity_ and _NetworkService_ the scripts may have access to directories outside of the application such as the drive root; you should perform a due dilligence to make sure this is the case! You may also notice that the _$HOME_ variable is empty; this is because only named service accounts have profiles. + +{% hint style="warning" %} +The application pool service account can give SPE access to many features in the OS. +{% endhint %} ### Sitecore User Account The second policy relates to the Sitecore user account. The code executed through SPE operates within the privileges of the logged in user. Keep in mind that this can be bypassed just as can be done through the Sitecore API as PowerShell scripts can call the APIs that disable the Sitecore security. -**Application Security** +**Application Security** The following settings are configured under `core:\content\Applications\PowerShell`. -| **Feature**| **Visibility** | -| --- | --- | +| **Feature** | **Visibility** | +| :--- | :--- | | PowerShell Console | sitecore\Developer \(read\) | | PowerShell ISE | sitecore\Developer \(read\) | | PowerShell ListView | sitecore\Sitecore Client Users \(read\) | | PowerShell Runner | sitecore\Sitecore Client Users \(read\) | -| PowerShell Reports | No default settings. See [here](/reports.md) for instructions. | +| PowerShell Reports | sitecore\Sitecore Client Authoring. See [here](../modules/integration-points/reports/) for instructions. | -**Note:** The security is validated _OnLoad_. +**Note:** The security is validated in each SPE application within the function `OnLoad`. -**Menu Item Security** +**Menu Item Security** The following settings are configured under `core:\content\Applications\Content Editor\Context Menues\Default\`. | **Feature** | **Visibility** | **Command State** | -| --- | --- | --- | -| Edit Script | sitecore\Developer (read) | **Enabled** when item template is _PowerShell Script_ otherwise **Hidden** | -| Console | sitecore\Developer (read) | **Enabled** until user is _non-admin_ and not in _sitecore\Sitecore Client Developing_ | -| Script | sitecore\Sitecore Limited Content Editor (deny read) | **Enabled** | +| :--- | :--- | :--- | +| Edit with ISE | sitecore\Developer \(read\) | **Enabled** when item template is _PowerShell Script_ otherwise **Hidden** | +| Console | sitecore\Developer \(read\) | **Enabled** when user is _admin_ or in the role _sitecore\Sitecore Client Developing_ otherwise **Hidden** | +| Scripts | sitecore\Sitecore Limited Content Editor \(deny read\) | **Enabled** when the service and user are authorized to execute otherwise **Hidden** | -**Note:** See the _Interactive_ section on _PowerShell Script Library_ and _PowerShell Script_ items for visibility and enabled rules. To hide each feature you can change also the security settings for the roles that should not see the menu. +**Note:** See the _Interactive_ section on _PowerShell Script Library_ and _PowerShell Script_ items for visibility and enabled rules. To hide each feature you can change the security settings for the roles that should not see the menu. ## Security Hardening -The following section outlines steps you can take to minimize the surface area for attack. The following topics describe how to manage security for interfaces and services to the various parts of the module. +The following section outlines steps you can take to minimize the surface area for attack. The following topics describe how to manage security for interfaces and services for the various parts of the module. ### Session Elevation -The various [interfaces](/interfaces.md) bundled with the module provide convenient ways to interact with the Sitecore API. The module provides a **User Account Control** feature akin to that of Microsoft Windows. +The [interfaces](../interfaces/) bundled with the module provide convenient ways to interact with the Sitecore API. The module provides a **User Account Control** \(UAC\) feature akin to that of Microsoft Windows. #### User Account Control @@ -57,30 +69,33 @@ Let's have a look at the configurable features which make up the UAC. **Gate** -The way in which scripts make their way into Sitecore through built-in interfaces. Includes the [Console](/console.md), [ISE](/scripting.md), and Content Editor via _Item Saving_. +The way in which scripts make their way into Sitecore through built-in interfaces. Includes the [Console](../interfaces/console.md), [ISE](../interfaces/scripting.md), and Content Editor via _Item Saving_. | Attribute | Description | -| --- | --- | +| :--- | :--- | | name | built-in name for the gate | -| token | name of the token to use for the elevated session | +| token | name of the token to use for the elevated session | **Token** The object which expires after a predetermined time. These can be unique to each gate or shared. | Attribute | Description | -| --- | --- | -| name | unique string used for the gate *token* attribute | -| expiration | timespan used to determine the elevated session lifetime (hh:mm:ss) | -| elevationAction | action to perform when session elevation is triggered (allow, block, password) | +| :--- | :--- | +| name | unique string used for the gate _token_ attribute | +| expiration | timespan used to determine the elevated session lifetime \(hh:mm:ss\) | +| elevationAction | action to perform when session elevation is triggered \(allow, block, password\) | + +Actions supported out of the box: * **Allow** - Always allow the session to run elevated without prompting the user for permission. This should never be used outside of a developer's machine. * **Block** - Always block the session from running elevated without prompting the user for permission. * **Password** - Prompt the user for a password before running the session elevated, unless an unexpired session is active. +* **Confirm** - Prompt the user for a confirmation before running the session elevated. **Example:** The following extends the token expiration to 10 minutes and blocks the use of the Console. -```xml +```markup @@ -101,36 +116,37 @@ The object which expires after a predetermined time. These can be unique to each ``` -Gates with **Password** protection enabled prompt the user when no elevated session is available. +Gates with **Password** protection enabled prompt the user when no elevated session is available. When using Azure AD and or similar provider you should use the **Confirm** action. -![Elevate Session State](/images/screenshots/uac/security-elevatedsessionstate-password.png) +![Elevate Session State](../.gitbook/assets/security-elevatedsessionstate-password.png) + +**Content Editor** -##### Content Editor A Content Editor Warning is displayed when a PowerShell Module, Script Library, and Script is selected. Click "Elevate session" to show the hidden fields and enable the management of the item. -![Elevate session](/images/screenshots/uac/security-elevatedsessionstate-contenteditor.png) +![Elevate session](../.gitbook/assets/security-elevatedsessionstate-contenteditor.png) The "Drop session" option appears after credentials are verified. All scripts can be edited while the session is elevated. -![Drop session](/images/screenshots/uac/security-elevatedsessionstate-dropcontenteditor.png) +![Drop session](../.gitbook/assets/security-elevatedsessionstate-dropcontenteditor.png) -##### ISE +**ISE** A warning is presented in the ISE when no elevated session state is available. -![Elevated session state required](/images/screenshots/uac/security-elevatedsessionstate-ise.png) +![Elevated session state required](../.gitbook/assets/security-elevatedsessionstate-ise.png) The following warning is rendered in the ISE while the session state is elevated. Click "Drop elevated session state" if you do not want to wait for the elevated session to timeout. -![Drop elevated session state](/images/screenshots/uac/security-elevatedsessionstate-dropise.png) +![Drop elevated session state](../.gitbook/assets/security-elevatedsessionstate-dropise.png) ### Configure Web Services -The web services providing external access to Sitecore are disabled by default. You can override by patching the following configuration file `\App_Config\Include\Cognifide.PowerShell.config`. +The web services providing external access to Sitecore are disabled by default. You can override this behavior by patching the following configuration file `\App_Config\Include\Spe.config`. Look for the following section and enable as needed. -```xml +```markup @@ -153,25 +169,25 @@ Look for the following section and enable as needed. * **Remoting** - Used when passing scripts to SPE for execution. Enable when using the **SPE Remoting** module. Service associated with `RemoteAutomation.asmx`. * **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`. - * Required for the following features: PowerShell [Web API](/web-api.md). + * Required for the following features: PowerShell [Web API](../modules/integration-points/web-api.md). * **File Download** - Used when the url contains all the information needed to download a file from the server. Enable when using the **SPE Remoting** module. Service associated with `RemoteScriptCall.ashx`. * **File Upload** - Used when the url contains all the information needed to upload a file to the server. Enable when using the **SPE Remoting** module. Service associated with `RemoteScriptCall.ashx`. * **Media Download** - Used when the url contains all the information needed to download a media item from the server. Enable when using the **SPE Remoting** module. Service associated with `RemoteScriptCall.ashx`. * **Media Upload** - Used when the url contains all the information needed to upload a media item to the server. Enable when using the **SPE Remoting** module. Service associated with `RemoteScriptCall.ashx`. * **Handle Download** - Used when a file is downloaded through the Sitecore interface. Enable when using the **SPE Remoting** module. Service associated with `RemoteScriptCall.ashx`. - * Required for the following features: [Out-Download](/appendix/commands/Out-Download.md) command. + * Required for the following features: [Out-Download](../appendix/common/out-download.md) command. If the report export buttons do not work it could be because of this setting. * **Client** - Used for the SPE Console. Service associated with `PowerShellWebService.asmx`. - * Required for the following features: PowerShell [Console](/console.md), PowerShell [ISE](/scripting.md), + * Required for the following features: PowerShell [Console](../interfaces/console.md), PowerShell [ISE](../interfaces/scripting.md), * **Execution** - Used when SPE checks if the user has access to run the application. - * Required for the following features: [Download File](/interactive-dialogs.md) dialog, PowerShell Script Runner, [Content Editor](/content-editor.md) (Context Menu, Insert Options, Ribbon). + * Required for the following features: [Download File](../interfaces/interactive-dialogs.md) dialog, PowerShell Script Runner, [Content Editor](../modules/integration-points/content-editor.md) \(Context Menu, Insert Options, Ribbon\). * **RESTful v1** - Used in early version of SPE. Avoid using this if possible. Service associated with `RemoteScriptCall.ashx`. The preferred way to override the settings is through the use of a configuration patch file. **Example:** The following enables the file and media downloads. -```xml - +```markup + @@ -189,8 +205,8 @@ The preferred way to override the settings is through the use of a configuration **Example:** The following enables the SPE Remoting service and requires a secure connection using HTTPS. -```xml - +```markup + @@ -204,16 +220,18 @@ The preferred way to override the settings is through the use of a configuration ``` +**Note:** When using the attribute `requireSecureConnection`, you may find that this causes a 403 status code when testing against a server hosted behind a load balancer. If the load balancer maintains the TLS certificate and forwards traffic to a backend web server over port 80 .Net will not recognize this as a secure connection. + ### Restrict Users and Roles #### Sitecore level security -You are required to explicitly grant the SPE Remoting session user account to a predefined role found in the configuration `Cognifide.PowerShell.config`. There is a generic list of permissions configured by default but we highly encourage you to adjust to meet your security requirements. +You are required to explicitly grant the SPE Remoting session user account to a predefined role found in the configuration `Spe.config`. There is a generic list of permissions configured by default but we highly encourage you to adjust to meet your security requirements. **Example:** The following configuration defines the roles that have access to use SPE Remoting. Any role previously defined in the `` section is removed and custom roles are then added. -```xml - +```markup + @@ -231,13 +249,49 @@ You are required to explicitly grant the SPE Remoting session user account to a ``` -#### IIS level security +**Example:** The following configuration grants access to custom roles without removing any existing roles. + +```markup + + + + + + true + + + + + + + + + +``` + +### Delegated Access + +There may be scenarios in which you need to grant users access to run scripts which require access to be higher the what is currently configured for the user. The various integration points made visible in the Content Editor (Context Menu, Ribbon, Reports) can be configured to run the scripts impersonating a power user. This has the advantage of giving lower privileged users "special" access without having to make members of more privileged roles. In [#1283](https://github.com/SitecorePowerShell/Console/issues/1283) this feature introduced a simple configuration item to apply the "special" access. + +* **Step 1:** Create a new delegated access item using the provided insert option. +![image](https://user-images.githubusercontent.com/933163/191065624-65c400c8-8628-4ede-b669-52d1e3e1c513.png) ![image](https://user-images.githubusercontent.com/933163/191063313-7c51250e-9740-4054-890e-7fb282912ddc.png) +* **Step 2:** Enter the role in which lower privileged users are members. +* **Step 3:** Enter the user account with elevated access. This could be `sitecore\Admin` or any other user your environment has configured. This user will be impersonated during script execution. +* **Step 4:** Select each script/library that should be delegated. Script/library items with a rule checking for delegated access should be included as well as scripts that should be run with the impersonated account. +![image](https://user-images.githubusercontent.com/933163/191064401-d135e275-aeea-4315-a505-acca61d6c963.png) +* **Step 5:** Enable the delegated access item when ready for use. + +When scripts are executed you should see them logged to the SPE log where the context user and impersonated user appear. + +> 2304 14:02:32 INFO [Gutter] Executing script {CFE81AF6-2468-4E62-8BF2-588B7CC60F80} for Context User sitecore\test as sitecore\Admin. + +### IIS level security Deny access to the web services for unauthenticated users and roles using the `` element as described [here](https://msdn.microsoft.com/en-us/library/8aeskccd%28v=vs.71%29.aspx) in `sitecore modules\PowerShell\Services\web.config`. **Example:** The following configuration will deny anonymous calls to the web services. -```xml +```markup @@ -247,32 +301,32 @@ Deny access to the web services for unauthenticated users and roles using the `< ``` -If you disable _Anonymous Authentication_ and enable _Windows Authentication_ in IIS, such as the directory `sitecore modules\PowerShell\Services\` you'll need to use the **Credential** parameter for any command that interacts with the services. See the [Remoting](/remoting.md "Remoting") section for examples. +If you disable _Anonymous Authentication_ and enable _Windows Authentication_ in IIS, such as the directory `sitecore modules\PowerShell\Services\` you'll need to use the **Credential** parameter for any command that interacts with the services. See the [Remoting](../remoting.md) section for examples. ### Minimal Web Service Configuration -The following files are the bare minimum required to support SPE web services. This setup is suitable for environments such as servers built within a Continuous Integration environment that need remoting enabled. Remoting is not disabled by default. If you need this functionality, enable it separately using a config patch file. +The following files are the bare minimum required to support SPE web services. This setup is suitable for environments such as servers built within a Continuous Integration environment that need remoting enabled. Remoting is **disabled** by default. If you need this functionality, enable it separately using a config patch file. **Required:** -* `App_Config\Include\Cognifide.PowerShell.config` -* `App_Config\Include\Cognifide.PowerShell.Minimal.config` -* `bin\Cognifide.PowerShell.dll` -* `bin\Cognifide.PowerShell.VersionSpecific.dll` +* `App_Config\Include\Spe\Spe.config` +* `App_Config\Include\Spe\Spe.Minimal.config` +* `bin\Spe.dll` +* `bin\Spe.Abstractions.dll` * `sitecore modules\PowerShell\Services\web.config` * `sitecore modules\PowerShell\Services\RemoteAutomation.asmx` * `sitecore modules\PowerShell\Services\RemoteScriptCall.ashx` You will also need to patch the configuration with the following: -```xml - +```markup + - + - @@ -281,8 +335,31 @@ You will also need to patch the configuration with the following: ``` -For your convenience we've included a package bundled with all of the above called _SPE Minimal-4.x for Sitecore x.zip_. Any of the disabled configuration files should be enabled following extraction. +For your convenience we've included a package bundled with all of the above called _SPE.Minimal-6.x.zip_. Any of the disabled configuration files should be enabled following extraction. ### References * [Shields Down Example](https://alan-null.github.io/2017/01/spe-dev-config) + +## Identity Server + +**Note:** If you are using Sitecore 9.1 or later with Identity Server, there is a configuration file that should be enabled. + +* `Spe.IdentityServer.config` + +```markup + + + + + + + + /sitecore%20modules/PowerShell + + + + + + +``` diff --git a/users-and-roles.md b/security/users-and-roles.md similarity index 78% rename from users-and-roles.md rename to security/users-and-roles.md index dfa71e7a..b017ab5f 100644 --- a/users-and-roles.md +++ b/security/users-and-roles.md @@ -3,15 +3,16 @@ Managing users and roles is a big topic and this section won't cover everything. We aim to show you different problems that have come up and how we solved them. **Example:** The following command returns the security commands available. + ```powershell Get-Command -Noun Role*,User,ItemAcl* | Sort-Object -Property Noun,Verb ``` -### Users +## Users Managing users should be a pretty straight forward task. While the User Manager provided by Sitecore is handy, you'll likely find yourself wanting to make bulk changes. The following examples should give you a few ideas about how to manage user accounts. -#### Query users and update properties +### Query users and update properties **Example:** The following generates a batch of test users in the default domain with the out-of-the-box user profile template. The users are then queried filtering on the name. @@ -33,7 +34,7 @@ Get-User -Id "michael" -Authenticated | Set-User -ProfileItemId "{AE4C4969-5B7E-4B4E-9042-B2D8701CE214}" ``` -**Example:** The follow queries all the user accounts for the default provider and filters those over the age of 18. The *age* property is custom on the *Profile*. Finally, export to CSV. +**Example:** The follow queries all the user accounts for the default provider and filters those over the age of 18. The _age_ property is custom on the _Profile_. Finally, export to CSV. ```powershell $users = Get-User -Filter * | Where-Object { $_.Profile.GetCustomProperty("age") -gt 18 } @@ -46,35 +47,34 @@ $users | Select-Object -Property $property | Export-CSV -Path "C:\temp\users-over-eighteen.csv" -NoTypeInformation ``` -##### Active Directory +#### Active Directory -When using the [Active Directory module][2] you may need to increase the setting `LDAP.SizeLimit` if you wish to return all Active Directory accounts. +When using the [Active Directory module](https://dev.sitecore.net/Downloads/Active_Directory/) you may need to increase the setting `LDAP.SizeLimit` if you wish to return all Active Directory accounts. Using `Set-User` to update AD accounts may result in an "Access denied message"; this is due to the fact that the account querying user does not have write access to profile properties or the profile provider is not configured properly. -### Roles +## Roles **Example:** The following queries roles using the specified identity. + ```powershell # Identity can be "[domain]\[name]", "Creator-Owner", and "\Everyone" Get-Role -Identity "default\Everyone" ``` -### Item Access Control Lists (ACL) +## Item Access Control Lists \(ACL\) The ACL commands provide an automated way of granting privileges to items. **Example:** The following creates a new ACL and assigns to an item. + ```powershell $aclForEveryone = New-ItemAcl -Identity "\Everyone" -PropagationType Any -SecurityPermission DenyInheritance -AccessRight * Get-Item -Path "master:\content\home" | Add-ItemAcl -AccessRules $aclForEveryone -PassThru ``` -### References +## References -* [Using Get-User command to query over 200k users][1] -* [Explore Sitecore Users Properties][3] +* [Using Get-User command to query over 200k users](https://stackoverflow.com/questions/34982451/sitecore-powershell-get-user-command/34994302#34994302) +* [Explore Sitecore Users Properties](https://lets-share.senktas.net/2017/02/explore-sitecore-users.html) -[1]: http://stackoverflow.com/questions/34982451/sitecore-powershell-get-user-command/34994302#34994302 -[2]: https://dev.sitecore.net/Downloads/Active_Directory/ -[3]: http://lets-share.senktas.net/2017/02/explore-sitecore-users.html diff --git a/styles/website.css b/styles/website.css index 32522534..6cc5e35e 100644 --- a/styles/website.css +++ b/styles/website.css @@ -5,4 +5,9 @@ figure { figure img { width: 100%; -} \ No newline at end of file +} +/* +.page-inner { + max-width: 1200px; +} +*/ diff --git a/tasks.md b/tasks.md deleted file mode 100644 index d3c0d8e9..00000000 --- a/tasks.md +++ /dev/null @@ -1,57 +0,0 @@ -# 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 - -[![Scheduled Task Editor](http://img.youtube.com/vi/Q6QKqRwrkuU/0.jpg)](https://youtu.be/Q6QKqRwrkuU "Click for a quick demo") - -### Scheduled Task Command - -To help make the setup simple, we've provided a *Task Command*. - -![PowerShell Script Command](images/screenshots/tasks-powershellscriptcommand.png) - -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. - -![PowerShell Script Task](images/screenshots/tasks-archiveschedule.png) - -The *Items* field contains the path to a script in the *Script Library*. - -Below are some of the scripts found out-of-the-box with SPE. - -| Module | Script | -| ------ | ---- | -| System Maintenance | Archive Sitecore logs, Clean up deleted items older than 30 days | -| User Session Management | Remove idle user sessions | - -### Create and Manage Tasks - -We've added a context menu item to provide you with a shortcut to the Task Scheduler Editor. - -Create a new scheduled task: - -![Insert Option for Task](images/screenshots/task-inserttask.png) - -Run or edit the scheduled task: - -![Run or Edit Task Schedule](images/screenshots/task-runedittask.png) - -The scheduled task is capable of running 1-to-many scripts. Choose all that apply for the selected task. - -![Dialog to Select Task Scripts](images/screenshots/task-createtaskwithscripts.png) - -The task schedule has an intuitive dialog for working with and changing the frequency. - -![Dialog to Edit Task Schedule](images/screenshots/task-edittaskschedule.png) - -**Note:** Examples included are in the following modules -* License Expiration -* Media Library Maintenance -* System Maintenance - -See how Adam added [powershell driven Sitecore scheduled tasks][1]. - -[1]: http://blog.najmanowicz.com/2011/11/29/powershell-driven-sitecore-scheduled-tasks/ \ No newline at end of file diff --git a/toolbox.md b/toolbox.md deleted file mode 100644 index d2b146d2..00000000 --- a/toolbox.md +++ /dev/null @@ -1,65 +0,0 @@ -# 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: - -![Toolbox](images/screenshots/toolbox/toolbox-list.png) - -**Note:** Examples included in the following modules -* Authorable Reports -* Logged in Session Manager -* Package Generator -* Task Management -* Platform - -### Available Tools - -#### Index Viewer - -This tool provides similar functionality to the [Index Viewer][1] module. Search and rebuild the index on-demand. - -#### Logged in Session Manager - -View the list of user sessions and "kick" them out as needed. - -#### Rules based report - -Generate a report using the Sitecore Rules Engine. - -#### PowerShell Background Session Manager - -View the list of SPE sessions and "kill" them as needed. - -#### Create Anti-Package - -This tool provides similar functionality to the [Sitecore Rocks][2] module. - -#### Re-create Site from Sitemap - -Simple tool for generating a site tree using an existing sitemap. - -#### Task Manager - -View and manage the configured scheduled tasks. - -### Create Tools for the Toolbox - -To create your own Toolbox item take the following steps: -1. Create the *Toolbox* folder under an SPE module. Use the context menu to simplify the process. - * Right click the module name and choose Scripts -> Create libraries for integration points. -![Module Libraries](images/screenshots/module-createlibraries.png) - * Select the *Toolbox* item and click *Proceed*. -![Module Toolbox Library](images/screenshots/module-createtoolboxlibrary.png) -2. Create a *PowerShell Script* under the *Toolbox* item. - * Right click the *Toolbox* library and choose *PowerShell Script*. -![Libary Script](images/screenshots/library-createscript.png) -3. Open and edit the *PowerShell Script* using the ISE. -![ISE Edit](images/screenshots/script-editise.png) -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. -![ISE Settings Tab](images/screenshots/ise-settingstab.png) -5. Verify the new toolbox item appears in the Toolbox. -![Toolbox Item](images/screenshots/toolbox-newitem.png) - -[1]: http://marketplace.sitecore.net/en/Modules/I/Index_Viewer.aspx -[2]: https://marketplace.sitecore.net/en/Modules/S/Sitecore_Rocks.aspx \ No newline at end of file diff --git a/training.md b/training.md new file mode 100644 index 00000000..3c9a9a9a --- /dev/null +++ b/training.md @@ -0,0 +1,485 @@ +--- +description: Beginner's guide to working with PowerShell and SPE. +--- + +# Training + +The world renowned Sitecore PowerShell Extensions module has so much to offer, but sometimes those new to the module may find it difficult to know where to start. 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. + +## Videos and Blogs + +We have a video series available to help walk you through the module [here](https://www.youtube.com/playlist?list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b). + +We also maintain a comprehensive list of links to [blogs and videos](https://blog.najmanowicz.com/sitecore-powershell-console/) to help you on your journey to SPE awesomeness. Happy coding! + +## Language Basics + +PowerShell is built on the Microsoft .Net technology; you will find that most APIs in your libraries can be accessed from within the PowerShell runtime. In this section we will see similarities between the C\# and PowerShell syntax. + +### C\# to PowerShell + +Use the table below to aid in translating from C\# to PowerShell. Some of the examples below are not "exact" translations, but should give you a good idea on what it would look like. For example, creating a new dynamic list in C\# is often written as a fixed dimensional array recreated with every new addition. + +**Note:** Variables in PowerShell are denoted by the `$` character followed by the name. You will see this through the examples below. + +{% tabs %} +{% tab title="Arithmetic" %} +```csharp +// Perform simple math in C# +var total = 1 + 1; +total += 2; +``` + +```powershell +# Perform simple math in PowerShell +$total = 1 + 1 +$total += 2 +``` +{% endtab %} +{% tab title="Collections" %} + +Working with Dynamic and Fixed dimensional arrays. + +```csharp +/* + Create a new dynamic list of strings in C# +*/ +var names = new List(); +names.Add("Michael"); +names.Add("Adam"); +``` + +```powershell +<# + Create a new fixed list of strings in PowerShell +#> +[string[]]$names = @() +$names += "Michael" +$names += "Adam" +``` + +Working with hashtables. + +```csharp +// Create a hashtable of data in C# +var table = new Hashtable(); +table["Name"] = "Michael"; +table["Age"] = 33; +``` + +```powershell +# Create a new hashtable of data in PowerShell +$table = @{} +$table["Name"] = "Michael" +$table["Age"] = 33 +``` + +Working with dictionaries. + +```csharp +// Ordered Dictionary in C# +var od = new OrderedDictionary(); +od.Add("z","Last Letter"); +od.Add("a","First Letter"); +``` + +```powershell +# Ordered Dictionary in PowerShell +$od = [ordered]@{} +$od.Add("z","Last Letter") +$od.Add("a","First Letter") +``` +{% endtab %} +{% tab title="If-Else" %} +```csharp +// Check if the string is null or empty using a static method in C# +if(string.IsNullOrEmpty(name)) { + ... +} +else { + ... +} +``` + +```powershell +# Check if the string is null or empty using a static method in PowerShell +if([string]::IsNullOrEmpty($name)) { + ... +} else { + ... +} +``` +{% endtab %} +{% tab title="Comparisons" %} +```csharp +// Compare values in C# +name == "Michael" +total <= 3 names.Count() > 2 && name[0] != "Adam" +``` + +```powershell +# Compare values in PowerShell +$name -eq "Michael" + +# case-insensitive +$total -le 3 $names.Count -gt 2 –and $name[0] -ne "Adam" +``` +{% endtab %} +{% tab title="Negate" %} +```csharp +// Negate value in C# +var isTrue = !false; +``` + +```powershell +# Negate value in PowerShell +$isTrue = !$false +$isTrue = -not $false +``` +{% endtab %} +{% tab title="Strings" %} +```csharp +// String interpolation in C# +var message = $"Hello, {name}"; +``` + +```powershell +# String interpolation in PowerShell +$message = "Hello, $($name)" +``` + +Escape double quotes in string. Alternatively you can use a single quote. + +```csharp +// Escape characters in C# +string message = "They said to me, \"SPE is the greatest!\"."; +message = 'I said, "Thanks!"'; +message = "We celebrated together, 'Go SPE!'"; +``` + +```powershell +# Escape characters in PowerShell +$message = "They said to me, `"SPE is the greatest!`"." +$message = 'I said, "Thanks!".' +$message = "We celebrated together, 'Go SPE!'." +``` +{% endtab %} +{% tab title="Static Members" %} +```csharp +// Access static property in C# +var today = DateTime.Today; +``` + +```powershell +# Access static property in PowerShell +$today = [datetime]::Today +``` +{% endtab %} +{% endtabs %} + +As you can see in the table above, the language syntax is not all that different between C\# and PowerShell. Within a few minutes you might even be able to translate code from your library classes into SPE scripts. + +### Performance Considerations + +You may find yourself trying to optimize your scripts. A few things that might help include the following. + +{% tabs %} +{% tab title="Collections" %} +**Example:** The following demonstrates the use of an **ArrayList**. Performs much better than purely using `@()`. + +```powershell +# Use ArrayList to append items rather than creating new fixed dimensional arrays +$names = [System.Collections.ArrayList]@() +$names.Add("Michael") > $null +$names.Add("Adam") > $null +``` + +**Example:** The following demonstrates the use of **List<string>**. This is ideal when statically typed arrays are required. + +```powershell +# Optionally create static static typed arrays +$names = [System.Collections.Generic.List[string]]@() +$names.Add("Michael") > $null +$names.Add("Adam") > $null +``` + +**Example:** The following demonstrates the use of **HashSet**. Use when a distinct list of items is needed. Performs like a **Dictionary** but without the requirement for a key. + +```powershell +# HashSet when only values are needed +$nameLookup = New-Object System.Collections.Generic.HashSet[string] +$nameLookup.Add("Michael") > $null +``` + +**Example:** The following demonstrates the use of **HashSet** where the casing of the items are ignored. +```powershell +# Case insensitive lookup +$nameLookup = New-Object System.Collections.Generic.HashSet[string]([StringComparer]::OrdinalIgnoreCase) +$nameLookup.Add("Michael") > $null + +if($nameLookup.Contains("michael")) { + Write-Host "Found it!" -ForegroundColor Green +} else { + Write-Host "No esta aqui :-(" -ForegroundColor White -BackgroundColor Red +} +``` + +**Example:** The following demonstrates how to replace the use of Compare-Object with **HashSet**. This is useful and important when the collection size is large and you are working with simple data like strings. Compare-Object does offer a way to compare specific properties. +```powershell +# Instead of using Compare-Object to compare two datasets, such as for strings or integeters, consider using HashSet instead. +# Populate collection +$referenceIds = [System.Collections.Generic.List[string]]@() +# Populate collection +$differenceIds = [System.Collections.Generic.List[string]]@() + +<# +$leftOnlyObjects = Compare-Object -ReferenceObject $referenceIds -DifferenceObject $differenceIds | + Where-Object { $_.SideIndicator -eq "<=" } | Select-Object -ExpandProperty InputObject +#> +$referenceHash = New-Object 'System.Collections.Generic.HashSet[String]' +$referenceHash.UnionWith($referenceIds) +$differenceHash = New-Object 'System.Collections.Generic.HashSet[String]' +$differenceHash.UnionWith($differenceIds) +$leftOnlyHash = New-Object 'System.Collections.Generic.HashSet[String]'($referenceHash) +$leftOnlyHash.ExceptWith($differenceHash) +$leftOnlyObjects = $leftOnlyHash +``` + +**Example:** The following demonstrates the use of **Queue**. A Sitecore Stack Exchange answer to [find items based on a template](https://sitecore.stackexchange.com/a/15168/95) may be helpful. + +```powershell +# Queue when ... a queue is needed +$queue = New-Object System.Collections.Queue +$queue.Enqueue("{GUID}") +$queue.Dequeue() +``` +{% endtab %} + +{% tab title="Measure Time" %} +**Example:** The following measures code execution time using `Measure-Command`. + +```powershell +Measure-Command -Expression { + Get-Item -Path "master:" > $null +} | Select-Object -ExpandProperty TotalMilliseconds +``` + +**Example:** The following measures code execution time using a `Stopwatch`. + +```powershell +$watch = [System.Diagnostics.Stopwatch]::StartNew() +Get-Item -Path "master:" > $null +$watch.Stop() +$watch.ElapsedMilliseconds +``` +{% endtab %} + +{% tab title="Terminate Output" %} +**Example:** The following terminates the output. + +```powershell +# Slow but functional +$builder = New-Object System.Text.StringBuilder +$builder.Append("Hello World!") | Out-Null +$builder.ToString() + +# Much faster +$builder = New-Object System.Text.StringBuilder +$builder.Append("Hello World!") > $null +$builder.ToString() +``` +{% endtab %} +{% endtabs %} + +Checklist of performance tuning ideas: + +* Use dynamic arrays to avoid the use of `+=` +* Suppress output with `> $null` instead of `Out-Null` +* Use hashtables as lookup tables for data + +## PowerShell Commands + +Learning PowerShell begins with running your first command. In this section we learn about the basic command syntax, and some common ones you should learn. + +### Syntax + +**Example:** The following provides an example syntax for a fake command. + +```powershell +Get-Something [[-SomeParameter] ] [-AnotherParameter ] [-SomeSwitch] +``` + +PowerShell commands follow a Verb-Noun syntax. Notice that all properly named commands start with a verb such as Get, Set, or Remove and end with a noun such as Item, User, or Role. + +{% hint style="info" %} +The noun in the command should be singular even if the command returns more than one object. +{% endhint %} + +The verbs are considered “approved” if they align with those that Microsoft recommends. See the following URL [https://msdn.microsoft.com/en-us/library/ms714428\(v=vs.85\).aspx](https://msdn.microsoft.com/en-us/library/ms714428%28v=vs.85%29.aspx) for a list of approved verbs and a brief explanation on why they were chosen. They are intended to be pretty generic so they apply for multiple contexts like the filesystem, registry, and even Sitecore! + +The parameters follow the command and usually require arguments. In our example above we have a parameter called **SomeParameter** followed by an argument of type **SomeType**. The final parameter **SomeSwitch** is called a switch. The switch is like a flag that enables or disables behavior for the command. + +{% hint style="info" %} +The brackets surrounding the parameter and the brackets immediately following a type have different meanings. The former has to do with optional usage whereas the latter indicates the data can be an array of objects. +{% endhint %} + +**Example**: The following provides possible permutations for the fake command. + +```powershell +<# + All of the parameters in the command are surrounded by square brackets + indicating they are optional. +#> +Get-Something +``` + +```powershell +<# + SomeParameter has double brackets around the parameter name and argument + indicating the name is optional and when an argument is passed the name + can be skipped. +#> +Get-Something "data" +``` + +```powershell +<# + AnotherParameter has single brackets indicating that the parameter is + optional. If the argument is used so must the name. The same reasoning + can be applied to the switch. +#> +Get-Something "data","data2" -AnotherParameter 100 –SomeSwitch +``` + +```powershell +# Splat parameters to command +$props = @{ + "SomeParameter" = @("data","data2") + "AnotherParameter" = 100 + "SomeSwitch" = $true +} +Get-Something @props +``` + +Allow scripts to be written with the full command and parameter names + +* Avoid relying on positional or optional parameters. +* Avoid abbreviating parameter names. +* Avoid using command aliases \(e.g. dir, cd\). + +Some of the most useful commands to learn can be seen in the table below. These come with vanilla PowerShell. + +| Command | Description | +| :--- | :--- | +| **Get-Item** | Returns an object at the specified path. | +| **Get-ChildItem** | Returns children at the specified path. Supports recursion. | +| **Get-Help** | Returns the help documentation for the specified command or document. | +| **Get-Command** | Returns a list of commands. | +| **ForEach-Object** | Enumerates over the objects passed through the pipeline. | +| **Where-Object** | Enumerates over the objects passed through the pipeline and filters objects. | +| **Select-Object** | Returns objects from the pipeline with the specified properties and filters objects. | +| **Sort-Object** | Sorts the pipeline objects with the specified criteria; usually a property name. | +| **Get-Member** | Returns the methods and properties for the specified object. | + +{% hint style="info" %} +PowerShell was designed so that after learning a few concepts you can get up and running. Once you get past the basics you should be able to understand most scripts included with SPE. +{% endhint %} + +### Pipelines + +PowerShell supports chaining of commands through a feature called "Pipelines" using the pipe "\|". Similar to Sitecore in that you can short circuit the processing of objects using **Where-Object**. Let’s have a look at a few examples. + +{% hint style="info" %} +The characters `$_` and `$PSItem` represent the current object getting processed in the pipeline. +{% endhint %} + +**Example:** The following queries a Sitecore item and removes it. + +```powershell +# The remove command accepts pipeline input. +Get-Item -Path "master:\content\home\sample item" | Remove-Item + +# If multiple items are passed through the pipeline each are removed individually. +$items | Remove-Item +``` + +PowerShell also comes with a set of useful commands for filtering and sorting. Let’s see those in action. + +**Example:** The following queries a tree of Sitecore items and returns only those that meet the criteria. The item properties are reduced and then sorted. + +```powershell +# Use variables for parameters such as paths to make scripts easier to read. +$path = "master:\content\home\" + +Get-ChildItem -Path $path -Recurse | + Where-Object { $_.Name -like "*Sitecore*" } | + Select-Object -Property ID,Name,ItemPath + Sort-Object -Property Name +``` + +{% hint style="info" %} +A best practice in PowerShell is to reduce the number of objects passed through the pipeline as far left as possible. While the example would work if the **Sort-Object** command came before **Where-Object**, we will see a performance improvement because the sorting has fewer objects to evaluate. Some commands such as **Get-ChildItem** support additional options for filtering which further improve performance. +{% endhint %} + +**Example:** The following demonstrates how commands can be written clearly with little confusion on the intent, then how aliases and abbreviations can get in the way. Always think about the developer that comes after you to maintain the code. + +```powershell +# Longhand - recommended +Get-Command -Name ForEach-Object –Type cmdlet | Select-Object -ExpandProperty ParameterSets + +# Shorthand - not recommend +gcm -na foreach-object -ty cmdlet | select -exp parametersets +``` + +Windows PowerShell is bundled with a ton of documentation that could not possibly be included with this book; we can however show you how to access it. + +**Example:** The following examples demonstrate ways to get help…with PowerShell. + +```powershell +# Displays all of the about help documents. +help about_* + +# Displays help documentation on the topic of Splatting. +help about_Splatting + +# Displays help documentation on the specified command. +help Get-Member +``` + +{% hint style="info" %} +PowerShell does not include the complete help documentation by default on Windows. Run the command **Update-Help** from an elevated prompt to update the help files to the latest available version. See `help update-help` for more information on the command syntax and details of its use. All of the SPE help documentation is available regardless of running **Update-Help**. +{% endhint %} + +## Providers + +The provider architecture in PowerShell enables a developer to make a command like **Get-Item** interact with the filesystem files and folders, and then interact with the Sitecore CMS items. + +The SPE module implements a new provider that bridges the Windows PowerShell platform with the Sitecore API. The following table demonstrates the use of **Get-Item** for a variety of providers. + +| Name | Drives | Example | +| :--- | :--- | :--- | +| Alias | Alias | `Get-Item -Path alias:\dir` | +| CmsItemProvider | core, master, web | `Get-Item -Path master:\` | +| Environment | Env | `Get-Item -Path env:\HOMEPATH` | +| FileSystem | C, D, F, H | `Get-Item -Path c:\Windows` | +| Function | Function | `Get-Item -Path function:\prompt` | +| Registry | HKLM, HKCU | `Get-Item -Path hklm:\SOFTWARE` | +| Variable | Variable | `Get-Item -Path variable:\PSVersionTable` | + +The default provider used by the PowerShell Console and ISE is the **CmsItemProvider** with the drive set to the **master** database. + +**Example:** The following demonstrates switching between providers using the function **cd**, an alias for **Set-Location**, while in the Console. + +```powershell +PS master:\> cd c:\ +PS C:\> cd hklm: +PS HKLM:\> cd env: +PS Env:\> +``` + +{% hint style="warning" %} +You may have noticed that the C drive is the only path in which a backslash was used before changing drives. Leaving off the backslash will result in the path changing to C:\windows\system32\inetsrv. This similar behavior can be experienced while in the Windows PowerShell Console, where the path is changed to C:\Windows\System32. +{% endhint %} + diff --git a/troubleshooting.md b/troubleshooting.md index 21f42180..f5baf7ff 100644 --- a/troubleshooting.md +++ b/troubleshooting.md @@ -1,42 +1,58 @@ # Troubleshooting -### General +## General -We generally see issues occurring due to an incompatible version of Windows PowerShell. Be sure to install version 3 or later. +We generally see issues occurring due to an incompatible version of Windows PowerShell. Be sure to install Windows PowerShell version 3 or newer. -### Installation +## Installation -#### Hanging Installation Wizard +### Elevated Session Hanging + +There is an additional configuration file added to support Identity Server. If you are installing Sitecore 9.1 or later you will want to enable the configuration file `Spe.IdentityServer.config`. + +{% hint style="info" %} +You can see the Sitecore Stack Exchange answer [here](https://sitecore.stackexchange.com/questions/17984/unable-to-elevate-console-in-9-1-azure-paas/18775#18775) describing the contents of the configuration. +{% endhint %} + +### Hanging Installation Wizard Some users have reported an [issue](https://github.com/SitecorePowerShell/Console/issues/404) 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. -**Article:** Martin Miles encountered the issue and proposed a fix [here][1]. +**Article:** Martin Miles encountered the issue and proposed a fix [here](https://github.com/SitecorePowerShell/Book/tree/5daee3160885dadd7031fee723dccf12a33abd7b/[https:/blog.martinmiles.net/post/sitecore-8-re-indexing-errors-out-and-module-installation-never-ends-without-mongodb-running]/README.md). -**Hack: ** Run this script on Sitecore 8.0. +**Hack:** Run this script on Sitecore 8.0. ```powershell $paths = @("C:\inetpub\wwwroot\Console\Website\App_Config\Include\*") $patterns = @("Sitecore.Analytics*.config", "Sitecore.ExperienceAnalytics*.config") - + $paths | Get-ChildItem -Include $patterns -Recurse | Rename-Item -NewName { $PSItem.Name + ".disabled" } ``` -### Exception Messages +## Exception Messages -#### ISE throws exception when /sitecore/content/home is missing +### ISE throws exception when /sitecore/content/home is missing -- [378](https://github.com/SitecorePowerShell/Console/issues/378) - Missing Home item (fixed in 3.2) +* [378](https://github.com/SitecorePowerShell/Console/issues/378) - Missing Home item \(fixed in 3.2\) -### Modules +## Modules -#### Integration Point is not working +### Integration Point is not working Be sure the module is enabled and the integrations are rebuilt from within the ISE. The following are some of the integration issues you may experience: * Content Editor Gutter - Entries not listed. * Content Editor Ribbon - Buttons not visible or working. * Control Panel - Entries not listed. -* Functions - Import-Function *name* parameter not populating with functions or can't be found after running the command. +* Functions - Import-Function _name_ parameter not populating with functions or can't be found after running the command. * Web API - Scripts not existing or can't be found. -[1]: http://blog.martinmiles.net/post/sitecore-8-re-indexing-errors-out-and-module-installation-never-ends-without-mongodb-running \ No newline at end of file +### Remoting + +* **404** error in browser console can be caused by missing SPE files, a custom pipeline, or perhaps a rewrite rule. +* **"The request failed with an empty response."** could be caused when TLS is offloaded to a load balancer and traffic to the endpoint is no longer over HTTPS. Fixed by issue \#[1005](https://github.com/SitecorePowerShell/Console/issues/1005). +* **"The underlying connection was closed: An unexpected error occurred on a send."** could be caused in Azure PaaS when requests are made using TLS 1.1 or lower. Setting the SecurityProtocol may help. Thanks to Jayesh Sheth for pointing to a resolution. + * `[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12` + + + diff --git a/web-api.md b/web-api.md deleted file mode 100644 index 6606b221..00000000 --- a/web-api.md +++ /dev/null @@ -1,31 +0,0 @@ -# Web API - -The Web API integration point exposes scripts through a url. - -The url will look something like the following: -http://remotesitecore/-/script/v2/master/homeanddescendants?user=sitecore\admin&password=b - -Here's the url broken down: - -* **API Version** - Specifies which service is being requested. - * v2 - This is the service that executes scripts stored in the integration point library. -* **Database** - Specifies which database contains the script. - * master - This database requires the credentials to be provided. -* **Script** - Specifies the name of the script contained in the database. - * homeanddescendants - Replace this name with whatever your script is called in the Web API library. -* **Query String Parameters** - Specifies the additional bits of data for use by the web service. - * user and password - Authenticates the request and in most cases will be needed. If the script is published to the *web* database the credentials are not required. - * scriptArguments - The PowerShell hashtable containing the query string parameters. - -**Note:** Examples included in the following modules -* Getting Started - -### Security - -The integration point can be completely disabled through configuration as described [here](security.md) for Restfulv2. - -### References - -* Watch Adam present this and much more on Sitecore! Experienced [here][1]. - -[1]: https://vimeo.com/134196432 \ No newline at end of file diff --git a/workflows.md b/workflows.md deleted file mode 100644 index 29a9df27..00000000 --- a/workflows.md +++ /dev/null @@ -1,30 +0,0 @@ -# Workflows - -The *Workflows* integration allows for scripts to run like workflow commands. Rules can be used to control visiblity and enablement. The script is only executed when the command is triggered. - -1. Begin by adding a new item to a workflow command of template type `/Modules/PowerShell Console/PowerShell Script Workflow Action`. We've added an insert option to help with this. -2. Edit the *Type string* field to your custom type or to the built in type `Cognifide.PowerShell.Integrations.Workflows.ScriptAction, Cognifide.PowerShell`. -3. Edit the *Script body* with the appropriate script. I like to save my workflow scripts in a library called *Workflows*. -4. Configure the rules on the workflow action item to specify when to execute. Leave the rule alone if you wish for it to execute any time the command is activated. -5. Edit the script in your *Workflows* library to perform the appropriate actions. The script can run in the background and show dialogs. -6. Change the icon of the workflow action item to match the script purpose. -7. Celebrate your success with the team! - -**Example:** The following requests input from the user then writes to the workflow history. -```powershell -$item = Get-Item -Path . -$comment = Show-Input -Prompt "Enter a comment:" -if($comment) { - New-ItemWorkflowEvent -Item $item -Text $comment -} -Close-Window -``` - -See how Adam integrated [workflow actions][2] if you are really curious to know more. - -### References - -* [Fixing problematic content or Workflow state][1] - -[1]: http://www.cognifide.com/blogs/sitecore/feel-the-power-in-powershell/ -[2]: http://blog.najmanowicz.com/2014/11/09/introducing-powershell-actions-for-sitecore-workflows/ \ No newline at end of file diff --git a/working-with-items.md b/working-with-items.md deleted file mode 100644 index 2eac065f..00000000 --- a/working-with-items.md +++ /dev/null @@ -1,437 +0,0 @@ -# Working with Sitecore items - -## How do I manage my content through PowerShell? - -The following commands provide you with the core methods needed to manage your content. Due to the nature of Windows PowerShell, commands such as these are extended with custom parameters and switches using [Dynamic Parameters][1]. These parameters are then added to the command at the time of use and only appear when the conditions are right. We've provided this table to help you discover the hidden gems within each command. - -| **Parameter Name** | **Description** | **Copy-Item** | **Get-Item** | **Get-ChildItem** | **Move-Item** | **New-Item** | **Remove-Item** | -| -- | -- | -- | -- | -- | -- | -- | -- | -| AmbiguousPaths | More than one item matches the criteria so show them all. | – | ✓ | ✓ | – | – | – | -| Database | The specified database will be used. Requires the ID to be set. | – | ✓ | – | – | – | – | -| DestinationItem | Parent item to receive the copied item. | ✓ | – | – | ✓ | – | – | -| FailSilently | Unauthorized access errors will be suppressed | ✓ | – | – | ✓ | – | ✓ | -| ID | Matches the item by ID. | – | ✓ | ✓ | – | – | – | -| Item | Instance item. | ✓ | – | ✓ | ✓ | – | ✓ | -| Language | Specifies the languages to include. | – | ✓ | ✓ | – | ✓ | – | -| Parent | Specifies the parent item. | – | – | – | – | ✓ | – | -| Permanently | Specifies the item should be deleted rather than recycled. | – | – | – | – | – | ✓ | -| Query | Matches the items by an XPath query. | – | ✓ | – | – | – | – | -| StartWorkflow | Initiates the default workflow, if any. | – | – | – | – | ✓ | – | -| TransferOptions | Options flag used when copying from one database to another. | ✓ | – | – | ✓ | – | – | -| Uri | Matches the item by ItemUri. | – | ✓ | – | – | – | – | -| Version | Specifies the version to include. | – | ✓ | ✓ | – | – | – | - -**Legend:** "–" - not applicable; "✓" - available. - -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. - -### Get items by Path - -**Example:** The following will retrieve the item based on the Sitecore path. - -```powershell -PS master:\> Get-Item -Path master:\content\home - -Name Children Languages Id TemplateName ----- -------- --------- -- ------------ -Home True {en, de-DE, es-ES, pt... {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item -``` - -As you may have noticed, the `/sitecore` portion of the path is unnecessary. This is because the *Sitecore* item is represented by the root item of the drive `master:` and is therefore optional. - -Let's have a look at the equivalent code in C#. - -```csharp -Sitecore.Data.Database master = Sitecore.Configuration.Factory.GetDatabase("master"); -Sitecore.Data.Items.Item item = master.GetItem("/sitecore/content/home"); -``` - -The above will return the latest version of the item in your current language. But what if you want the item in another language? No problem! - -**Example:** The following will retrieve the Danish version of the *Home* item. - -```powershell -PS master:\> Get-Item -Path master:/content/home -Language da | Format-Table DisplayName, Language, Id, Version, TemplateName - -DisplayName Language ID Version TemplateName ------------ -------- -- ------- ------------ -Hjem da {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -``` - -I've formatted the output above to show you that indeed the right language was returned. The command supports wildcards for both `-Language` and `-Version` parameters. You may have also noticed that the forward and backward slashes can be used interchangeably. - -**Example:** The following retrieves the latest version for all languages of an item. - -```powershell -PS master:\> Get-Item master:/content/home -Language * | Format-Table DisplayName, Language, Id, Version, TemplateName - -DisplayName Language ID Version TemplateName ------------ -------- -- ------- ------------ -Home en {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -Home de-DE {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -Home pl-PL {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 3 Sample Item -Home en-GB {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -Hjem da {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -``` - -Notice that the item with language `en-US` at its third version. - -**Example:** The following retrieves the item in all languages and versions. - -```powershell -PS master:\> Get-Item master:/content/home -Language * -Version *| Format-Table DisplayName, Language, Id, Version, TemplateName - -DisplayName Language ID Version TemplateName ------------ -------- -- ------- ------------ -Home en {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -Home de-DE {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -Home pl-PL {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 2 Sample Item -Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 3 Sample Item -Home en-GB {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -Hjem da {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -``` - -You can see that specifying the language and version using the wildcard will retrieve all possible variants of an item. The wildcard can also include a partial match like `en-*`. The use of that filter would return all items in the English language, ignoring the region. - -**Example:** The following retrieves the child items in all languages and versions. - -```powershell -PS master:\> Get-ChildItem master:/content -Language * -Version * | Format-Table DisplayName, Language, Id, Version, TemplateName - -DisplayName Language ID Version TemplateName ------------ -------- -- ------- ------------ -Home en {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -Home de-DE {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -Home pl-PL {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 2 Sample Item -Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 3 Sample Item -Home en-GB {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -Hjem da {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -CognifideCom en {6A1EC18E-AF9B-443E-84C7-5528F2363A10} 1 TenantTemplate -Demo en {4F02AEDF-1CC6-4B84-8B6E-F5CB465F8AD9} 1 TenantTemplate -GetEngaged en {68AD4037-EE50-4615-BA2E-AE11B1D3F6CC} 1 TenantTemplate -GetEngaged de-DE {68AD4037-EE50-4615-BA2E-AE11B1D3F6CC} 1 TenantTemplate -GetEngaged es-ES {68AD4037-EE50-4615-BA2E-AE11B1D3F6CC} 1 TenantTemplate -GetEngaged pt-BR {68AD4037-EE50-4615-BA2E-AE11B1D3F6CC} 1 TenantTemplate -GetEngaged pl-PL {68AD4037-EE50-4615-BA2E-AE11B1D3F6CC} 1 TenantTemplate -``` - -### Getting items by Path with Sitecore query - -It's not always most efficient to operate on items by traversing the tree using `Get-ChildItem`. This is especially true if you need to work on large trees but need to select only a few items (e.g. a specific template). For this we’ve 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*. - -```powershell -PS master:\> Get-Item -Path master: -Query "/sitecore/content//*[@@templatename='Sample Item']" - -Name Children Languages Id TemplateName ----- -------- --------- -- ------------ -Copy of Home True {en, de-DE, es-ES, pt... {503713E5-F9EE-4847-AEAF-DD13FD853004} Sample Item -Home True {en, de-DE, es-ES, pt... {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item -``` - -**Example:** The following retrieves all items beneath the path */sitecore/content/* with the template of *Sample Item* in all versions and languages. - -```powershell -PS master:\> Get-Item -Path master: -Query "/sitecore/content//*[@@templatename='Sample Item']" -Language * -Version * | Format-Table DisplayName, Language, Id, Version, TemplateName -AutoSize - -DisplayName Language ID Version TemplateName ------------ -------- -- ------- ------------ -Copy of Home en {503713E5-F9EE-4847-AEAF-DD13FD853004} 1 Sample Item -Home de-DE {503713E5-F9EE-4847-AEAF-DD13FD853004} 1 Sample Item -Copy of Home pl-PL {503713E5-F9EE-4847-AEAF-DD13FD853004} 1 Sample Item -Copy of Home en-US {503713E5-F9EE-4847-AEAF-DD13FD853004} 1 Sample Item -Hjem da {503713E5-F9EE-4847-AEAF-DD13FD853004} 1 Sample Item -Home en {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -Home de-DE {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -Home pl-PL {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 2 Sample Item -Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 3 Sample Item -Home en-GB {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -Hjem da {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item -``` - -### Get items by Id - -**Example:** The following retrieves an item by id. - -```powershell -PS master:\> Get-Item -Path master: -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" - -Name Children Languages Id TemplateName ----- -------- --------- -- ------------ -Home True {en, de-DE, es-ES, pt... {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item -``` - -### Get items by Uri - -The Uri encodes the language and version within the path. - -**Example:** The following retrieves an item by uri. - -```powershell -PS master:\> Get-Item -Path master: -Uri "sitecore://master/{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}?lang=en&ver=1" - -Name Children Languages Id TemplateName ----- -------- --------- -- ------------ -Home True {en, de-DE, es-ES, pt... {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item -``` - -In all the examples you'll notice we specified the database. Windows PowerShell needs to know which provider to execute within. This also signals to SPE to show the dynamic parameters. Other examples of providers include the following: -* **HKLM:** - The registry provider for HKEY_LOCAL_MACHINE. -* **C:** - The filesystem provider for the C drive. - -### Get items and select properties -The following examples make use of custom *PropertySet*s for the command `Select-Object`. - -**Example:** The following uses the **PSSecurity** *PropertySet*. - -```powershell -PS master:\ >Get-Item -Path "master:\content\home" | Select PSSecurity - -Name ID __Owner __Security ----- -- ------- ---------- -Home {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} sitecore\admin au|sitecore\michael|pe|+item:read| -``` - -**Example:** The following uses the **PSTemplate** *PropertySet*. - -```powershell -PS master:\> Get-Item -Path "/sitecore/media library/Images/SPE/kitten1" | Select PSTemplate - -Name ID BaseTemplate ----- -- ------------ -kitten1 {E58FA823-3CAF-43A1-A5ED-FBE24D3C21B4} {Image, File, Standard template, Media classification...} -``` - -**Example:** The following uses the **PSImage** *PropertySet*. - -```powershell -PS master:\> Get-Item -Path "/sitecore/media library/Images/SPE/kitten1" | Select PSImage - -Name : kitten1 -ID : {E58FA823-3CAF-43A1-A5ED-FBE24D3C21B4} -Alt : Yay -Width : 225 -Height : 225 -Extension : jpg -Size : 6593 -``` - -**Example:** The following uses the **PSSchedule** *PropertySet*. - -```powershell -PS master:\> Get-Item -Path "/sitecore/system/Tasks/Schedules/Content Testing/Calculate Statistical Relevancy" | Select PSSchedule - -Name : Calculate Statistical Relevancy -ID : {C7533E65-A1D6-4F99-9F12-0AB157299D80} -Schedule : 1900101|19000101|127|1.00:00 -Last run : 1/1/0001 12:00:00 AM -Command : {6A79C206-0CD2-4DDD-9DFF-5BF21E002931} -Items : -``` - -### Get item properties with field type - -**Example:** The following accesses the *Image* field casted to the type `Sitecore.Data.Fields.ImageField`. -```powershell -$item = Get-Item "master:\content\home" -$item._.Image.Alt -``` - -**Note:** You can use `._` and `.PSFields` to gain access to the typed field. - ---- - -### Changing item properties - -We often see the following two ways of accessing and changing fields used in scripts. One uses `Set-ItemProperty` and the other is more natural to a Sitecore developer. - -**Example:** The following sets the title property using `Set-ItemProperty`. - -```powershell -PS master:\> Set-ItemProperty -Path master:/content/home -Name "Title" -Value "New Title" -``` - -**Example:** The following sets the title and clears the branch id using `.Editing.BeginEdit` and `.Editing.EndEdit` methods. - -```powershell -$item = Get-Item master:/content/home -$item.Editing.BeginEdit() -$item["Title"] = "New Title" -$item.BranchId = [Guid]::Empty # or a new value if changing it -$item.Editing.EndEdit() -``` -**Note:** The above example may also be written in the ISE where no console prompt is visible. - -The previous examples work but are not the most efficient ways to change item content. The items returned by the provider expose the Sitecore item fields as automated PowerShell properties. - -**Example:** The following sets the title property using the automated PowerShell property. - -```powershell -$item = Get-Item master:/content/home -$item.Title = "New Title" -``` - -**Example:** The following sets the title property using the semi-native PowerShell property without the use of a variable. - -```powershell -(Get-Item master:/content/home).Title = "New Title" -``` - -This technique may be used for a wide variety of property types. There are a other hidden gems in those properties. For example if we detect that the field is a *Date* or *Datetime* field, we will return `System.DateTime` typed value from a field rather than the `System.String` Sitecore stores internally. - -**Example:** The following gets the created date. - -```powershell -PS master:\> (Get-Item master:/content/home).__Created -Monday, April 07, 2008 1:59:00 PM -``` - -**Example:** The following assigns a `System.DateTime` value to the PowerShell automated property. - -```powershell -PS master:\> (Get-Item master:/content/home).__Created = [DateTime]::Now -PS master:\> (Get-Item master:/content/home).__Created -Monday, October 13, 2014 1:59:41 AM -``` - -Great we've just changed it! Our property handlers take care of all the necessary usages of `.Editing.BeginEdit` and `.Editing.EndEdit`. This method can be applied for a variety of field types such as *GeneralLink* and *Image*. - -To provide an example – I’ve extended my home with additional fields as follows: - -![Extended Sample Item](http://blog.najmanowicz.com/wp-content/uploads/2014/10/image.png) - -**Example:** The following assigns an image to the Image field. - -```powershell -(Get-Item master:/content/home).Image = Get-Item 'master:\media library\logo' -``` - -Easy enough, isn't it? Let SPE detect the field type for you and worry about what to call! Now let's assign a content item to *GeneralLink*. - -**Example:** The following assigns a content item to a *GeneralLink* field. - -```powershell -(Get-Item master:/content/home).GeneralLink = Get-Item 'master:\content\CognifideCom' -``` - -What about fields that accept lists of items? We've got your back here as well. - -**Example:** The following assigns all children of `/sitecore/content/` item to the *ItemList* field. - -```powershell -(Get-Item master:/content/home).ItemList = Get-ChildItem 'master:\content\' -``` - -Let's see how our item looks in the Content editor after all the assignments that we've just performed: - -![ItemList Assignment](http://blog.najmanowicz.com/wp-content/uploads/2014/10/image1.png) - -Great! Looks like it worked. - -Those little improvements make your scripts much more succinct and understandable. Try it for yourself! - -#### When not to use the automated properties? - -As with every rule there is an exception to this one. Those automated properties perform the `$item.Editing.BeginEdit()` and `$item.Editing.EndEdit()` every time which results in saving the item after every assignment. Assigning multiple properties on an item this way might be detrimental to the performance of your script. In such cases you might want to call `$item.Editing.BeginEdit()` yourself before modifying the item. Subsequently call the `$item["field name"] = "new value"` for each property modify. Finally end with the `$item.Editing.EndEdit()`. - -Choosing this way is situational and will usually only be required if you're working with a large volume of data. In those cases you might also want to introduce the `Sitecore.Data.BulkUpdateContext` trick used in [this blog post](http://bartlomiejmucha.com/en/blog). - -Example: The following sets multiple automated properties while using the `Sitecore.Data.BulkUpdateContext`. - -```powershell -Import-Function -Name New-UsingBlock - -New-UsingBlock (New-Object Sitecore.Data.BulkUpdateContext) { - foreach($item in Get-ChildItem -Path "master:\content\home") { - $item.Editing.BeginEdit() - $item["Title"] = "Sample Item" - $item["Text"] = "Sample Item" - $item.Editing.EndEdit() | Out-Null - } -} -``` - -Some other classes you may want to use with the `New-UsingBlock` function: -* `Sitecore.SecurityModel.SecurityDisabler` -* `Sitecore.Data.BulkUpdateContext` -* `Sitecore.Globalization.LanguageSwitcher` -* `Sitecore.Sites.SiteContextSwitcher` -* `Sitecore.Data.DatabaseSwitcher` -* `Sitecore.Security.Accounts.UserSwitcher` -* `Sitecore.Data.Items.EditContext` -* `Sitecore.Data.Proxies.ProxyDisabler` -* `Sitecore.Data.DatabaseCacheDisabler` -* `Sitecore.Data.Events.EventDisabler` - ---- - -### Copy items to a new destination - -You will find yourself one day in need of copying items on a small to large scale. The `Copy-Item` command will likely meet the need. - -**Example:** The following copies the item to the specified path with a new ID. - -```powershell -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. - -**Example:** The following transfers the item to the specified path with the same ID. - -```powershell -Copy-Item master:\content\Home web:\content\home -TransferOptions 0 -``` - ---- - -### Move items to a new destination - -There is a always a better way to do something. Moving items en masse is certainly one that you don't want to do by hand. If the destination item exists the moved item will be added as a child. If the destination item does not exist the source item will be renamed when moved. - -**Example:** The following moves the item from one parent to another. - -```powershell -Move-Item -Path "master:\content\home\sample item\Sample Item 1" -Destination "master:\content\home\sample item 2\" -``` - ---- - -### Create new items - -**Example:** The following creates a new item with the specified template. - -```powershell -New-Item -Path "master:\content\home\sample item\Sample Item 3" -ItemType "Sample/Sample Item" - -Name Children Languages Id TemplateName ----- -------- --------- -- ------------ -Sample Item 3 False {en} {F6F4F7B7-5E72-4C16-9294-218D80ED89E8} Sample Item - -``` - ---- - -### Remove items permanently - -**Example:** The following removes the item permanently. Proceed with caution. - -```powershell -Remove-Item -Path "master:\content\home\sample item\Sample Item 3" -Permanently -``` - -### References - -* [Working with Sitecore Items in PowerShell Extensions](http://blog.najmanowicz.com/2014/10/12/working-with-sitecore-items-in-powershell-extensions/) - -[1]: https://technet.microsoft.com/en-us/library/dd878299%28v=vs.85%29.aspx \ No newline at end of file diff --git a/working-with-items/README.md b/working-with-items/README.md new file mode 100644 index 00000000..05b64a16 --- /dev/null +++ b/working-with-items/README.md @@ -0,0 +1,675 @@ +# Working with Items + +## Command Introduction + +The majority of scripts written with SPE contain one or more of the following commands: + +{% tabs %} +{% tab title="Get-Item" %} +* Use this to retrieve a single item. Throws an error if the item does not exist. +* Use when Sitecore `query:` or `fast:` is required. May return more than 1 item. + +```powershell +Get-Item -Path "master:\content\home" +``` +{% endtab %} + +{% tab title="Get-ChildItem" %} +* Use to return an item's children and grandchildren. + +```powershell +Get-ChildItem -Path "master:\content\home" -Recurse +``` +{% endtab %} + +{% tab title="New-Item" %} +* Use to create an item based on a specified data template. + +```powershell +New-Item -Path "master:\content\home" -Name "Demo" -ItemType "Sample/Sample Item" +# or +New-Item -Path "master:\content\home" -Name "Demo" -ItemType "{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}" +``` +{% endtab %} + +{% tab title="Remove-Item" %} +* Use to delete or recycle an item. +* Accepts items returned by `Get-Item` and `Get-ChildItem`. + +```powershell +Get-Item -Path "master:\content\home\delete-me" | Remove-Item +``` +{% endtab %} + +{% tab title="Move-Item" %} +* Use to transfer an item from one location to another. + +```powershell +Move-Item -Path "master:\content\home\Demo" -Destination "master:\content\home\Demo1" +``` +{% endtab %} + +{% tab title="Copy-Item" %} +* Use to duplicate an item from one location to another. + +```powershell +# Add -PassThru to output the new item +Copy-Item -Path "master:\content\home\Demo1" -Destination "master:\content\home\Demo2" +``` +{% endtab %} +{% endtabs %} + +### Command Parameters + +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](https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/cmdlet-dynamic-parameters?view=powershell-5.1). These parameters are then added to the command at the time of use and only appear when the conditions are right. We've provided this table to help you discover the hidden gems within each command. + +| **Parameter Name** | **Description** | **Copy-Item** | **Get-Item** | **Get-ChildItem** | **Move-Item** | **New-Item** | **Remove-Item** | +| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | +| AmbiguousPaths | More than one item matches the criteria so show them all. | – | ✓ | - | – | – | – | +| Database | The specified database will be used. Requires the ID to be set. | – | ✓ | – | – | – | – | +| DestinationItem | Parent item to receive the copied item. | ✓ | – | – | ✓ | – | – | +| FailSilently | Unauthorized access errors will be suppressed | ✓ | – | – | ✓ | – | ✓ | +| ForceId | Forces the new item to use a specified GUID | – | – | – | – | ✓ | – | +| ID | Matches the item by ID. | – | ✓ | ✓ | – | – | – | +| Item | Instance item. | ✓ | – | ✓ | ✓ | – | ✓ | +| Language | Specifies the languages to include. | – | ✓ | ✓ | – | ✓ | – | +| Parent | Specifies the parent item. | – | – | – | – | ✓ | – | +| Permanently | Specifies the item should be deleted rather than recycled. | – | – | – | – | – | ✓ | +| Query | Matches the items by an XPath query. | – | ✓ | – | – | – | – | +| StartWorkflow | Initiates the default workflow, if any. | – | – | – | – | ✓ | – | +| TransferOptions | Options flag used when copying from one database to another. | ✓ | – | – | ✓ | – | – | +| Uri | Matches the item by ItemUri. | – | ✓ | – | – | – | – | +| Version | Specifies the version to include. | – | ✓ | ✓ | – | – | – | +| WithParent | Specifies the command should include the parent item. | – | - | ✓ | – | – | – | + +**Legend:** "–" - not applicable; "✓" - available. + +Below we will show how to use each command with the Windows PowerShell syntax followed by some examples of the common C\# equivalent. + +## Finding Items + +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. We'll show an [example](./#sitecore-api) of this later. + +{% hint style="info" %} +Check out some performance details when using different methods of querying items on the [Sitecore StackExchange](https://sitecore.stackexchange.com/questions/6803/sitecore-powershell-query-for-big-images-of-a-certain-size/6811#6811). +{% endhint %} + +### Get-Item : by Path + +**Example:** The following will retrieve the item based on the Sitecore path. + +```powershell +PS master:\> Get-Item -Path master:\content\home + +Name Children Languages Id TemplateName +---- -------- --------- -- ------------ +Home True {en, de-DE, es-ES, pt... {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item +``` + +As you may have noticed, the `/sitecore` portion of the path is unnecessary. This is because the _Sitecore_ item is represented by the root item of the drive `master:` and is therefore optional. + +Let's have a look at the equivalent code in C\#. + +```csharp +Sitecore.Data.Database master = Sitecore.Configuration.Factory.GetDatabase("master"); +Sitecore.Data.Items.Item item = master.GetItem("/sitecore/content/home"); +``` + +The above will return the latest version of the item in your current language. But what if you want the item in another language? No problem! + +**Example:** The following will retrieve the Danish version of the _Home_ item. + +```powershell +PS master:\> Get-Item -Path master:/content/home -Language da | Format-Table -Property DisplayName, Language, Id, Version, TemplateName + +DisplayName Language ID Version TemplateName +----------- -------- -- ------- ------------ +Hjem da {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +``` + +I've formatted the output above to show you that indeed the right language was returned. The command supports wildcards for both `-Language` and `-Version` parameters. You may have also noticed that the forward and backward slashes can be used interchangeably. + +**Example:** The following retrieves the latest version for all languages of an item. + +```powershell +PS master:\> Get-Item -Path master:/content/home -Language * | Format-Table -Property DisplayName, Language, Id, Version, TemplateName + +DisplayName Language ID Version TemplateName +----------- -------- -- ------- ------------ +Home en {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +Home de-DE {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +Home pl-PL {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 3 Sample Item +Home en-GB {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +Hjem da {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +``` + +Notice that the item with language `en-US` at its third version. + +**Example:** The following retrieves the item in all languages and versions. + +```powershell +PS master:\> Get-Item -Path master:/content/home -Language * -Version *| Format-Table -Property DisplayName, Language, Id, Version, TemplateName + +DisplayName Language ID Version TemplateName +----------- -------- -- ------- ------------ +Home en {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +Home de-DE {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +Home pl-PL {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 2 Sample Item +Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 3 Sample Item +Home en-GB {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +Hjem da {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +``` + +You can see that specifying the language and version using the wildcard will retrieve all possible variants of an item. The wildcard can also include a partial match like `en-*`. The use of that filter would return all items in the English language, ignoring the region. + +### Get-ChildItem : by Path + +**Example:** The following retrieves the child items in all languages and versions. + +```powershell +PS master:\> Get-ChildItem -Path master:/content -Language * -Version * | Format-Table -Property DisplayName, Language, Id, Version, TemplateName + +DisplayName Language ID Version TemplateName +----------- -------- -- ------- ------------ +Home en {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +Home de-DE {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +Home pl-PL {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 2 Sample Item +Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 3 Sample Item +Home en-GB {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +Hjem da {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +``` + +### Get-Item : Sitecore query + +It's not always most efficient to operate on items by traversing the tree using `Get-ChildItem`. This is especially true if you need to work on large trees but need to select only a few items \(e.g. a specific template\). For this we’ve introduced support for the Sitecore query within our provider. + +> Important to note that the query format sometimes requires the use of a `#` before and after paths when they contain reserved keywords or spaces. +> +> Workaround found [here on Sitecore Stack Exchange](https://sitecore.stackexchange.com/questions/10127/how-to-escape-a-query-in-sitecore-powershell). + +**Example:** The following retrieves all items beneath the path _/sitecore/content/_ with the template of _Sample Item_. + +```powershell +PS master:\> Get-Item -Path master: -Query "/sitecore/content//*[@@templatename='Sample Item']" + +Name Children Languages Id TemplateName +---- -------- --------- -- ------------ +Copy of Home True {en, de-DE, es-ES, pt... {503713E5-F9EE-4847-AEAF-DD13FD853004} Sample Item +Home True {en, de-DE, es-ES, pt... {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item +``` + +**Example:** The following retrieves all items beneath the path _/sitecore/content/_ with the template of _Sample Item_ in all versions and languages. + +```powershell +PS master:\> Get-Item -Path master: -Query "/sitecore/content//*[@@templatename='Sample Item']" -Language * -Version * | Format-Table -Property DisplayName, Language, Id, Version, TemplateName -AutoSize + +DisplayName Language ID Version TemplateName +----------- -------- -- ------- ------------ +Home de-DE {503713E5-F9EE-4847-AEAF-DD13FD853004} 1 Sample Item +Hjem da {503713E5-F9EE-4847-AEAF-DD13FD853004} 1 Sample Item +Home en {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +Home de-DE {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +Home pl-PL {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 2 Sample Item +Home en-US {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 3 Sample Item +Home en-GB {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +Hjem da {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} 1 Sample Item +``` + +**Example:** The following retrieves items matching the query with a specified ISO date and present in a report dialog. + +```powershell +$isoDate = [Sitecore.DateUtil]::ToIsoDate([datetime]::Today) +Get-Item -Path master: -Query "/sitecore/content/home//*[@__Publish > '$($isoDate)']" | + Show-ListView -Property ID,Name,ItemPath +``` + +### Get-Item : Sitecore Fast query + +**Example:** The following returns items with a specific template under a given root using Fast query. + +```powershell +$rootItemId = "{839085D0-C279-47C6-83C9-9CC28E7C111E}" +$rootItem = Get-Item -Path "master:" -ID $rootItemId +$templateId = "{759BA7B1-A216-467E-A37C-2B8D7F1A713C}" + +$query = "fast:$($rootItem.ItemPath)//*[@@templateid='$($templateId)']" +Get-Item -Path "master:" -Query $query +``` + +### Get-Item : by XPath + +The setup is not exactly like you would find in the XPath Builder but should get the job done. Read more about it [here](https://github.com/SitecorePowerShell/Console/issues/1069). + +**Example:** The following retrieves items matching an XPath query. + +```powershell +$query = "ancestor-or-self::*[@@templatename='Sample Item']" + +# Retrieve the items with Axes and a given context item. +$SitecoreContextItem.Axes.SelectItems($query) + +# Retrieve the items using the Query class and context item. +# Retrieve the items by prepending the context path to the query. +Get-Item -Path "master:" -Query ("$($SitecoreContextItem.Paths.Path)/$query") +``` + +### Get-Item : by Id + +**Example:** The following retrieves an item by id. + +```powershell +PS master:\> Get-Item -Path master: -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" + +Name Children Languages Id TemplateName +---- -------- --------- -- ------------ +Home True {en, de-DE, es-ES, pt... {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item +``` + +### Get-Item : by Uri + +The Uri encodes the language and version within the path. + +**Example:** The following retrieves an item by uri. + +```powershell +PS master:\> Get-Item -Path master: -Uri "sitecore://master/{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}?lang=en&ver=1" + +Name Children Languages Id TemplateName +---- -------- --------- -- ------------ +Home True {en, de-DE, es-ES, pt... {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} Sample Item +``` + +In all the examples you'll notice we specified the database. Windows PowerShell needs to know which provider to execute within. This also signals to SPE to show the dynamic parameters. Other examples of providers include the following: + +* **HKLM:** - The registry provider for HKEY\_LOCAL\_MACHINE. +* **C:** - The filesystem provider for the C drive. + +### Get-Item : select properties + +The following examples make use of custom _PropertySet_ for the command `Select-Object`. + +**Example:** The following uses the **PSSecurity** _PropertySet_. + +```powershell +PS master:\ >Get-Item -Path "master:\content\home" | Select-Object -Property PSSecurity + +Name ID __Owner __Security +---- -- ------- ---------- +Home {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} sitecore\admin au|sitecore\michael|pe|+item:read| +``` + +**Example:** The following uses the **PSTemplate** _PropertySet_. + +```powershell +PS master:\> Get-Item -Path "/sitecore/media library/Images/SPE/kitten1" | Select-Object -Property PSTemplate + +Name ID BaseTemplate +---- -- ------------ +kitten1 {E58FA823-3CAF-43A1-A5ED-FBE24D3C21B4} {Image, File, Standard template, Media classification...} +``` + +**Example:** The following uses the **PSImage** _PropertySet_. + +```powershell +PS master:\> Get-Item -Path "/sitecore/media library/Images/SPE/kitten1" | Select-Object -Property PSImage + +Name : kitten1 +ID : {E58FA823-3CAF-43A1-A5ED-FBE24D3C21B4} +Alt : Yay +Width : 225 +Height : 225 +Extension : jpg +Size : 6593 +``` + +**Example:** The following uses the **PSSchedule** _PropertySet_. + +```powershell +PS master:\> Get-Item -Path "/sitecore/system/Tasks/Schedules/Content Testing/Calculate Statistical Relevancy" | Select-Object -Property PSSchedule + +Name : Calculate Statistical Relevancy +ID : {C7533E65-A1D6-4F99-9F12-0AB157299D80} +Schedule : 1900101|19000101|127|1.00:00 +Last run : 1/1/0001 12:00:00 AM +Command : {6A79C206-0CD2-4DDD-9DFF-5BF21E002931} +Items : +``` + +### Get-Item : properties with field type + +**Example:** The following accesses the _Image_ field casted to the type `Sitecore.Data.Fields.ImageField`. + +```powershell +$item = Get-Item -Path "master:\content\home" +$item._.Image.Alt +``` + +**Note:** You can use `._` and `.PSFields` to gain access to the typed field. + +**Example:** The following accesses the _Link_ field casted to the type `Sitecore.Data.Fields.LinkField`. From there you can see all of the available properties. + +```powershell +PS master:\> $currentItem = Get-Item -Path 'master:\content\home\sample-item' +PS master:\> $currentItem.PSFields."LinkFieldName" + +Anchor : +Class : +InternalPath : /sitecore/content/home/sample-item/ +IsInternal : True +IsMediaLink : False +LinkType : internal +MediaPath : +QueryString : +Target : +TargetID : {263293D3-B1B3-4C2C-9A75-6BD418F376BC} +TargetItem : Sitecore.Data.Items.Item +Text : CLICK HERE +Title : +Url : +Root : link +Xml : #document +InnerField : +Value : +``` + +**Example:** The following finds all of the `TextField`s and outputs to the console. + +```powershell +$item = Get-Item -Path "master:\content\home" +foreach($field in $item.Fields) { + $item.PSFields."$($field.Name)" | + Where-Object { $_ -is [Sitecore.Data.Fields.TextField] } +} +``` + +## Editing Items + +### Get-Item : then change item properties + +We often see the following two ways of accessing and changing fields used in scripts. One uses `Set-ItemProperty` and the other is more natural to a Sitecore developer. + +**Example:** The following sets the title property using `Set-ItemProperty`. + +```powershell +PS master:\> Set-ItemProperty -Path master:/content/home -Name "Title" -Value "New Title" +``` + +**Example:** The following sets the title and clears the branch id using `.Editing.BeginEdit` and `.Editing.EndEdit` methods. + +```powershell +$item = Get-Item master:/content/home +$item.Editing.BeginEdit() +$item["Title"] = "New Title" +$item.BranchId = [Guid]::Empty # or a new value if changing it +$item.Editing.EndEdit() +``` + +**Note:** The above example may also be written in the ISE where no console prompt is visible. + +The previous examples work but are not the most efficient ways to change item content. The items returned by the provider expose the Sitecore item fields as automatic PowerShell properties. + +{% hint style="info" %} +If the property name on the data template contains a space, such as \`Closing Date\`, then you will need to wrap the field name in quotes \(single or double\). +{% endhint %} + +**Example:** The following sets the title property using the automated PowerShell property. + +```powershell +$item = Get-Item -Path master:/content/home +$item.Title = "New Title" +$item."Closing Date" = [datetime]::Today +``` + +**Example:** The following changes the display name of the item. + +```powershell +$item = Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" +$item."__Display name" = "I Like Turtles" +``` + +This technique may be used for a wide variety of property types. + +{% hint style="info" %} +If you need to dynamically reference a property via a property name that is stored in a variable, there are numerous ways to reference it. +{% endhint %} + +**Example:** +```powershell +$item = Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" +$fieldName = "__Display name" + +# All variations will work +Write-Host ($item.$fieldName) +Write-Host ($item."$fieldName") +Write-Host ($item."$($fieldName)") +``` + +There are a other hidden gems in automated PowerShell properties. For example, if we detect that the field is a _Date_ or _Datetime_ field, we will return `System.DateTime` typed value from a field rather than the `System.String` Sitecore stores internally. + +**Example:** The following gets the created date. + +```powershell +$item = Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" +$item.__Created + +# Monday, April 07, 2008 1:59:00 PM +``` + +**Example:** The following assigns a `System.DateTime` value to the PowerShell automated property. + +```powershell +$item = Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" +$item.__Created = [DateTime]::Now +$item.__Created + +# Tuesday, March 17, 2020 12:00:00 PM +``` + +Great we've just changed it! Our property handlers take care of all the necessary usages of `.Editing.BeginEdit` and `.Editing.EndEdit`. This method can be applied for a variety of field types such as _GeneralLink_ and _Image_. + +To provide an example – I’ve extended my home with additional fields as follows: + +![Extended Sample Item](https://blog.najmanowicz.com/wp-content/uploads/2014/10/image.png) + +**Example:** The following assigns an image to the Image field. + +```powershell +$homeItem = Get-Item -Path "master:/content/home" +$homeItem.Image = Get-Item -Path "master:\media library\logo" +``` + +Easy enough, isn't it? Let SPE detect the field type for you and worry about what to call! Now let's assign a content item to _GeneralLink_. + +**Example:** The following assigns a content item to a _GeneralLink_ field. + +```powershell +$homeItem = Get-Item -Path "master:/content/home" +$homeItem.GeneralLink = Get-Item -Path "master:\content\home-away-from-home" +``` + +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. + +```powershell +$homeItem = Get-Item -Path "master:/content/home" +$homeItem.ItemList = Get-ChildItem -Path 'master:\content\' +``` + +Let's see how our item looks in the Content editor after all the assignments that we've just performed: + +![ItemList Assignment](https://blog.najmanowicz.com/wp-content/uploads/2014/10/image1.png) + +Great! Looks like it worked. + +Those little improvements make your scripts much more succinct and understandable. Try it for yourself! + +#### When not to use the automated properties? + +As with every rule there is an exception to this one. Those automated properties perform the `$item.Editing.BeginEdit()` and `$item.Editing.EndEdit()` every time which results in saving the item after every assignment. Assigning multiple properties on an item this way might be detrimental to the performance of your script. In such cases you might want to call `$item.Editing.BeginEdit()` yourself before modifying the item. Subsequently call the `$item["field name"] = "new value"` for each property modify. Finally end with the `$item.Editing.EndEdit()`. + +Choosing this way is situational and will usually only be required if you're working with a large volume of data. In those cases you might also want to introduce the `Sitecore.Data.BulkUpdateContext` technique. + +**Example:** The following sets multiple properties while using the `Sitecore.Data.BulkUpdateContext`. + +```powershell +New-UsingBlock (New-Object Sitecore.Data.BulkUpdateContext) { + foreach($item in Get-ChildItem -Path "master:\content\home") { + $item.Editing.BeginEdit() + $item["Title"] = "Sample Item" + $item["Text"] = "Sample Item" + $item.Editing.EndEdit() > $null + } +} +``` + +Example: The following generates a relative url to the specified site and assigns to a variable. Because the `New-UsingBlock` command creates a new closure, you need to return the data to use in a different scope. + +```powershell +$site = [Sitecore.Sites.SiteContextFactory]::GetSiteContext("usa") +$relativeUrl = New-UsingBlock (New-Object Sitecore.Sites.SiteContextSwitcher $site) { + $pageItem = Get-Item -Path "master:" -Id "{50BE527C-7241-4613-A7A9-20D0217B264B}" + [Sitecore.Links.LinkManager]::GetItemUrl($pageItem) +} +``` + +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` + +### Sitecore API + +If you have reached this point, then you are clearly a nerd and want to access using the raw Sitecore API. + +**Example:** The following queries all descendants of the media library, filters by size, and wraps with automatic properties. + +```powershell +# Get the root node using Get-Item, then a call to Axes. +$mediaItemContainer = Get-Item -Path "master:/media library" +$items = $mediaItemContainer.Axes.GetDescendants() | + Where-Object { [int]$_.Fields["Size"].Value -gt 100000 } | Initialize-Item +``` + +## Copying Items + +### Copy-Item : to a new destination + +You will find yourself one day in need of copying items on a small to large scale. The `Copy-Item` command will likely meet the need. + +**Example:** The following copies the item to the specified path with a new ID. + +```powershell +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. + +**Example:** The following transfers the item to the specified path with the same ID. + +```powershell +Copy-Item -Path master:\content\Home -Destination web:\content\home -TransferOptions 0 +``` + +**Example:** The following copies an entire tree of items and maintains the tree structure. + +```powershell +$sourceId = "{AF27FAD3-2AF0-4682-9BF7-375197587579}" +$destinationId = "{53F94442-555B-4622-B813-A16ED2CAB01B}" +$children = Get-ChildItem -Path "master:" -ID $sourceId +foreach($child in $children) { + $child | Copy-Item -Destination $destinationId -Recurse +} +``` + +## Moving Items + +### Move-Item : to a new destination + +There is a always a better way to do something. Moving items en masse is certainly one that you don't want to do by hand. If the destination item exists the moved item will be added as a child. If the destination item does not exist the source item will be renamed when moved. + +**Example:** The following moves the item from one parent to another. + +```powershell +Move-Item -Path "master:\content\home\sample item\Sample Item 1" -Destination "master:\content\home\sample item 2\" +``` + +Example: The following gets an item and moves to a new parent node, along with all the children. + +```powershell +Get-Item -Path "master:" -ID "{65736CA0-7D69-452A-A16F-2F42264D21C5}" | + Move-Item -Destination "master:{DFDDF372-3AB7-45B1-9E7C-0D0B27350439}" +``` + +## Creating Items + +### New-Item + +**Example:** The following creates a new item with the specified template. + +```powershell +$itemPath = "master:\content\home\sample item\Sample Item 3" +New-Item -Path $itemPath -ItemType "Sample/Sample Item" + +Name Children Languages Id TemplateName +---- -------- --------- -- ------------ +Sample Item 3 False {en} {F6F4F7B7-5E72-4C16-9294-218D80ED89E8} Sample Item +``` + +**Example:** The following creates a new item with the specified template id and id. + +```powershell +$itemPath = "master:\content\home\sample item\Sample Item 4" +$templateId = "{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}" +$itemId = "{9459ADDD-4471-4ED3-A041-D33E559BD321}" +New-Item -Path $itemPath -ItemType $templateId -ForceId $itemId + +Name Children Languages Id TemplateName +---- -------- --------- -- ------------ +Sample Item 4 False {en} {9459ADDD-4471-4ED3-A041-D33E559BD321} Sample Item +``` + +**Example:** The following creates a new item as a child of the specified item. + +```powershell +$templateId = "{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}" +$parentItem = Get-Item -Path "master:\" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" +New-Item -Parent $parentItem -Name "Sample Item 3" -ItemType $templateId + + +Name Children Language Version Id TemplateName +---- -------- -------- ------- -- ------------ +Sample Item 3 False en 1 {2F71043A-C731-4EC2-BFE4-0604D4D71652} Sample Item +``` + +**Note:** The `New-Item` command was passed to `Format-Table -Autosize` to improve the formatting. + +## Removing Items + +### Remove-Item : permanently + +**Example:** The following removes the item permanently. Proceed with caution. + +```powershell +Remove-Item -Path "master:\content\home\sample item\Sample Item 3" -Permanently +``` + +### References + +* [Working with Sitecore Items in PowerShell Extensions](https://blog.najmanowicz.com/2014/10/12/working-with-sitecore-items-in-powershell-extensions/) + diff --git a/working-with-items/item-languages.md b/working-with-items/item-languages.md new file mode 100644 index 00000000..36966457 --- /dev/null +++ b/working-with-items/item-languages.md @@ -0,0 +1,101 @@ +# Item Languages + +The section on [working with items](./) provided a variety of examples in retrieving items based on their language. In this section will show how to manage items and their languages. + +## Add Language Version + +**Example:** The following example queries all of the content items and adds a new language version of "en-ca", while overwriting any that exist. + +```powershell +Get-ChildItem "master:\content" -Recurse | + Add-ItemLanguage -Language "en-us" -TargetLanguage "en-ca" -IfExist OverwriteLatest +``` + +**Example:** The following example adds a language version from English to US and Polish while leaving the `Title` field blank. If a version already exists nothing happens. + +```powershell +$languageParameters = @{ + Path = "master:\content\home" + Language = "en" + TargetLanguage = @("pl-pl","en-us") + IfExist = "Skip" + IgnoredFields = @("Title") +} +Add-ItemLanguage @languageParameters +``` + +**Example:** The following example adds a language version from English to Polish of Template Name _Sample Item_. If the version exists a new version is created for that language. Finally the results are displayed as a table showing only the `Name`, `Language`, and `Version`. + +```powershell +Get-ChildItem "master:\content\home" -Language "en" -Recurse | + Where-Object { $_.TemplateName -eq "Sample Item" } | + Add-ItemLanguage -TargetLanguage "pl-pl" -IfExist Append | + Format-Table Name, Language, Version -AutoSize +``` + +**Example:** The following example adds a language version in Polish to the _Home_ item and all its children. If the version exists nothing happens. No fields were harmed in the making of this version. + +```powershell +Add-ItemLanguage -Path "master:\content\home" -TargetLanguage "pl-pl" -IfExist Skip -DoNotCopyFields -Recurse +``` + +## Remove Language Version + +**Example:** The following example queries all of the content items and removes the language version of "fr-CA". + +```powershell +Get-ChildItem "master:\content" -Recurse | + Remove-ItemLanguage -Language "fr-CA" +``` + +## New Item with Forced Language Version + +**Example:** The following example creates a new item with language versions only matching the specified languages; all other language version are removed. + +```powershell +$itemPath = "master:\content\home\sample item\Sample Item 3" +New-Item -Path $itemPath -ItemType "Sample/Sample Item" -Language "en-CA" + +Name Children Language Version Id TemplateName +---- -------- -------- ------- -- ------------ +Sample Item 3 False en-CA 1 {C9517583-3AF9-4AFB-B247-BB0A09F55D94} Sample Item +``` + +## Parameters and Configuration + +Supported parameters: + +* `-Recurse` Translates item and its children +* `-IfExist` Accepts one of 3 pretty self explanatory actions: `Skip`, `Append` or `OverwriteLatest` +* `-TargetLanguage` accepts a list of languages that should be created +* `-DoNotCopyFields` creates a new version but does not copy field values from original language +* `-IgnoredFields` list of fields that should not be copied over from original item this can contain e.g. `__Security` if you don't want the new version to have the same restrictions as the original version. + +On top of the ignored fields in the `-IgnoredFields` the following fields are ignored as configured within the `Spe.config` file: + +```markup + + + + + + __Archive date + __Archive Version date + __Lock + __Owner + __Page Level Test Set Definition + __Reminder date + __Reminder recipients + __Reminder text + + + + + +``` + +### References + +* [Issue 184](https://github.com/SitecorePowerShell/Console/issues/184) +* [Remove All Content items in French](https://stackoverflow.com/questions/29928540/powershell-script-to-remove-all-content-items-for-french-version-in-sitecore) + diff --git a/working-with-items/item-renderings.md b/working-with-items/item-renderings.md new file mode 100644 index 00000000..5023d8c9 --- /dev/null +++ b/working-with-items/item-renderings.md @@ -0,0 +1,140 @@ +# Item Renderings + +In this section we'll show how to manage item renderings. + +### List renderings + +**Example:** The following demonstrates the use of `Get-LayoutDevice` and `Get-Rendering` to find all renderings on a page associated with the FinalLayout. + +```powershell +$defaultLayout = Get-LayoutDevice -Default +$rootItem = Get-Item -Path "master:" -ID "{961563FC-3445-4558-BF3A-06DF06BA6298}" +Get-Rendering -Item $rootItem -Device $defaultLayout -FinalLayout +``` + +### Update rendering parameters + +**Example:** The following demonstrates the use of `Get-Rendering` and `Set-Rendering` for updating values on templates. + +```powershell +$rendering = Get-Item -Path "master:\sitecore\layout\Sublayouts\Sample Sublayout" + +$items = Get-ChildItem -Path "master:\sitecore\templates\Sample Item" -Recurse +foreach($item in $items) { + $renderingInstance = Get-Rendering -Item $_ -Rendering $rendering + if ($renderingInstance) { + Set-Rendering -Item $_ -Instance $renderingInstance -Parameter @{ + "Lorem" = "Ipsum" + } + Write-Host "Updated $($_.Paths.FullPath)" + } +} +``` + +### Find pages using rendering + +**Example:** The following demonstrates how to report on pages referencing the specified rendering. + +```powershell +Get-Item "master:\layout\Renderings\Feature\Experience Accelerator\Page Content\Page Content" | + Get-ItemReferrer | Where-Object { $_.ContentPath.StartsWith("/Demo/usa/Home") } | Show-ListView +``` + +### Find renderings marked cacheable + +**Example:** The following demonstrates how to report on which renderings are globally set to "Cacheable". + +```powershell +Get-ChildItem -Path "master:\layout\Renderings" -Recurse | + Where-Object { $_.Cacheable -eq "1" } | + Select-Object -Property Name, Cacheable, ClearOnIndexUpdate, VaryBy* | + Sort-Object -Property Name | Show-ListView +``` + +### Find renderings with personalization + +**Example:** The following demonstrates how to find renderings with a conditions node set on the item. + +```powershell +$query = "fast:/sitecore/content//*[@__renderings='% $($mapping[1])" + } + } + } +} +``` + +### Remove datasource from rendering + +**Example:** The following removes a datasource from a rendering on the FinalLayout. + +```powershell +Get-Rendering -Item $item -PlaceHolder "main" | + Foreach-Object { Set-Rendering -Item $item -Instance $_ -DataSource $null -FinalLayout } +``` + +### Replace compatible rendering + +```powershell +$rendering = Get-Item master:\layout\path\to\your\rendering +$renderingPageContainer = Get-Rendering -Item $item "{F39BAC93-1EEC-446B-A4A1-AB7F7C1B6267}" -Device $defaultLayout +$renderingPageContainer.ItemID = $rendering.ID +Set-Rendering -Item $item -Instance $renderingPageContainer +``` + +### Further Reading + +* [Parse raw layout xml and count components](https://sitecore.stackexchange.com/questions/4952/get-amount-of-components-on-final-layout-programmatically) + + + diff --git a/working-with-items/providers.md b/working-with-items/providers.md new file mode 100644 index 00000000..a8a81689 --- /dev/null +++ b/working-with-items/providers.md @@ -0,0 +1,20 @@ +# Providers + +You can interact with the providers typically available in the standard Windows PowerShell Console. Below are some of the important providers. Run the command `Get-PSProvider` to see the complete list. + +* **FileSystem** - Supports interacting with files and folders. +* **CmsItemProvider** - Supports interacting with the Sitecore content items. + +The console prompt typically begins with `PS master:\>`. The present working directory is using the _CmsItemProvider_ and set to the _master_ database. + +**Example:** Change directories between providers. + +```powershell + 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](https://github.com/SitecorePowerShell/Console/issues/314). + diff --git a/working-with-items/variables.md b/working-with-items/variables.md new file mode 100644 index 00000000..2bb68b05 --- /dev/null +++ b/working-with-items/variables.md @@ -0,0 +1,29 @@ +# Variables + +There are several variables available out of the box for use in running commands and scripts. Many of the variables prefixed with _Sitecore_ derive from the Sitecore.config settings. Run the command `Get-Variable` to see the complete list available in the currently running session. + +| **Variable** | **Example** | +| :--- | :--- | +| AppPath | C:\Inetpub\wwwroot\Console\Website\ | +| HostSettings | ... FontSize : 12 FontFamily : Wingdings ... | +| me | sitecore\admin | +| PWD | master:\ | +| PSScript | `$PSScript.Appearance.Icon # Returns the icon of the executing script` | +| ScriptSession | ... ID : e9fedd64-cad0-4c43-b950-9cd361b151fd ... | +| SitecoreAuthority | [https://console](https://console) | +| SitecoreContextItem | `$SitecoreContextItem.Language.Name # Returns the language name` | +| 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 | +| SitecoreScriptRoot | master:\system\Modules\PowerShell\Script Library\Task Management\Toolbox | +| SitecoreCommandPath | master:\system\Modules\PowerShell\Script Library\Task Management\Toolbox\Task Manager | +| SitecoreSerializationFolder | C:\Inetpub\wwwroot\Console\Data\serialization | +| SitecoreTempFolder | C:\Inetpub\wwwroot\Console\Website\temp | +| SitecoreVersion | 8.2.160729 | + +**Note:** Any new variables created are stored within the current session; when the session ends the variables are removed. Be careful not to overwrite the built-in variables. +