Contact Us

PowerShell increases productivity and lowers turnaround time. Developers can roll out Sitecore solutions with minimal complications while executing codes over the Sitecore PowerShell. You can easily access Sitecore PowerShell (ISE) over the interface in the development tools section.

To give a transparent idea, the module provides you with a scripting environment and command line to automate the tasks. Besides, to get the commands to run and scripts to execute, you should track the standard syntax of Windows PowerShell.

Say, you have to create item versions of certain items in other languages with a pre-existing version in English. Sitecore PowerShell can help with the creation of versions of items quickly without lengthy procedures. Below is the script that can be helpful for similar scenarios you may encounter.

Script Used:

$pathtowork = "/sitecore/content/OneWeb/OneWeb/Creaform3d/Data/OneWeb Tags/Taxonomy/Copy of Applications"

$childItems = Get-ChildItem -Path $pathtowork -recurse -Language "en"

$childItems | ForEach-Object {

Add-ItemLanguage $_ -Language "en" -TargetLanguage "ja" -IfExist OverwriteLatest -IgnoredFields ""

}

$pathtowork: This variable fetches the item/ folder path to work with.

$childItems: In this variable, you can get the child items for the path mentioned above.

The same “$childItems” variable in a for loop where “Add-ItemLanguage” will create a version of that item in Japanese, which has been mentioned as the “TargetLanguage”.

Target Language can be updated based on the user’s requirement. For example, it can be “fr”, “ko” or “pt”, but one thing that should be kept in mind here would be correctly specifying the region code of the language for which you need to add the item version.

You can find the language code for the particular language in the Sitecore content tree itself on the path mentioned below:

Path: /Sitecore/System/Languages

In Sum

Sitecore PowerShell is a valuable and convenient tool for executing commands or scripts over Sitecore. However, there is never a single way of approaching problem-solving. Our team constantly looks for newer ways to solve such scenarios. Get in touch with us for more such queries or concerns you may have.

Need Help?