Posts

Showing posts with the label PowerShell

Eliminating Manual Publishing: Auto-Publish Your Sitecore Project on Docker Up

Image
Hello Everyone. In this blog, we will see one of the pain point while working locally with Docker and Sitecore AI. Developers often experience slowdowns in local environments due to the need for manual publishing. This becomes even more frequent given how Docker setups can sometimes become unstable or require restarting (docker down) because of various unpredictable issues. When running your project locally using Docker (docker up), you typically: Start containers Wait for CM to be ready Manually trigger publishing This becomes repetitive, time-consuming, and error-prone. In this blog, we’ll explore how to eliminate manual publishing by enabling auto-publish during Docker startup, along with a real-world use case. Now let's see, how we can implement the same. Step 1: Update your project csproject file with this below entry. The RuntimeIdentifier = win element in a .csproj file tells .NET which operating system/runtime your application is targeting. <R...

Modernizing Sitecore Pages: Script-Based Removal of Default Components After Page Design Adoption

Hello everyone, In this blog I will share one most important powershell script that I personally extensively used while working on XMC migration project. Our migration project was from XP to XM Cloud which had whole UI redesign but Sitecore CMS structure remain same. Intially, while migration we followed the traditional Sitecore approach to add the renderings to standard value of the template as they were added in legacy. But when most of the component was developed, we though of utilizing the Page Design and Partial Design feature of SXA. The most commong thing which can go to page design and partial design was header, footer, breadcrumb etc which was common for all pages. Now the major problem here was, in legacy, Header and Footer for example was added manually to page level items. So we faced duplication issue as the components are coming from page design as well as standard values. To overcome this issue, the best solution was to remove the components from standard values of te...

Automating Tag Update in Sitecore XM Cloud with PowerShell - A Use Case

Managing tags across different environments in a Sitecore setup can be a challenging task, especially when dealing with a large number of items and multiple folders. Automating the synchronization or updating of these tags can save time and reduce errors. In this blog post, we'll explore a practical use case of using Sitecore PowerShell Extensions (SPE) to automate the synchronization of tags between shared and global environments in a Sitecore instance Use Case Imagine you are managing a global website for a large corporation, such as ABC company. Your content is distributed across various regional sites, and each region uses a different set of tags stored in different folders.The respective page content are tagged with site specific tags. However, for consistency,The business ask you to ensure that tags from the shared environment should be used from now on. But there is catch while you make the changes. You need to make sure that all existing website content pages should be ta...

PowerShell Script For Creating Roles and Permission Part 2

Hello everyone, this is continuation of blog where we have seen how to create appropriate roles to manage content authoring more effectively. You can refer the part 1 of blog here Now our focus will be on assigning the permissions to the roles which was created on previous blog. Let's see the script that is required to update the permission. $siteLanguages = @("en-IN") $siteName = "IN" $siteType = "External" $Organization = "ABC" $region = "Asia" $rolePrefix = "$Organization $siteType $siteName" $siteAccessRole = "$rolePrefix Access" $siteAdminRole = "$rolePrefix Site Admin" $contentAdminRole = "$rolePrefix Content Admin" $contentContributorRole = "$rolePrefix Content Contributor" $contentPublisherRole = "$rolePrefix Content Publisher" $contentPreviewerRole = "$rolePrefix Content Previewer" #Content $regionPath = "/sitecore/content/$Organization...

PowerShell Script For Creating Roles and Permission Part 1

Hello everyone, As we all know managing user roles and permissions effectively is crucial for maintaining security and ensuring appropriate access within any organization. In this blog post, we'll delve into the user roles and permissions hierarchy at ABC company. We'll explore the different roles, their specific permissions, and how these roles interrelate to form a cohesive and secure system especially when we have multiple website with multisite setup. We will see, how we can implement this using PowerShell. Lets consider, we have a company called ABC which is having corpate website followed by Country level site. The company have below roles. The hierarchy of the Site is ABC(Tenant) --> External(Site Collection) --> IN(Site) ABC Limiter ABC Author ABC External IN Access ABC External IN Content Previewer ABC External IN Content Contributor ABC External IN Content Publisher ABC External IN Content Admin ABC External IN Site Admin Each role...

Creating Custom Interactive Dialog to execute Sitecore PowerShell Script

Image
Hello everyone, we will try to learn how we can create a interactive dialog in Sitecore to execute powershell script. In this article we will see how we can convert a view rendering or controller rendering to JSON rendering via powershell interactive dialog. We will also check that how we will be adding the button to Ribbon in Sitecore. We will divide the blog into 3 section. Creating a Execute Button in Ribbon PowerShell Script to create interactive Dialog Demo of Script Step 1: Navigate to Script Library under PowerShell under Modules. Path : /sitecore/system/Modules/PowerShell/Script Library. Step 2: Right click Script Library --> Insert --> PowerShell Script Module --> Give A Name(CustomPowershell2) --> Ok Step 3: Right Powershell Script Module which is created --> Insert --> PowerShell Script Library --> Give A Name(Content Editor) --> Ok Step 4: Now create the content tree structure which...