title: Sitecore PowerShell fast Search in Script
body: <p>I used Sitecore PowerShell Extensions module to create script, that copy the relation from one item to the related item.</p>
  
  <p>I use <code>Get-ChildItem</code> to get all the items which will have relation on specific fields</p>
  
  <pre><code>Get-ChildItem -Recurse . | Where-Object {
      $_.TemplateName -match $'myTemplate' -and
      $_.Fields[$fromfield].Value -ne $null -and
      $_.Fields[$fromfield].Value -ne ""
  } | ForEach-Object {
  }
  </code></pre>
  
  <p>I took about 1 min to fetch all the items because the data is big.</p>
  
  <p>So I tried to use <code>Find-Item</code> to make the search process faster</p>
  
  <pre><code>Find-Item -Index 'sitecore_mastre_index' -Where 'TemplateName = @0' -WhereValues 'myTemplate'
  </code></pre>
  
  <p>It gave me below warning, note that I use  Sitecore Version 7.2</p>
  
  <blockquote>
    <p>WARNING: The parameter Where is not supported on this version of Sitecore due to platform limitations.</p>
    
    <p>This parameter is supported starting from Sitecore Version 7.5</p>
  </blockquote>
  
  <p>Is there a way to retrieve the data using PowerShell in way faster than using <code>Get-ChildItem</code>?</p>
  
  <p>Note: if I use  <code>Get-Item .</code> the query returns only the first 100 items. I have many more items.</p>