簡體   English   中英

Powershell:UPnP ContentDirectory瀏覽器不返回任何結果

[英]Powershell: UPnP ContentDirectory Browser does not return any results

我想瀏覽我的媒體服務器(Rasperry Pi上的MiniDLNA 1.1.5)。 這是我到目前為止的代碼:

$DeviceFinder = New-Object -COM "UPnP.UPnPDeviceFinder"
$DeviceType = "urn:schemas-upnp-org:service:ContentDirectory:1"

Write-Host "Finding MediaServer devices..."
$Devices = $DeviceFinder.FindByType($DeviceType,0)
$MediaServer = $Devices | Where-Object { $_.FriendlyName -like "*LittlePi*" }

$MediaServerDirectory = $MediaServer.Services | Where-Object { $_.Id -eq "urn:upnp-org:serviceId:ContentDirectory" }

Write-Host "MediaServer Description:" $MediaServer.Description
Write-Host "Browsing MediaServer..."

$ContainerID = 0
$BrowseFlag = "BrowseDirectChildren"
$Filter = ""
$StartIndex = 0
$RequestedCount = 1000
$SortCriteria = ""
$myInObject = @($ContainerID, $BrowseFlag, $Filter, $StartIndex, $RequestedCount, $SortCriteria)
$outArgs = @()

$returnValue = $MediaServerDirectory.InvokeAction("Browse", $myInObject, [ref]$outArgs)

我的問題是$returnValue$outArgs$null

在調用InvokeAction之前,您是否嘗試過設置$ outArgs = $ null?

我在嘗試從路由器獲取外部IP地址時遇到問題,並且$ null分配技巧起作用了。

(搜索3個關鍵字:powershell com upnp來查看我的示例)

不知道這對$ returnvalue是否有影響。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM