none
VBSCRIPT / RESEARCH WITH INDEX REMOTE SERVER RRS feed

  • Question

  • HELLO, I TRY THIS VBSCRIPT CODE :

    Set objConnection = CreateObject("ADODB.Connection")
    
    Set objRecordSet = CreateObject("ADODB.Recordset")
    
    objConnection.Open "Provider=Search.CollatorDSO;Extended Properties='Application=Windows';"
    
    REQUETE="SELECT System.ItemName, System.ItemTypeText, System.Size FROM SystemIndex"
    objRecordSet.Open REQUETE, objConnection
    
    objRecordSet.MoveFirst
    Do Until objRecordset.EOF
        Wscript.Echo objRecordset.Fields.Item("System.ItemName")
        objRecordset.MoveNext
    Loop
    
    objRecordset.Close
    Set objRecordset = Nothing
    objConnection.Close
    Set objConnection = Nothing
    
    
    It works.


    I want to research files from my PC (named MYPC) on another one (named OTHERPC). This code doesn't work :

    Set objConnection = CreateObject("ADODB.Connection")
    
    Set objRecordSet = CreateObject("ADODB.Recordset")
    
    objConnection.Open "Provider=Search.CollatorDSO;Extended Properties='Application=Windows';"
    
    REQUETE="SELECT System.ItemName, System.ItemTypeText, System.Size FROM OTHERPC.SystemIndex"
    objRecordSet.Open REQUETE, objConnection
    
    objRecordSet.MoveFirst
    Do Until objRecordset.EOF
        Wscript.Echo objRecordset.Fields.Item("System.ItemName")
        objRecordset.MoveNext
    Loop
    
    objRecordset.Close
    Set objRecordset = Nothing
    objConnection.Close
    Set objConnection = Nothing

    AND this code doesn't work too :

    Set objConnection = CreateObject("ADODB.Connection")
    
    Set objRecordSet = CreateObject("ADODB.Recordset")
    
    objConnection.Open "Provider=Search.CollatorDSO;Extended Properties='Application=Windows';"
    
    REQUETE="SELECT System.ItemName, System.ItemTypeText, System.Size FROM MYPC.SystemIndex"
    objRecordSet.Open REQUETE, objConnection
    
    objRecordSet.MoveFirst
    Do Until objRecordset.EOF
        Wscript.Echo objRecordset.Fields.Item("System.ItemName")
        objRecordset.MoveNext
    Loop
    
    objRecordset.Close
    Set objRecordset = Nothing
    objConnection.Close
    Set objConnection = Nothing
    
    

    Could someone help me please ?

    Tuesday, March 5, 2019 10:45 AM

Answers

  • Download this Powershell script. https://gallery.technet.microsoft.com/scriptcenter/Get-IndexedItem-PowerShell-5bca2dae   Save it as Get-IndexedItem.ps1

    Open a Powershell window and run "import-module Get-IndexedItem.ps1"

    You can query a remote system like this.

     

    Run it with the -debug switch and you can see the query.

    See https://devblogs.microsoft.com/scripting/customizing-powershell-output-from-windows-search/

    Wednesday, March 6, 2019 3:00 PM

All replies

  • You can only search the local catalog.


    \_(ツ)_/

    Tuesday, March 5, 2019 10:58 AM
  • Thank you for your anwser.

    but here, I read it's possible :

    https://msdn.microsoft.com/en-us/library/windows/desktop/ff684395(v=vs.85).aspx

    I believe you but I don't understand.

    Could someone explain it to me ?

    Wednesday, March 6, 2019 11:26 AM
  • If you search you will find that most have not been able to make this work.

    I suspect that there are DCOM restrictions.  It can also be firewall issues.

    I have tried all available examples fro  the SDK.  All work locally from script.  None work remotely.   I haven't tried the C++ examples yet.


    \_(ツ)_/

    Wednesday, March 6, 2019 11:30 AM
  • Download this Powershell script. https://gallery.technet.microsoft.com/scriptcenter/Get-IndexedItem-PowerShell-5bca2dae   Save it as Get-IndexedItem.ps1

    Open a Powershell window and run "import-module Get-IndexedItem.ps1"

    You can query a remote system like this.

     

    Run it with the -debug switch and you can see the query.

    See https://devblogs.microsoft.com/scripting/customizing-powershell-output-from-windows-search/

    Wednesday, March 6, 2019 3:00 PM
  • Yes.  That works correctly.


    \_(ツ)_/

    Wednesday, March 6, 2019 3:17 PM
  • This query also works:

    REQUETE="SELECT System.ItemName, System.ItemTypeText, System.Size FROM Omega.SystemIndex Where Contains(*, 'test') AND  DIRECTORY = 'file://omega/scripts'"
    


    \_(ツ)_/

    Wednesday, March 6, 2019 3:25 PM