Windows Index Search SQL Group On RRS feed

  • Question

  • Hi

    It's more about a Windows Search in Index problematic, but I don't find an appropriate forum, as it's handle by a PowerShell script, I post it here. I'm sorry if it's not the appropriate forum

    I'm trying to query Windows Index to retrieve emails with Windows Search SQL in a PowerShell script.

    For a basic query (Select, From, Where), it's ok, i have no problem, but I want to group my results with GROUP ON and that's more problematic to handle results.

    I have the following PowerShell script :
    $dbConnection = New-Object -ComObject ADODB.Connection
    $dbConnection.Open("Provider=Search.CollatorDSO;Extended Properties='Application=Windows';")
    $localMailsRS = New-Object -ComObject ADODB.Recordset
    GROUP ON System.ItemFolderPathDisplay
          OVER (GROUP ON System.Message.FromAddress
                      OVER (SELECT System.ItemName FROM SYSTEMINDEX))"
    , $dbConnection)
    While(-Not $localMailsRS.EOF) {
        echo "=================================================="
        echo "=================================================="

    (it's a simplified script for the example)

    For a basic SQL Query, $localMailsRS.Fields.Item('System.MYELEMENT').value is enough to display results but with the GROUP ON, only $localMailsRS.Fields.Item('System.ItemFolderPathDisplay').value works, and I don't find how to access to remaining results.

    Thanks for your help !

    Wednesday, February 27, 2019 4:05 PM


All replies