Exporting a list of my Computers

Tigerpie_VS
Tigerpie_VS Posts: 1
edited June 2023 in General questions

Hello,

Is it possible to export a list of all the devices contained within the "Computers & Contacts" section thorugh either the Web Managment console or The Teamviewer managment program on windows?

Cheers guys

Best Answer

Answers

  • Kfix
    Kfix Posts: 0

    I need to export devices that are currently enrolled in order to indentify those that have not received the policy .


    Thank you.

  • ArvidInSupport
    ArvidInSupport Posts: 3 ✭✭

    What can I export? At the moment I am limited to :

     "remotecontrol_id": 

        "device_id": "

        "alias": 

        "groupid":  

        "online_state": 

        "assigned_to": 

        "teamviewer_id":"

    I would like to export more things about my devices. For example, Which version of teamviewer they are running, how long have they been online. etc.

    Thanks

  • JeanK
    JeanK Posts: 6,973 Community Manager 🌍

    Indeed, the export is limited to the parameters you have mentioned.

    There are currently no further parameters available such as the TeamViewer version, how long they have been online etc...

    Community Manager

  • ArvidInSupport
    ArvidInSupport Posts: 3 ✭✭

    How can I add more parameters to your code?

    I would like to add

    "supported_features (string, optional),

    last_seen (string, optional),"

    "


    Is it possible?

  • JeanK
    JeanK Posts: 6,973 Community Manager 🌍

    This is currently not possible.

    Community Manager

  • RyanMaeng
    RyanMaeng Posts: 3 ✭✭

    Hi JeanK

    How to import users with a csv file on powershell ??

  • JeanK
    JeanK Posts: 6,973 Community Manager 🌍

    Hi @RyanMaeng,

    Please find how to import the list into your Management Console in our documentation here:


    Community Manager

  • pshute
    pshute Posts: 7 ✭✭

    The TeamViewer API method described above worked to download all our devices, but why are some of the last_seen values blank? Some of the devices concerned have been accessed recently.

  • pshute
    pshute Posts: 7 ✭✭
    edited November 2021

    When I used this method a few days ago, the header line in the dump was

    "remotecontrol_id","device_id","alias","groupid","online_state","policy_id","assigned_to","last_seen","teamviewer_id"

    Today the header line is

     "remotecontrol_id","device_id","alias","groupid","online_state","policy_id","assigned_to","supported_features","teamviewer_id"

    What happened to the last_seen column?

  • Akiho
    Akiho Posts: 1,205 Moderator
    edited November 2021

    Hi @pshute,

    Thank you for reaching out to the community

    Good questions!!

    Honestly, I'm not 100% sure about this case.

    So, I discussed the case with our technical support engineer @Scotty, and I confirmed the below details.

    Last Seen

    The last_seen value is optional and is only available if the device is assigned to the user doing the export and is currently offline. You can confirm this in the documentation here - 4.10.1

    last_seen (optional): The timestamp of the last time, the device was online. Is not returned if the device is currently online. Only available if the device is assigned to the current user.


    "Missing Column"

    It is important to note that API's do not return columns, they return responses formatted in JSON with only the values for each response. In this case, I would assume you are using PowerShell or similar that is converting this into an array, then converting that into CSV.

    The CSV conversion is making columns out of the returned data. If there was no "Last Seen" values returned, it would not make a column for this as this value would not have ever appeared in the array.

    You can see how the raw responses look in our Test Center (Note you need to add the word "Bearer" before your API token).


    Hope this answers your question!

    Please let us know if you have further questions or concerns! 🙌

    Best regards,

    Akiho


    Japanese Community Moderator / コミュニティモデレーター

  • pshute
    pshute Posts: 7 ✭✭

    Thanks, I just used the code provided above by JeanK.

    I exported to both CSV and JSON, and I can see last_seen values in the JSON file. I think the difference is that there's no value for it in the first "row". I suspect the Export-Csv cmdlet ignores fields with names that aren't in the first row.

  • JanBorup
    JanBorup Posts: 1

    I have tried the JeanK PS script, but it fails in my PowerScript with this:

    Invoke-RestMethod : Den angivne værdi har ugyldige kontroltegn.

    Parameternavn: value

    At line:4 char:20

    + ... sResponse = Invoke-RestMethod -Uri "https://webapi.teamviewer.com/api ...

    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      + CategoryInfo     : NotSpecified: (:) [Invoke-RestMethod], ArgumentException

      + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

     

    Export-Csv : Cannot bind argument to parameter 'InputObject' because it is null.

    At line:6 char:28

    + ... e.devices | Export-Csv -Path $csvFile -Delimiter ',' -NoTypeInformati ...

    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      + CategoryInfo     : InvalidData: (:) [Export-Csv], ParameterBindingValidationException

      + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ExportCsvCommand

     

    My PowerShell version is:

    Name              Value                                                 

    ----              -----                                                 

    PSVersion           5.1.19041.1320                                             

    PSEdition           Desktop                                                

    PSCompatibleVersions      {1.0, 2.0, 3.0, 4.0...}                                        

    BuildVersion          10.0.19041.1320                                            

    CLRVersion           4.0.30319.42000                                            

    WSManStackVersion       3.0                                                  

    PSRemotingProtocolVersion   2.3                                                  

    SerializationVersion      1.1.0.1                                                


    Can anyone help me here ??

  • MCHD
    MCHD Posts: 2 ✭✭

    @JeanK I don't know how old your solution is but tried it just now and I was able to dump the data I needed for our organization. Thanks!

  • JeanK
    JeanK Posts: 6,973 Community Manager 🌍

    @MCHD thanks for reaching out!

    Could you let us know what you have exactly tried? Which data did you pull out in your operations?

    Community Manager

  • Marcelofs1
    Marcelofs1 Posts: 4 ✭✭

    Hello @JeanK

    I've been struggling for a while trying to use an API to get GROUPS information. I have managed to get the overall users script working fine and I am able to get a list of all users, however when I try to GET groups and their associated users I got some errors I couldn't find the reason.

    The USERS scripts works fine and it is like that

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

    $headers.Add("Authorization", "Bearer USER TOKEN Created")

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

    $response.users | Select-Object -Property "name","email","last_access_date","active" | Export-Csv "C:\Users\MyUser\TV-USERSList.csv"

    $response | ConvertTo-Json


    However when I try to run similar script for GROUPS users

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

    $headers.Add("Authorization", "Bearer OTHER Token created for GROUPS")

    $response = Invoke-RestMethod 'https://webapi.teamviewer.com/api/v1/groups?name=TST' -Method 'GET' -Headers $headers

    $response.groups | Select-Object -Property "id", "name", "shared_with" | Export-Csv "C:\Users\MyUser\TV-groups.csv"

    $response | ConvertTo-Json

    I got a BLANK .csv file however on the PowerShell screen I got the whole USERS listing even using a token created for GROUP management. Also, when running I got this error message

    Invoke-RestMethod : {"error":"invalid_token","error_description":"Access token is of wrong type. You need a UserToken to call this function.","error_code":2}

    At line:3 char:13

    + $response = Invoke-RestMethod 'https://webapi.teamviewer.com/api/v1/g ...

    +       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      + CategoryInfo     : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException

      + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand


    I have also tried to run using other tokens generated without success. I also tried running from the web interface from TeamViewer at https://webapi.teamviewer.com/api/v1/docs/index#!/Group32management/Groups_Get_0 without success.

    I am quite sure I am missing something very basic on the groups query but I just can't see what it is.

  • Marcelofs1
    Marcelofs1 Posts: 4 ✭✭

    Hello anyone. No response on that? I really couldn't get this listing.

  • JeanK
    JeanK Posts: 6,973 Community Manager 🌍

    Hello @Marcelofs1,

    Welcome to the TeamViewer Community and sorry that no one got back to you earlier.

    I asked our API master Guru and according to the error message,

    Invoke-RestMethod : {"error":"invalid_token","error_description":"Access token is of wrong type. You need a UserToken to call this function.","error_code":2}

    it could be that the token you are using is wrong.

    You need to make sure you use a user token and not a company token.

    You can create a user token by clicking your user nameEdit profileApps Create script token

    Looking forward to hearing from your tests!

    /JeanK

    Community Manager

  • Marcelofs1
    Marcelofs1 Posts: 4 ✭✭

    Thank you.

    Yes I am using the correct token. I have no idea why such message occurs. I have even created a new token for GROUP management with same results.

    I also tested on https://webapi.teamviewer.com/api/v1/docs/index#!/Group32management/Groups_Get_0 as it "generates" the command so I prevent the possibility of typos or something without success.

    I thought of any typos or even some weird characters and double checked spelling. I have created a new token for Group Management but I am still getting the error below

    "Access token is of wrong type. You need a UserToken to call this function."

    Well, the function I am calling is GROUP on this line

    $response = Invoke-RestMethod 'https://webapi.teamviewer.com/api/v1/groups?name=MYGROUP' -Method 'GET' -Headers $headers

    Just for testing, I also used the USER token with the same string and got exactly the same error message.

    Odd enough, when I run it for collecting the user list, it work perfect.

    Once again, thank you for your time.

    Marcelo

  • Marcelofs1
    Marcelofs1 Posts: 4 ✭✭

    Hello @JeanK

    I am now totally puzzled. This script, using a token created for GROUP MANAGEMENT got me output

    PS H:\> $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"

    $headers.Add("Authorization", "Bearer XXXXXXXXXXXXXXXXX")

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

    $response.groups | Select-Object -Property "id", "name", "shared_with" | Export-Csv "C:\Users\local folder\TV-groups.csv"

    $response | ConvertTo-Json

    Invoke-RestMethod : {"error":"invalid_token","error_description":"Access token is of wrong type. You need a UserToken to call this function.","error_code":2}

    At line:3 char:13

    + $response = Invoke-RestMethod 'https://webapi.teamviewer.com/api/v1/g ...

    +       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      + CategoryInfo     : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException

      + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

    {

      "users": [

             {

               "id": "yyyyyyyyyy",

               "name": "Kkkkk Jjjjjjj",

               "permissions": "ShareOwnGroups,ManageUsers,EditFullProfile,ViewAllConnections,ViewOwnConnections,EditConnections,DeleteConnections,ManagePolicies,AssignPolicies,AcknowledgeAllAlerts,AcknowledgeOwnAlerts,ViewAllAssets,ViewOwnAssets,Edit

    AllCustomModuleConfigs,EditOwnCustomModuleConfigs,ManageSettingPolicies,AssignSettingPolicies,ManageAntiMalwarePolicies,AssignAntiMalwarePolicies,AcknowledgeAllAntiMalwareThreats,AcknowledgeOwnAntiMalwareThreats,TrustedDeviceManagement,ManageBackupPolicies,A

    ssignBackupPolicies,BackupViewAndAckOwnAlerts,AllowPasswordChange",

               "active": true,

               "log_sessions": true,

               "show_comment_window": true,

               "email": "abcde.fghijk@company.com",

               "last_access_date": "2022-06-24T16:50:27Z",

               "activated_license_id": "license#",

               "activated_license_name": "Tensor Basic"


    I got surprised as the GET function is for GROUP and I got the entire listing of users and the output file was blank (that makes sense as I am trying to get the Group listing).

    Not sure if this does not also indicates some kind of security breach. I was not supposed to get a user list with such token right?


    Thank you

    Marcelo

  • JeanK
    JeanK Posts: 6,973 Community Manager 🌍

    Hello @Marcelofs1,

    Thank you for getting back with the info.

    The best way to resolve your issue would be to create a support ticket.

    Our engineers will be happy to help you further.

    You can create a ticket here: 📩 Create support ticket

    Sorry that I cannot help you more here, but my API knowledge is very basic.

    /JeanK

    Community Manager

  • mrcllnbrg
    mrcllnbrg Posts: 1

    Is there a way to do this on a Mac?

  • JeanK
    JeanK Posts: 6,973 Community Manager 🌍

    Hello @mrcllnbrg,

    There is no operating system restriction when using the API.

    So yes, it's possible to do it on macOS.

    /JeanK

    Community Manager

  • ITmatt
    ITmatt Posts: 0

    2023 and still no way to export a device list, I find this sad and pathetic. Logmein has no issues exporting a device list.

  • PeterNeville
    PeterNeville Posts: 1

    Turns out I can't include links in my posts.

    If you are trying to get a list of members of a Device Group rather than a Group

    Change the -URI so it ends /v1/managed/groups which will list the Device Groups and their IDs.

    Then change it to /v1/managed/groups/<GroupID>/devices to list the members

  • AJ86
    AJ86 Posts: 1

    How to find device Management, through script

  • pshute
    pshute Posts: 7 ✭✭

    Could somebody please post new instructions for creating the token for exporting a device list? The interface has changed, and no longer matches the instructions above. There is no "Computers and Contacts" section in the list of permissions. Do we just use the Contacts section now?

    Also, when I use the token I generated a year or so ago using the instructions above, I don't get a full list of computers. I think the migrated devices are missing.

  • tvapips
    tvapips Posts: 4 ✭✭


    Much easier, just do a "Get-TeamViewerManagedDevice" or "Get-TeamViewerDevice".


    Add-TeamViewerAssignment

    Add-TeamViewerCustomization

    Add-TeamViewerManagedDevice

    Add-TeamViewerManager

    Add-TeamViewerSsoExclusion

    Add-TeamViewerUserGroupMember

    Add-TeamViewerUserGroupToRole

    Add-TeamViewerUserToRole

    Connect-TeamViewerApi

    Disconnect-TeamViewerApi

    Export-TeamViewerSystemInformation

    Get-TeamViewerAccount

    Get-TeamViewerConnectionReport

    Get-TeamViewerContact

    Get-TeamViewerCustomModuleId

    Get-TeamViewerDevice

    Get-TeamViewerEventLog

    Get-TeamViewerGroup

    Get-TeamViewerId

    Get-TeamViewerInstallationDirectory

    Get-TeamViewerLogFilePath

    Get-TeamViewerManagedDevice

    Get-TeamViewerManagedGroup

    Get-TeamViewerManagementId

    Get-TeamViewerManager

    Get-TeamViewerPolicy

    Get-TeamViewerPredefinedRole

    Get-TeamViewerRole

    Get-TeamViewerService

    Get-TeamViewerSsoDomain

    Get-TeamViewerSsoExclusion

    Get-TeamViewerUser

    Get-TeamViewerUserByRole

    Get-TeamViewerUserGroup

    Get-TeamViewerUserGroupByRole

    Get-TeamViewerUserGroupMember

    Get-TeamViewerVersion

    Invoke-TeamViewerPackageDownload

    Invoke-TeamViewerPing

    New-TeamViewerContact

    New-TeamViewerDevice

    New-TeamViewerGroup

    New-TeamViewerManagedGroup

    New-TeamViewerPolicy

    New-TeamViewerRole

    New-TeamViewerUser

    New-TeamViewerUserGroup

    Publish-TeamViewerGroup

    Remove-TeamViewerAssignment

    Remove-TeamViewerContact

    Remove-TeamViewerCustomization

    Remove-TeamViewerDevice

    Remove-TeamViewerGroup

    Remove-TeamViewerManagedDevice

    Remove-TeamViewerManagedDeviceManagement

    Remove-TeamViewerManagedGroup

    Remove-TeamViewerManager

    Remove-TeamViewerPolicy

    Remove-TeamviewerPolicyFromManagedDevice

    Remove-TeamviewerPolicyFromManagedGroup

    Remove-TeamViewerPredefinedRole

    Remove-TeamViewerPSProxy

    Remove-TeamViewerRole

    Remove-TeamViewerSsoExclusion

    Remove-TeamViewerUser

    Remove-TeamViewerUserFromRole

    Remove-TeamViewerUserGroup

    Remove-TeamViewerUserGroupFromRole

    Remove-TeamViewerUserGroupMember

    Restart-TeamViewerService

    Set-TeamViewerAccount

    Set-TeamViewerAPIUri

    Set-TeamViewerDevice

    Set-TeamViewerGroup

    Set-TeamViewerManagedDevice

    Set-TeamViewerManagedGroup

    Set-TeamViewerManager

    Set-TeamViewerPolicy

    Set-TeamViewerPredefinedRole

    Set-TeamViewerPSProxy

    Set-TeamViewerRole

    Set-TeamViewerUser

    Set-TeamViewerUserGroup

    Start-TeamViewerService

    Stop-TeamViewerService

    Test-TeamViewerConnectivity

    Test-TeamViewerInstallation

    Unpublish-TeamViewerGroup

  • grattu
    grattu Posts: 2 ✭✭

    Does anyone know how to get the full list of devices when you run the API? I'm only getting about 1000 of my devices when I run this command but I am getting a  nextPaginationToken which I don't know how to use when I run the command.


    Invoke-RestMethod -Uri /api/v1/managed/groups/{id}/devices -Method Get -Headers @{authorization = "Bearer $apikey"}