Export device info with OS, Folder and reg key

Device name, Folder, Product type, Product Version, OS Name, Os Version, Registration Key, LegacyAuth Username

Written by Ines

Last published at: January 6th, 2022

Script Events

  1. Discovers all devices and their details
  2. Collects date and time
  3. Saves the details into csv file in the current user's desktop folder with current date and time of running the script
  4. lists the details of within the terminal window
  5. opens the folder where .csv is saved

Script Example


Import-Module ThinscaleManagement

$NOW = Get-Date -UFormat "%d-%a-%Y--%H-%M"

$uri = "uri" #write here the full uri of your server

$destination = "${env:userprofile}\Desktop"  #the file will be saved on the current user's desktop by default

$file = "$destination\AllDevices_$NoW.csv"  #the name of the file is AllDevices_current date and time

#do not edit after this part

Get-Credential | Connect-TSTMGMTServer -Uri $uri

$devices = Get-TSTMGMTDevices | Select DeviceName, @{n='Folder';e={(Get-TSTMGMTFolder -folderId $_.FolderId).FolderName}}, ProductType ,ProductVersion, LastUsed,  @{n='ActiveProfile';e={(Get-TSTMGMTProfile -ProfileId $_.ActiveProfileId).ProfileName + ' rev.' + (Get-TSTMGMTProfile -ProfileId $_.ActiveProfileId).ProfileRevision}}, @{n='OSName'; e={($_ | Get-TSTMGMTDeviceInventory).OperatingSystemName}}, @{n='OSversion'; e={($_ | Get-TSTMGMTDeviceInventory).OperatingSystemVersion}}, @{n='AccessKeyName'; e={(Get-TSTMGMTAccessKey -AccessKeyId $_.AccessKeyId).KeyName}}, @{n='LegacyAuthUser'; e={(Get-TSTMGMTAccessKey -AccessKeyId $_.AccessKeyId).LegacyAuthUsername}}, @{n='RegistrationKey'; e={(Get-TSTMGMTAccessKey -AccessKeyId $_.AccessKeyId).RegistrationKey}}

$devices | Export-Csv $file -NoTypeInformation


Start-Process -FilePath $destination