Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [powershell-extensions]

Anything related to the Sitecore PowerShell Extensions (SPE) module or general Windows PowerShell.

37
votes
5answers
1k views

How can I programmatically add a rendering to all of my content items?

I need to add a rendering to all of the pages in my Sitecore tree (i.e., items that have renderings, have a layout set, and live under /sitecore/Content). Content items that don't have renderings or a ...
13
votes
3answers
1k views

Sitecore Powershell query for big images of a certain size

Can someone help me with the Sitecore Powershell query which I can use for finding the images more than the given size.
11
votes
2answers
321 views

Can you run Sitecore Powershell without triggering Sitecore events?

I want to write a script which could potentially clean up a load of unused assets, but I would like it not to trigger events (index rebuilds etc). Is there a way to say "do this silently" in a ...
10
votes
1answer
510 views

Update all users in the Administrator Role

I want to be able to update all users who have the Administrator checkbox selected without manually going through each of the user. In the same script I would like to add them to another Role. This ...
10
votes
2answers
878 views

Updating Workflow for all the Items in Sitecore Instance

I would like to update a workflow (any Standard Field) for all existing items. new items. What is the best way to do this? Can I use Sitecore Rocks or Sitecore Powershell Extensions? Any other ...
9
votes
2answers
1k views

Create new language version for content branch

Is there a way in Sitecore Powershell Extensions to create new language versions of a branch in the content tree? I need it to copy exactly the presentation details set on the current language to the ...
9
votes
3answers
313 views

Where should I install Powershell module for SXA?

Solution can be installed on many environments - QA, Staging, Prod. In every of these environments Sitecore instances have different roles - CD, CM, Job, Publishing and etc. Should I install ...
9
votes
2answers
637 views

How to pass arguments to SPE's Invoke-RemoteScript

I want to pass some arguments to a script block that will be run on a remote Sitecore instance via SPE remoting. I wrote this script as a test, but it's not working. $session = New-ScriptSession -...
8
votes
1answer
485 views

Update same rendering of several templates using SPE

