为什么我的 PowerShell 搜索没有从我的 DLNA 服务器返回任何结果?

问题描述

我正在尝试使用 PowerShell 在我的 DLNA 设备中搜索视频列表。我的代码是:

InvokeAction 执行成功,但不返回任何数据。

   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]
    }

谁能向我解释我的代码有什么问题?我想知道这是否是 $browseFlag 变量的格式,但我已经尝试了我能想到的所有单引号和双引号的组合,但都没有奏效。

解决方法

正如往常一样,我在发布问题后不久就偶然发现了答案。

我所做的只是改变

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

$outArgs = $null