title: How can I get the date of the last Full Crawl in Sharepoint 2010 using Powershell?
body: <p>I can run the following to get the current crawls and from there determine the last crawl completed date.</p>
  
  <pre><code># Get the Search App from Sharepoint
  $searchApp = Get-SPEnterpriseSearchServiceApplication "My Search Service"
  Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $searchapp 
  
  $contentsource = Get-SPEnterpriseSearchCrawlContentSource "MyCrawl" -SearchApplication $searchApp
  $contentsource.CrawlCompleted
  </code></pre>
  
  <p>But this is the last time <em>any</em> crawl completed.  I want the date of the last <em>Full</em> crawl.</p>
  
  <p>I can see the information in the crawl History.  But when I try and get the crawl history (see <a href="http://blogs.msdn.com/b/carloshm/archive/2009/03/31/how-to-programmatically-export-the-crawl-history-to-a-csv-file-in-powershell.aspx" rel="nofollow">http://blogs.msdn.com/b/carloshm/archive/2009/03/31/how-to-programmatically-export-the-crawl-history-to-a-csv-file-in-powershell.aspx</a>) using the below I don't seem to get an object I can really work with (its one big string container as far as I can tell) and it is full of IDs.</p>
  
  <pre><code> $s = new-Object Microsoft.SharePoint.SPSite("http://portal");
   $c = [Microsoft.Office.Server.Search.Administration.SearchContext]::GetContext($s);
   $h = new-Object Microsoft.Office.Server.Search.Administration.CrawlHistory($c) 
  </code></pre>
  
  <p>I was hoping to get an object that represents the crawl history which I could then filter on crawl name and Type = full.</p>
  
  <p>I have searched around and can't find an answer anywhere.  (Note also that the CrawlHistory class is being deprecated).</p>
  
  <p>Any thoughts/suggestions?</p>