I have a bunch of templates which have a Coveo Search Box View rendering associated on the standard values. I need to update the property "Reveal Advanced Query Suggestions" of all of them(a lot of ...
8
votes
1answer
428 views

Sitecore Powershell Extensions - Reports Authorization

I've created some PSE scripts to give our client some reports on their content. I created them under the proper convention of Script Module and Script Library so that the reports show up under ...
8
votes
1answer
152 views

Upgrade path from Integrated Dynamic Placeholders to Sitecore 9 Dynamic Placeholders (OOTB)

Does anyone have a SPE script that could be used to upgrade the rendering parameters of existing content to the new dynamic placeholder style required for Sitecore 9 Dynamic placeholders? We used to ...
7
votes
3answers
1k views

How to get list of all the renderings that has been configured to use data source

We are almost complete with a large project. I am trying to find out which rendering in the page has been configured to use data source using a Powershell script. So that we can run in both UAT and ...
7
votes
2answers
612 views

How to create Sitecore Context Item to copy Item Path using SPE?

How to create Sitecore Context Item to copy Item Path using Sitecore PowerShell Extensions. Like in below screen we have for Layout Copy Renderings and Quick download package. Sometimes it requires ...
7
votes
2answers
551 views

Sitecore Powershell: Is it possible to prompt user for their password?

I'm creating a Context Menu script to allow deletion of languages on my content tree. When the user elects to run this script, I want to prompt them for their password as a confirmation mechanism, ...
7
votes
1answer
129 views

SPE How to add multiple items to package source

I'm writing a SPE script to package up all unused media library items under a specific folder (prior to deletion). I've found New-Package and New-ItemSource methods and know how to use them (to some ...
7
votes
2answers
341 views

How to copy an item to multiple locations

What is the easiest and quickest way to copy an item to various locations? I have about 100 multisites in a solution and I have created a new template. I need to create a new item inheriting this ...
7
votes
1answer
402 views

Updating parameters using SPE

I'm running a script in which I want to mark as checked all renderings of a specific template with the Vary By Data parameter. But running the script it is adding to the Additional Parameters the ...
6
votes
2answers
4k views

How to check an item exists with powershell without raising an error?

In Sitecore Powershell extensions I can use If ( Get-Item ...) to return true if an item exists or false if it doesn't, but if the item isn't found then it outputs an error message as well. Is ...
6
votes
2answers
416 views

How to hide ribbon in Sitecore

We have created a ribbon in Sitecore that have few command buttons and few PowersSell command buttons. We want them to be visible only when an author hits specific items in the Content Editor. So we ...
6
votes
2answers
366 views

PowerShell Extensions reports: Is it possible to pass / choose parameters?

I have created my first report, now I'd like to make it reusable. Is there any way I could read parameters from "somewhere" after the user clicks the report's name?
6
votes
2answers
161 views

Sitecore ISE powershell inconsistent results

I am running a script in Sitecore powershell to find items bases on a regular expression on a custom field ('Subkey'). This script sometimes shows results and sometimes shows 'No items available'. ...
6
votes
2answers
197 views

Getting locked items SPE

I have a multisite Sitecore instance and I would like to get all locked items from all different sites and users and unlock them, is it possible to do this job using Sitecore Powershell Extensions?
6
votes
1answer
161 views

Setting up automated role creation for various SXA sites

The challenge I am trying to solve is to create dynamic roles for an SXA site, knowing that my client will be creating multiple SXA sites over time, and thinking that possibly the best way to ...
6
votes
1answer
42 views

How to determine whether an editor is using the Desktop Content Editor or Launchpad Content Editor?

I've been doing a lot more SPE report implementations and noticed that the functionality of loading the ListView is dependent on whether the editor is using the Content Editor from Launchpad or the ...
6
votes
1answer
182 views

Exporting database-based media to the file system

There's a great article (Sitecore 8.2 - Convert disk media to database) on converting disk media to the database, but I'm trying to do the opposite, temporarily at least. I want to optimize images (...
5
votes
3answers
711 views

How to reset DisplayName to empty using Sitecore PowerShell Extensions?

I wanted to know better way to reset Display Name to empty using PowerShell scripts. I have written below script.. $item = Get-Item "/sitecore/content/home" $item.Editing.BeginEdit() $item["{...
5
votes
1answer
191 views

Getting “Current Sitecore database cannot be established” using Sitecore Powershell Extensions

I'm trying to get my feet wet in Sitecore Powershell. I need to list renderings on a list of items. Some of the script works, like getting the items and outputting the name, but when calling Get-...
5
votes
1answer
438 views

PowerShell ISE: Function of Abort button?

I have noticed that clicking the Abort button in the PowerShell ISE doesn't actually cause the background job to terminate. I guess I shouldn't be surprised since arbitrarily terminating a thread that ...
5
votes
1answer
163 views

How do you change the sort order of items using PowerShell

I have some items created using New-Item but they are automatically sorted alphabetically. I would much prefer these items to be sorted by Created date. How do you change the sort order of items ...
5
votes
1answer
539 views

Set Powershell script language

I would like to know if there's a way to set the current script's context language through code. I know there's a way to set it in the ISE but I need some code that could override it and force a ...
5
votes
1answer
184 views

What is the call depth limit in Sitecore PowerShell and can it be overridden?

I have a recursive script that hits a System.Management.Automation.ScriptCallDepthException exception. What is the call depth limit in Sitecore PowerShell and can it be overridden? Note: Yes, I can ...
5
votes
1answer
257 views

How to escape a query in Sitecore PowerShell

This PowerShell query breaks, if the item name contains query operators such as "and" or "child". How should I escape it, so that they don't break it? $SourceItemPath = $SourceItem.Paths.path $...
5
votes
2answers
563 views

Powershell Extensions - Concatenating Values in Show-ListView

I'm working on an instance that has a custom redirect engine built in. I've been tasked to write a report that can show the redirect items' Sitecore path with the "redirect from" and "redirect to" ...
5
votes
1answer
146 views

Can a Sitecore LaunchPad button be attached to a Sitecore Powershell script?

I am working on connecting a Sitecore LaunchPad button to a Sitecore Powershell script so I can use the script to perform the desired action. Any examples of how I should do that ?
5
votes
1answer
73 views

Are locally scoped objects in Sitecore Powershell released from memory when out of scope?

I'm writing some scripts that will process a large quantity of items and have naturally split out some parts of it to functions. Within these functions I'll get a Sitecore item in a local variable, do ...
5
votes
1answer
96 views

How to use multiple words in Quick filter box in Sitecore powershell Show-Listview

I am new for Sitecore Powershell, In the script I am using Show-Listview to display the result and it is providing option to Filter the result data. Powershell doc stating we can use multiple words in ...
5
votes
1answer
289 views

Unable to get value of $_.Source using SPE

I have a rich text field in my user defined template and I want to replace the source value of the rich text field. Below is my query where I'm able to read Name, type etc, however $_.source is ...
5
votes
1answer
75 views

Broken Links Report Options Powershell vs. Fast Query?

I am currently trying to find and delete broken links in the Sitecore master database. I am using a version of this script. The problem I am having is that the number of items in the content tree is ...
5
votes
1answer
120 views

8.1 stopped working after content node deletion. NullReferenceException, Powershell Pipeline Issue?

8.1 won't let us log back in. While attempting to delete a node with ~16k sub-items we couldn't tell whether 8.1 was frozen or still trying to delete. We restarted site/app pool & now can't log in....
5
votes
2answers
73 views

Getting and setting the order of renderings/sublayouts on a page

I have written a PowerShell script that replaces sublayouts with renderings across all pages in a Sitecore site. Everything is working well except for the order of the renderings. The order always ...
5
votes
0answers
122 views

CI/CD Sitecore challenge: going from “wipe” to “overwrite”

We are set to release a large Sitecore-based system in a week. Presently the CI/CD process works by effectively republishing everything from a git repository as the source (we use TDS for day-to-day ...
4
votes
3answers
608 views

Update fields using Sitecore Powershell Extensions

I'm using the following script to update a specific field in all the children of the item right-clicked in my content tree. It works but the update is not applied to the item clicked with my context ...
4
votes
3answers
512 views

How to Enable Item-level language fallback on all templates in Sitecore 8.x

Presently I'm working on Sitecore 8.1 Update-1. We have enabled Item-level language fallback on shell and website as suggested on Configure language fallback - Sitecore Documentation. It seems after ...
4
votes
3answers
297 views

Script to identify largest gap(s) in content entry over a period of time

One of our clients has reported an issue wherein after our most recent deployment some of their content appears to have gone missing and/or been reverted. I'm not looking for a way to find out the ...
4
votes
2answers
540 views

Create Sitecore Link with Powershell

I'm working on some reports using Sitecore Powershell Extensions. One requirement is to provide the public URL for various Sitecore items. I'm thinking this isn't really possible via Link Manager ...
4
votes
1answer
491 views

Compare item versions with powershell

I'm looking for an option to compare programatically using SPE all the fields of an item that have changed from the latest version x the version prior to that and highlight what changed. Have anyone ...
4
votes
1answer
325 views

How do you programmatically run a Sitecore agent using Sitecore PowerShell Extensions?

I need to run specific agents on demand. When I try to create a new instance of the agent using PowerShell's New-Object command it doesn't seem to work right.
4
votes
3answers
80 views

How to disable Publishing Temporarily?

During certain periods we have the requirement to disable publishing for a period of time. The current approach for this is pretty brute-force. Delete the Publishing Targets and then restore them from ...
4
votes
2answers
212 views

Powershell command to get lower directory

I currently have a script that puts a file in a directory the website but would rather create it in the Data directory. The powershell script has the below: $FilePath = $AppPath + "Temp_files\...
4
votes
1answer
442 views

Sitecore LinkManager in PowerShell generate wrong protocol

I have next powershell code for getting page url by item function Get-ItemUrl($item){ $urlOptions = [Sitecore.Links.LinkManager]::GetDefaultUrlOptions() $urlOptions.AlwaysIncludeServerUrl = $...