Exporting a list of my Computers
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
Answers
-
I need to export devices that are currently enrolled in order to indentify those that have not received the policy .
Thank you.
0 -
Hello @Tigerpie_VS and @Kfix,
Currently, it is not possible to export the computers via a function of the Management Console.
However, it is possible to do it using the TeamViewer API. Please find more information regarding this here:
How to export your computers using the TeamViewer API
Step 1: Create an api token in the Management Console
1) Click on your Username on the top right corner and click Edit Profile
2) Go to Apps and click Create script token
3) Give the token a name and select the parameter Computers & Contacts with the setting View entries and click Save.
4) This will generate the token. Please copy this token and save it for later.
Step 2: Run the export script in PowerShell ISE
1) Open PowerShell ISE as administrator and type the following code and press Enter
$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
📌Note: Don't forget to replace YOURPATH with the path you want the export to be generated to.
2) It will ask you to enter your token. Please paste your token you have saved earlier and press Enter
3) You are done. The script will automatically generate the export in the folder you have selected as [YOURPATH].
Community Manager
---
Did my response answer your question? Help out others and select it as the Accepted Answer
7 -
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
0 -
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
---
Did my response answer your question? Help out others and select it as the Accepted Answer
0 -
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?
0 -
This is currently not possible.
Community Manager
---
Did my response answer your question? Help out others and select it as the Accepted Answer
0 -
Hi JeanK
How to import users with a csv file on powershell ??
0 -
Hi @RyanMaeng,
Please find how to import the list into your Management Console in our documentation here:
Community Manager
---
Did my response answer your question? Help out others and select it as the Accepted Answer
0 -
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.
0 -
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?
0 -
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 / コミュニティモデレーター
0 -
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.
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 ??
0 -
@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
---
Did my response answer your question? Help out others and select it as the Accepted Answer
0