<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sitecore Xperiences &#187; SPE</title>
	<atom:link href="https://blog.peplau.com.br/category/spe/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.peplau.com.br</link>
	<description>The things I&#039;ve seen as a Sitecore Professional</description>
	<lastBuildDate>Sun, 09 Mar 2025 21:54:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.41</generator>
	<item>
		<title> Know your Media Library disk usage with a simple PowerShell script</title>
		<link>https://blog.peplau.com.br/know-your-media-library-disk-usage-with-a-simple-powershell-script/</link>
		<comments>https://blog.peplau.com.br/know-your-media-library-disk-usage-with-a-simple-powershell-script/#comments</comments>
		<pubDate>Fri, 10 Jan 2025 21:14:52 +0000</pubDate>
		<dc:creator><![CDATA[Rodrigo Peplau]]></dc:creator>
				<category><![CDATA[Content Hub]]></category>
		<category><![CDATA[SPE]]></category>
		<category><![CDATA[SPE-only Alliance]]></category>

		<guid isPermaLink="false">http://blog.peplau.com.br/?p=1058</guid>
		<description><![CDATA[<div class="lr_horizontal_share" data-share-url="https://blog.peplau.com.br/know-your-media-library-disk-usage-with-a-simple-powershell-script/"></div>Happy Friday, Sitecore Community! As we head into the weekend, I thought I’d share a handy PowerShell script I recently put together that helped me with a Content Hub license cost analysis. If you’re working on a similar project or want to understand how much disk space your Sitecore Media Library uses, this one’s for [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Happy Friday, Sitecore Community! As we head into the weekend, I thought I’d share a handy PowerShell script I recently put together that helped me with a <strong>Content Hub license cost analysis</strong>. If you’re working on a similar project or want to understand how much disk space your Sitecore Media Library uses, this one’s for you!</p>
<p>I needed to calculate the total storage space used across multiple asset sources during my analysis. One of the most critical sources was the <strong>Sitecore Media Library</strong>, and after some googling, I quickly realized there wasn’t an easy way to calculate the total size directly from the CM server, without involving SQL queries or manual summations from reports. So, I built a simple and effective <strong>Sitecore PowerShell Extensions (SPE)</strong> script that gives you the <strong>total Media Library size in MB</strong> directly from the CM interface. No database access required!</p>
<div id="attachment_1061" style="width: 310px" class="wp-caption aligncenter"><a href="http://blog.peplau.com.br/wp-content/uploads/DALL·E-2025-01-10-17.49.49-A-minimalist-logo-design-for-the-SPE-only-alliance-Sitecore-Powershell-Extensions-featuring-a-powerful-symbol-of-a-lightning-bolt-combined-with-a-sh.png"><img class="size-medium wp-image-1061" src="http://blog.peplau.com.br/wp-content/uploads/DALL·E-2025-01-10-17.49.49-A-minimalist-logo-design-for-the-SPE-only-alliance-Sitecore-Powershell-Extensions-featuring-a-powerful-symbol-of-a-lightning-bolt-combined-with-a-sh-300x300.png" alt="SPE-only Alliance" width="300" height="300" /></a><p class="wp-caption-text">Another goal was scored by the <span style="text-decoration: underline;"><strong>SPE-only Alliance</strong></span>!</p></div>
<h2><strong>The Script</strong></h2>
<p>Here’s the full PowerShell script that can be run in <strong>Sitecore PowerShell ISE</strong>:</p>
<hr />
<p><script src="https://gist.github.com/peplau/166c204ad243b8ac8e76cc1b856617a0.js"></script></p>
<hr />
<h3>Output Example:</h3>
<blockquote><p><span class="hljs-attr">Total Media Library Size:</span> <span class="hljs-number">1473.92 </span><span class="hljs-string">MB</span></p></blockquote>
<p>I hope this little script helps you start the weekend with one less thing on your to-do list! If you give this script a try, please let me know how it worked for you.</p>
<p>And if you have improvements or tweaks, feel free to share them — <strong>after all, that’s what makes the Sitecore community so awesome!</strong></p>
]]></content:encoded>
			<wfw:commentRss>https://blog.peplau.com.br/know-your-media-library-disk-usage-with-a-simple-powershell-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Meet the (Brand new) Advanced Powershell Packaging Features</title>
		<link>https://blog.peplau.com.br/meet-the-brand-new-advanced-powershell-packaging-features/</link>
		<comments>https://blog.peplau.com.br/meet-the-brand-new-advanced-powershell-packaging-features/#comments</comments>
		<pubDate>Thu, 06 Jul 2023 17:26:45 +0000</pubDate>
		<dc:creator><![CDATA[Rodrigo Peplau]]></dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[SPE]]></category>

		<guid isPermaLink="false">http://blog.peplau.com.br/?p=963</guid>
		<description><![CDATA[<div class="lr_horizontal_share" data-share-url="https://blog.peplau.com.br/meet-the-brand-new-advanced-powershell-packaging-features/"></div>TL; DR Sitecore Powershell Extensions (SPE) 7.0 introduces advanced packaging features, but you can also enjoy them in past SPE versions by using our package or Gist. You can now selectively include linked items in packages, avoiding the classic all-or-nothing approach. Learn how the features work and how to use them. &#160; Introduction Get ready [&#8230;]]]></description>
				<content:encoded><![CDATA[<h2>TL; DR</h2>
<ul>
<li>Sitecore Powershell Extensions (SPE) 7.0 introduces advanced packaging features, but you can also enjoy them in past SPE versions <a href="#download-package">by using our package or Gist</a>.</li>
<li>You can now selectively include linked items in packages, avoiding the classic all-or-nothing approach.</li>
<li>Learn how the features work and how to use them.</li>
</ul>
<p>&nbsp;</p>
<h2>Introduction</h2>
<p>Get ready for an exciting update, folks! Sitecore PowerShell Extensions (SPE) 7.0 is rolling out by the end of this year with some seriously cool new features in the packaging department. And guess what? I had the privilege of implementing these features, which were received very positively by the SPE team (shoutout to the amazing <a href="https://www.linkedin.com/in/michaellwest/" target="_blank">Michael West</a> for his support!)</p>
<p>&nbsp;</p>
<h2 id="download-package">Also available for older versions of SPE</h2>
<p>But fear not, even if you&#8217;re using a lower version of SPE, you can still reap the benefits by installing the necessary scripts using the following package: <a href="https://gist.github.com/peplau/6fc0f839330e90e65b987d32b26b2ea4#file-advanced-packaging-features-1-0-zip" target="_blank">Advanced-Packaging-Features-1-0-zip</a>. Or manually creating the 5 scripts at their respective paths <a href="https://gist.github.com/peplau/6fc0f839330e90e65b987d32b26b2ea4" target="_blank">according to this Gist</a>.</p>
<p>Let&#8217;s dive into what these advanced packaging features are all about and how to make the most of them!</p>
<p>&nbsp;</p>
<h2>Rebuild your Link Database</h2>
<p>First things first: the new features depend on the Link Database, so you will have to keep it up-to-date. If you are unsure, remember to give your Link Database a good rebuild for the &#8220;master&#8221; database, at least once before utilizing these features.</p>
<p>&nbsp;</p>
<h2>Unlocking Selective Packaging Superpowers</h2>
<p>Currently, the SPE UI allows you to include linked items in your package, but it is an all-or-nothing deal. If you want to include media items linked to your selected item, you had no choice but to include all of them.</p>
<p>This is how the classic interface works, based on checkboxes:</p>
<p><a href="http://blog.peplau.com.br/wp-content/uploads/01-Classic-Window.png"><img class="alignnone size-full wp-image-967" src="http://blog.peplau.com.br/wp-content/uploads/01-Classic-Window.png" alt="01 - Classic Window" width="471" height="348" /></a></p>
<p>Well, hold on to your keyboards because the new advanced packaging features now empower you to cherry-pick and selectively include linked items to your package.</p>
<p>The new UI will now show a different set of radio box configurations:</p>
<p><a href="http://blog.peplau.com.br/wp-content/uploads/02-New-Window.png"><img class="alignnone size-full wp-image-968" src="http://blog.peplau.com.br/wp-content/uploads/02-New-Window.png" alt="02 - New Window" width="491" height="285" /></a></p>
<ol>
<li><strong>Do not include linked items:</strong> Linked items are not included in the package.</li>
<li><strong>Include parent links only:</strong> Only items linked to the selected item (parent) will be considered for inclusion.</li>
<li><strong>Include all linked items:</strong> All linked items (parent and children) will be considered for inclusion.</li>
</ol>
<p>&nbsp;</p>
<p>If you select either 2 or 3, a new screen will show, allowing you to cherry-pick the linked items you want to include in the package.</p>
<p><a href="http://blog.peplau.com.br/wp-content/uploads/03-New-Select-Linked-Items-window.png"><img class="alignnone size-full wp-image-969" src="http://blog.peplau.com.br/wp-content/uploads/03-New-Select-Linked-Items-window.png" alt="03 - New Select Linked Items window" width="635" height="333" /></a></p>
<p>As you can see, there are tabs for each kind of linked items (Content, Media, Layouts, System, Templates), making the selection process much easier.</p>
<p>&nbsp;</p>
<h2>Using the New Features</h2>
<p>To access these supercharged packaging powers, simply right-click on any item in the Content Editor and navigate to Scripts &gt; Packaging.</p>
<p><a href="http://blog.peplau.com.br/wp-content/uploads/04-Classic-packaging-tools.png"><img class="alignnone size-full wp-image-970" src="http://blog.peplau.com.br/wp-content/uploads/04-Classic-packaging-tools.png" alt="04 - Classic packaging tools" width="617" height="278" /></a></p>
<ul>
<li><strong>Important:</strong> Starting from SPE 7.0 the original features were substituted with the new ones, so you will see the list as above. However, if you’re using the new features in older SPE versions through my package or Gist, then you’ll notice I’ve added the new features to scripts sufixed with “Advanced”, as can be seen below:</li>
</ul>
<p><a href="http://blog.peplau.com.br/wp-content/uploads/05-New-packaging-tools.png"><img class="alignnone size-full wp-image-971" src="http://blog.peplau.com.br/wp-content/uploads/05-New-packaging-tools.png" alt="05 - New packaging tools" width="302" height="276" /></a></p>
<p>Let&#8217;s take a closer look at the options available to fight the packaging confusion crimes, powered by Sitecore PowerShell Extensions:</p>
<p><a href="http://blog.peplau.com.br/wp-content/uploads/06-SPE-Super-hero.jpg"><img class="alignnone size-full wp-image-972" src="http://blog.peplau.com.br/wp-content/uploads/06-SPE-Super-hero.jpg" alt="06 - SPE Super hero" width="270" height="366" /></a></p>
<p>&nbsp;</p>
<h3>Quick Download Tree as a Package (Advanced)</h3>
<p>This option allows you to download as a package the selected item, along with the additional items you choose to include in the package. You can add child items, and selectively pick those linked items that deserve a spot in your package.</p>
<p>&nbsp;</p>
<h3>Start New Package (Advanced)</h3>
<p>Choosing this option initiates the creation of a new package without immediately downloading it. Don&#8217;t worry, though – you&#8217;ll have the option to download it later. Once you&#8217;ve made this selection, a host of further options becomes available:</p>
<ol>
<li><strong>Add Item to Package (Advanced):</strong> This handy feature lets you add the selected item, along with any linked items you desire, to your package.</li>
<li><strong>Add Tree to Package (Advanced):</strong> Selecting this option adds the selected item, all its children, and the linked items you choose to your package.</li>
<li><strong>Preview Package Items (Advanced):</strong> Curious about the contents of your package before sealing the deal? This option lists all the items currently added to your package, allowing you to ensure you&#8217;ve got items you envisioned.</li>
<li><strong>Download Package (Advanced):</strong> Finally, when you&#8217;re ready to unleash your package upon the world, hit &#8220;Download Package&#8221;. Your meticulously crafted package, complete with its formidable lineup of items, will be ready for action!</li>
</ol>
<p>&nbsp;</p>
<h2>Conclusion</h2>
<p>With Sitecore Powershell Extensions 7.0&#8217;s advanced packaging features, you now have the power to curate packages like never before. No more settling for all or nothing – select the linked items that truly matter and assemble the perfect package for your Sitecore adventures. So, go ahead and embrace these newfound packaging superpowers.<br />
Get ready to package up greatness, fellow Sitecore heroes!</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.peplau.com.br/meet-the-brand-new-advanced-powershell-packaging-features/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Index Searching - Find-Item using custom fields with Sitecore Powershell</title>
		<link>https://blog.peplau.com.br/index-searching-find-item-using-custom-fields-with-sitecore-powershell/</link>
		<comments>https://blog.peplau.com.br/index-searching-find-item-using-custom-fields-with-sitecore-powershell/#comments</comments>
		<pubDate>Fri, 05 Jul 2019 17:21:50 +0000</pubDate>
		<dc:creator><![CDATA[Rodrigo Peplau]]></dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[SPE]]></category>

		<guid isPermaLink="false">http://blog.peplau.com.br/?p=768</guid>
		<description><![CDATA[<div class="lr_horizontal_share" data-share-url="https://blog.peplau.com.br/index-searching-find-item-using-custom-fields-with-sitecore-powershell/"></div>UPDATE: Michael West likes this solution and confirmed that it will be part of the next release of SPE (6.0), becoming my first contribution to SPE! Here is the ticket where this implementation is being tracked. If you are a big fan of Sitecore Powershell Extensions like me, you probably know the Find-Item command, which allows searching your search [&#8230;]]]></description>
				<content:encoded><![CDATA[<hr />
<p><em><strong>UPDATE:</strong> <a href="https://github.com/michaellwest" target="_blank">Michael West</a> likes this solution and confirmed that it will be part of the next release of SPE (6.0), becoming my first contribution to SPE! </em><em><a href="https://github.com/SitecorePowerShell/Console/issues/1120" target="_blank">Here is the ticket</a> where this implementation is being tracked.</em></p>
<hr />
<p>If you are a big fan of <a href="https://marketplace.sitecore.net/Modules/Sitecore_PowerShell_console.aspx" target="_blank">Sitecore Powershell Extensions</a> like me, you probably know the <a href="https://doc.sitecorepowershell.com/appendix/indexing/find-item" target="_blank">Find-Item</a> command, which allows searching your search index in Powershell scripts. This command, however, has an important limitation: you cannot use custom fields to filter and sort from the index. Due to this limitation, extended usage of <em>Find-Item</em> with custom code is usually not possible.</p>
<p>Internally <em>Find-Item</em> uses the base class &#8220;<em>Sitecore.ContentSearch.SearchTypes.SearchResultItem</em>&#8220;, which does not include any custom fields. What we usually do with C# is to create a class that inherits from &#8220;<em>SearchResultItem</em>&#8220;, adding our custom fields, such as below:</p>
<pre>public class CustomSearchResultItem : SearchResultItem
{
   [IndexField("_templates")]
   [DataMember]
   public virtual List&lt;ID&gt; TemplateIds { get; set; }
}</pre>
<p>The <em>Find-Item</em> command, however, does not allow using this field. For instance, the following script:</p>
<pre>$props = @{
 Index = "sitecore_master_index"
 Where = "Paths.Contains(@0) And TemplateIds.Contains(@1)"
 WhereValues = [ID]::Parse("{D5B8857B-DE30-4616-84F5-812A7129ACD5}"), [ID]::Parse("{50FFE147-4F48-428B-A417-4D96DD2048FF}")
}
Find-Item @props</pre>
<p>Will give the following error:</p>
<pre>Find-Item : No property or field 'TemplateIds' exists in type 'SearchResultItem'</pre>
<p>Because, yeah&#8230; that property is only defined at our custom class, not at <em>SearchResultItem</em>. To circumvent this limitation I built this special command.</p>
<h2>Find-CustomItem</h2>
<p>This command extends the original <em>Find-Item</em>, allowing you to pass a type that will be used instead of the base <em>SearchResultItem</em> class:</p>
<pre>$props = @{
 Index = "sitecore_master_index"
<strong> Type = [PSWebsite.Foundation.Indexing.SearchTypes.BaseSearchResultItem]</strong>
 Where = "Paths.Contains(@0) And TemplateIds.Contains(@1)"
 WhereValues = [ID]::Parse("{D5B8857B-DE30-4616-84F5-812A7129ACD5}"), [ID]::Parse("{50FFE147-4F48-428B-A417-4D96DD2048FF}")
}
Find-CustomItem @props</pre>
<h2>Create the custom command</h2>
<p>In order to use <em>Find-CustomItem</em> in your project, you should:</p>
<ol>
<li>Add NuGet references to <em>Sitecore.ContextSearch</em> and <em>Sitecore.ContextSearch.Linq</em>;</li>
<li>Add a reference to <em>Cognifide.Powershell.dll</em>;</li>
<li>Create a custom <em>FindItemCommand</em> class extending <em>Cognifide.PowerShell.Commandlets.Data.Search.FindItemCommand</em>;<br />
You can <a href="https://github.com/peplau/PSWebsite/blob/master/src/Foundation/Indexing/code/Powershell/Commandlets/FindItemCommand.cs" target="_blank">download the whole class here</a></li>
<li>Register your new command with an include patch &#8211; make sure the content is according to the following</li>
</ol>
<pre>&lt;?xml version="1.0"?&gt;
&lt;configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"&gt;
   &lt;sitecore&gt;
      &lt;powershell&gt;
         &lt;commandlets&gt;
            &lt;add Name="Find Item" type="PSWebsite.Foundation.Indexing.Powershell.Commandlets.FindItemCommand, PSWebsite.Foundation.Indexing" /&gt;
         &lt;/commandlets&gt;
      &lt;/powershell&gt;
   &lt;/sitecore&gt;
&lt;/configuration&gt;</pre>
<h2>Limitations</h2>
<p>Not all parameters from <em>Find-Item</em> are supported by <em>Find-CustomItem</em>. If you use any of the unsupported parameters along with any custom properties, it will cast the query to the base <em>SearchResultItem</em>, and give the same error as the original <em>Find-Item</em> command.</p>
<p><strong>Supported parameters:</strong></p>
<ul>
<li>Index</li>
<li>Where</li>
<li>WhereValues</li>
<li>OrderBy</li>
<li>First</li>
<li>Last</li>
<li>Skip</li>
</ul>
<p><strong>Unsupported parameters:</strong></p>
<ul>
<li>Criteria</li>
<li>Predicate</li>
<li>ScopeQuery</li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.peplau.com.br/index-searching-find-item-using-custom-fields-with-sitecore-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
