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.

1
vote
1answer
165 views

Export of of script results to Excel not working

When I get a ListView with script results, and want to export the results to Excel etc., nothing happens when I click on the buttons. I do however get an error in the developer tools console: ...
1
vote
1answer
56 views

How do I calculate the maximum Index to use with Add-Rendering in a Sitecore PowerShell script?

I have a Sitecore PowerShell script and I am using it to insert a rendering at a particular position on the page. To do this, I am using the [-Index <Int32>] parameter on the Add-Rendering ...
2
votes
0answers
240 views

SPE Remove-Rendering with -FinalLayout Removing all renderings from the Final Layout

I recently wrote my first Powershell script for removing an old rendering from a placeholder and replacing it with a new rendering. For some reason, when the rendering I need to remove is in the ...
5
votes
1answer
181 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 $...
3
votes
1answer
271 views

How do you add html link to PowerShell Report in each row?

I'm trying to add an html link to each row containing a reference to an arbitrary item. Essentially I want to load a custom item, but it not be the same item as the record. I tested with both scForm....
3
votes
1answer
178 views

Replace or Update Base Template of a Template

I am trying to remove a base template if found and add a different base template if not found. In the code below the standard template is never found even though I know its there. Is it because I'm ...
3
votes
1answer
149 views

Archive Sitecore items using Sitecore PowerShell Extention

I need to archive Sitecore items using Sitecore PowerShell. Any commnand that can be used to achieve this.?
1
vote
0answers
157 views

Use custom Mongo db with Powershell

I have a custom mongo database, that database contains information about pages.I need to query it in order to use SEP to create pages according to that info, ig, adding renderings component, etc. ...
4
votes
1answer
554 views

Display item.Paths.FullPath with Show-ListView command

I have the following script to output to a table certain fields of a selection of items Get-Item -Path "master:" -Query "fast:/sitecore/content/Home//*[@@templateid='{BAC0709D-5606-4A86-AF67-...
3
votes
1answer
338 views

What is the Powershell syntax for adding and removing items from a TreelistEx field?

I want to edit some Placeholder settings with Powershell extensions, which involves adding a specific rendering to some and removing another rendering from others. Is there a simple syntax based on ...
2
votes
3answers
115 views

Data re-writing from Sitecore 7.2 with SPE

So I need to re-create some content from Sitecore 7.2 to a new Sitecore 8 instance. What we had in mind is to create a script using PowerShell in the new Sitecore 8 instance to fetch the needed data ...
1
vote
1answer
349 views

Bulk create Media Items

Is it possible to bulk create media items from an array of System.IO.FileInfo without needing to install the remote powershell extension package to use the Upload-SitecoreFile command? Notes - The ...
3
votes
2answers
465 views

How to get the current language in a Sitecore Powershell editor (context menu) script?

How can I find which language the editor is currently working in when running a script from the context menu? Get-Item . Returns the item, but in the context language that the script session is in.
4
votes
1answer
741 views

Sitecore powershell - Get the count of media folders and media items for each of the medial folders inside media library

I need to get the count of all the media items and folders inside any media folder in media library. Then export the data to csv I am planning to write a script using SPE. Please help me on the same ...
3
votes
2answers
796 views

Deleting an Item with a null Template

Thru a series of unfortunate events (most likely missing a template in a package between servers/instances) I found myself having issues inserting links thru the General Link field. Tracked it down ...
7
votes
2answers
339 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 ...
3
votes
1answer
241 views

How to enable non-admin user to use powershell extensions?

I want to enable a specific non admin user to use PowerShell extensions without giving them admin privileges. So far, according to the PowerShell ISE Security Documentation, I have given all the ...
1
vote
2answers
257 views

Update text in a field on user profile

We are on Sitecore 8.1.3 and have a user profile where personal links are stored as a path unfortunately and when the page gets move (not too often) the personal link is broken. For now we would ...
3
votes
0answers
122 views

How to bulk upload media files and set each item's template to custom template?

I have a directory structure that looks like this: -- Folder 1 ---- Folder 2 ------- File 1 ---- Folder 3 ------- File 1 And so on with Folder 1 being the parent folder. When I upload the files from ...
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
1answer
83 views

What does the RepublishAll switch do in the SPE Publish-Item command?

I suppose one should take the name of the switch at "face value", but it's difficult when there's already a PublishMode parameter which defines how the command is intended to work. So, I guess more ...
3
votes
2answers
282 views

