1
の場合:foreachのと、私は問題を持っている私のコードの後にリンクされ問題ここ
#Delivery Groups Information
$dgroup = Invoke-RestMethod -Uri "https://${XMS}:4443/xenmobile/api/v1/deliverygroups/filter" -Body '{}' -Headers $headers -Method Post
$new = 0
$count = $dgroup.dglistdata.dglist.length
for ($v=0; $v -lt $count; $v++) {
foreach ($dglistdata in $dgroup) {
Write-Host $dglistdata.dglistdata.dglist[$new].name
$new++
}
}
$Host.UI.RawUI.ForegroundColor = "white"
$dgroup = Read-Host -Prompt "Please provide Delivery Group Name for which notification will be sent"
$message = Read-Host -Prompt "Please provide the message to be sent"
#Devices
$devices = Invoke-RestMethod -Uri "https://${XMS}:4443/xenmobile/api/v1/device/filter" -Body '{}' -Headers $headers -Method Post
foreach ($device in $devices.filteredDevicesDataList) {
Write-Output $device.id >$null
Write-Output $device.platform >$null
}
foreach ($device in $devices.filteredDevicesDataList) {
$url = "https://${XMS}:4443/xenmobile/api/v1/device/" + $device.id + "/deliverygroups"
$global:dg = Invoke-RestMethod -Uri $url -Headers $headers -Method Get
foreach($deliverygroups in $dg) {
Write-Output $dg.deliveryGroups.name >$null
}
}
foreach ($device in $devices.filteredDevicesDataList) {
if ($dg.deliveryGroups.name -match $dgroup) {
Write-Host $device.devicemodel
Send-Notification
} else {
$dgroup = 0
}
}
情報:
がコードの主な目的は、デバイスがあり、どのグループに基づいてデバイスに通知を送信することですのメンバー。
例:
が、私はそこに何かを逃してください: "DG 2" "DG 1"
結果の
iPhoneメンバーの
iPadのメンバー?実際に
として...コードコードではなく、トリミングされたスクリーンショットを投稿してください。また、現在のスクリーンショットのサンプルは、あなたを助けるのに十分な情報ではありません。 '$ dgroup'とは何ですか? '$ dg'とは何ですか? '$ devices'はどのように定義されましたか? –
コードの後: –
もう一度、スクリーンショットではなく_code_を貼り付けてください。必要に応じてフォーマットをお手伝いします –