powershellupnpdlna

Why does my PowerShell Search Not Return Any Results From My DLNA Server?


I am trying to search my DLNA device for a list of videos using PowerShell. My code is:

InvokeAction executes successfully, but it doesn't return any data.

   if ($service.Id -like "*ContentDirectory*")
    {
        $objectID="0"
        $browseFlag= "upnp:class='object.item.videoItem.movie'"
        $filter = ""
        $startingIndex = 0
        $requestedCount = 0
        $sortCriteria=""
        $myInObject = @($objectID, $browseFlag, $filter, $startingIndex, $requestedCount, $sortCriteria)

        $result=""
        $numberReturned=0
        $totalMatches=0
        $updateId=0
        $outArgs = @($result, $numberReturned, $totalMatches, $updateId)

        $response = $service.InvokeAction("Search", $myInObject, [ref]$outArgs)
        Write-Host $outArgs[0]
        Write-Host $outArgs[1]
        Write-Host $outArgs[2]
        Write-Host $outArgs[3]
    }

Can anyone explain to me what is wrong with my code? I am wondering if it is the formatting of the $browseFlag variable, but I have tried every combination of single and double quotes that I can think of, and none of them worked.


Solution

  • As is often the way, I stumbled on the answer shortly after posting the question.

    All I did was to change

    $outArgs = @($result, $numberReturned, $totalMatches, $updateId)
    

    to

    $outArgs = $null