Sitecore powershell context menu unavailable for content editors

Issue Description The entire Sitecore Powershell context menu is not visible for any content editor. I've tried creating a user and adding every role (except for ones like limited content editor etc)....
6
votes
2answers
415 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 ...
3
votes
1answer
263 views

Item.Editing.EndEdit() is not triggering save event when called from Powershell extension

We have written one rule for bucket items and it gets triggered when an bucket item is created or item is saved. for creating an bucket item we use below code $updatedItem=New-Item -Path "$parentPath"...
3
votes
0answers
105 views

New item is not in focused after creation using powershell

When we create item in a Sitecore bucket folder using PowerShell Extensions like shown below: New-Item -Path "$PathofBucketFolder" -Name $TitleofanItem -ItemType $TemplateofanItem Item gets created ...
2
votes
1answer
78 views

Multilist with Search not working with Powershell script

When we use "Multilist with Search" as editor option using powershell extension, it shows multilist without any search. It seems the multilist with search is not enabled. I used below line of code in ...
4
votes
2answers
208 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\...
0
votes
0answers
112 views

Adding placeholder settings to presentation details of many items

I have to add a bunch of placeholder settings to a bunch of items. These items already have specific presentation details, so not using the standard values. I tried to add them to standard values, ...
3
votes
1answer
139 views

Unable to access child files using physical path [closed]

I have an issue with access child files using Sitecore Powershell script I have created powershell script under /sitecore/system/Modules/PowerShell/Script Library/Tasks to copy files from a ...
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 ...
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 ...
3
votes
1answer
416 views

Can I update links retrieved with Get-ItemReference in powershell?

I'm building some scripts that will check that items are localized to a particular branch of the content tree (we have lots of parallel tree structures and we want to copy between them) and can ...
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 ...
0
votes
1answer
294 views

Sitecore Powershell script to find items that break inheritance

I need to write a Powershell script to find items that refer to a specific composite component and break inheritance for presentation. If I go to the Navigation Tab in the Content Editor and click ...
1
vote
2answers
496 views

Replacing Text in strings from SPE Invoke-RemoteScript Return adds many spaces

I am getting an item from Sitecore, then taking the return and messing with the FullName to build the URL. Import-Module -Name SPE $Id = [Some Id] $session = New-ScriptSession -...
1
vote
1answer
279 views

Using Sitecore PowerShell Extensions to Copy Layout Details from One Device to Another

My website is using the App Center Placeholder device on all of the pages. I would like to use Sitecore PowerShell Extensions (SPE) to deprecate the App Center Placeholder device and move all the ...
6
votes
1answer
160 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 ...
3
votes
2answers
906 views

Timeout while running remote script using SPE Remoting

I am running the following script using SPE Remoting (trying to find all images on all sitecore sites, but this doesn't matter as it is off subject for this post): Import-Module -Name SPE $session = ...
1
vote
2answers
629 views

Having trouble remoting into Sitecore with Powershell

I’m trying to hit the Sitecore Webservices with the following Script: The following function comes from Sitecore/system/Modules/PowerShell/Script Library/Platform/Functions/Remoting function Set-...
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 (...
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.
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
1answer
439 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 = $...
3
votes
1answer
259 views

How to display dialog before call powershell script?

I need to have a dialog box with 2 dates at sitecore 8.2 admin page, and call sitecore powershell script with parameters that came from dialog box ? what is the best way to do it ? it seems like SPEAK ...
10
votes
2answers
873 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 ...
2
votes
2answers
126 views

Sitecore Powershell - Getting Error “ProviderPath is already present”

In Sitecore Powershell while running simple command like get-item or get-childitem i am getting following error. Get-Item : The member "ProviderPath" is already present from the extended type data ...
4
votes
1answer
233 views

Sitecore Powershell Workflow Actions Not Executing

I have been working to get a Powershell script to execute through a workflow action in Sitecore and I'm running into an issue. Previously I was able to insert a new Powershell action from the provided ...
2
votes
1answer
323 views

Sitecore Powershell Get-Rendering doesn't find any renderings from Context Menu, but works in ISE

I have a script that copies a page with renderings from a set language to 1 or more other languages that are selected by checkboxes. The whole script works when i run it in the ISE, but when I run it ...
7
votes
1answer
401 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 ...