system.data.oledb.oledbadapter not working in PWSH 6.1 RRS feed

  • Question

  • Why is it that the following code works on Windows Powershell, but not on PWSH 6.1?

    $sql = "SELECT System.ItemPathDisplay FROM SYSTEMINDEX WHERE (system.itemtype != 'Directory') AND CONTAINS (contents,'createthread NEAR WINAPI') AND (system.fileextension = '.h') AND (SCOPE = 'C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/um')"
    $provider = "Provider=Search.CollatorDSO;Extended Properties='Application=Windows';"
    $connector = New-Object system.data.oledb.oledbdataadapter -argument $sql, $provider
    $dataset = New-Object system.data.dataset
    if ($connector.fill($dataset))

    I get this error on PWSH 6.1:

    New-Object : Cannot find type [system.data.oledb.oledbdataadapter]: verify that the assembly containing this type is loaded.
    At line:1 char:14
    + ... connector = New-Object system.data.oledb.oledbdataadapter -argument $ ...
    +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidType: (:) [New-Object], PSArgumentException
    + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

    I couldn't find anything in the PWSH release notes about this


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Monday, July 1, 2019 11:45 PM