Catching exceptions generated by Get-FASTSearchMetadataCrawledProperty RRS feed

  • Question

  • Hi all -

    I'm trying to catch the underlying exception thrown when attempting to get a crawled property that doesn't exist.  I have tried the

    catch-all approach, which doesn't seem to work:  try {get-FASTSearchmetadataCrawledProperty -name test}
    catch {...}; nor does catch [System.ArgumentException] {}.  For that matter, I guess I don't really understand what the
    fully qualified class name of the exception is.  The message coming back is
    CategoryInfo: ObjectNotFound: (:) [Get-FASTSearchMetadataCrawledProperty], ArgumentException.

    At a minimum, if I can't handle this exception in the usual way, I'd like to supress the annoying message regarding the property not being found.



    Paul C. Loefstedt

    Saturday, March 10, 2012 2:12 PM


  • Hi Paul!

    You can do the following:

    $cp = Get-FASTSearchMetaDataCrawledProperty -Name "cpname" 2>$null
    # and then check if the variable $cp is null
    if($cp -eq $null) {
     # create the cp


    Monday, March 12, 2012 7:46 AM