export computer list

CulturaInfra
CulturaInfra Posts: 1
edited January 30 in Deployment & Integrations

Hi all,

i'm have a problem when i try to extact the devices in my console.

when i run this script, i got a empty file :

$jsonFile = "YOURPATH\Computers export.json"$csvFile = "YOURPATH\Computers export.csv"$tvAccessToken = read-host "Please type your token "​$devicesResponse = Invoke-RestMethod -Uri "https://webapi.teamviewer.com/api/v1/devices?full_list=true" -Method Get -Headers @{authorization = "Bearer $tvAccessToken"}$devicesResponse.devices | ConvertTo-Json | Out-File $jsonFile$devicesResponse.devices | Export-Csv -Path $csvFile -Delimiter ',' -NoTypeInformation

i looked around and i find that he only extract 'groups' while all my computers are in 'device group'

any idea please

Answers

  • I'm having the same problem; this export is missing all of the device grouped computers.

  • Rmarcial
    Rmarcial Posts: 1

    I'm experiencing the same problem -

    $csvFile = "C:\scripts\TVDeviceInventory.csv"

    $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"

    $headers.Add("Authorization", "Bearer <User token with appropriate permissions>")

    $response = Invoke-RestMethod 'https://webapi.teamviewer.com/api/v1/devices?full_list=true' -Method 'GET' -Headers $headers

    $response.devices | Export-Csv $csvfile

    $response | ConvertTo-Json



    Always returns "devices": [ ]

    Looking at documentation online from other users it appears this endpoint previously worked as documented but I am unable to successfully retrieve any device information.

  • .Carol.fg.
    .Carol.fg. Posts: 1,350 Moderator
    edited January 30

    Hi CulturaInfra, adam_umos and Rmarcial,
    Thanks for your posts and for bringing attention for this topic!

    Please make sure you're using the API for the new Managed Groups (TeamViewer Remote), and not the old API (TeamViewer Classic).
    For more information, please check: https://webapi.teamviewer.com/api/v1/docs/index#!/Device32Groups/ManagedGroups_GetDevices

    📌Also, please note that the used API Token needs different permissions as well:

    Device Groups

    • read operations

    I hope it helps! 🍀
    Best, Carol


    Portuguese Community Moderator