我不确定如何查询其他页面。通过一些指南,我看到我已经拼凑了以下内容,但只获得了前 1000 个结果(预计数字接近 15000)。我似乎无法捕获 @odata.nextLink 值以添加到循环中。
$DeviceList = @()
$URI = "https://graph.microsoft.com/v1.0/deviceManagement/managedDevices?`$filter=contains(OperatingSystem,'iOS')&?`$select=serialNumber,Id"
if ($Null -ne $URI)
{
$GetDevices = Invoke-RestMethod -Headers $Headers -Uri $URI
$DeviceList += $GetDevices.value
$URI = $GetDevices.'@Odata.nextLink'
}
$DeviceList | Export-Csv C:\Users\######\Downloads\Test.csv -Force -Append