Export all Devices and their details to .CSV

Export all Devices and their details to .CSV

Written by Ines

Last published at: October 6th, 2021

Script Events:

  1. Connect to the server
  2. Discover all devices
  3. Create a Thinscale folder in C:\Temp unless specified otherwise
  4. Export the details into .CSV with date and time stamp

Log example:


import-module ThinScaleManagement

$creds = Get-Credential

$server = 'ServerURI'  #specify Server URI

$Filepath = 'C:\Temp\Thinscale'   # Specify export folder for the csv

$date = get-date -UFormat "%d-%a-%Y--%H-%M"

Connect-TSTMGMTServer -Uri $server -Credentials $creds

$Devices = Get-TSTMGMTDevices  | Select ObjectId, FolderId, @{n='FolderName';e={(Get-TSTMGMTFolder -FolderId $_.FolderId).FolderName}}, DeviceName, ProductType, ProductVersion, LastBootTime, LastHeardFrom, LastUsed, LastUser 

 ### create logs in C:\Temp\ThinScale

    New-Item -Path $Filepath -ItemType Directory -Force -Confirm:$false

    $log = $Devices | export-csv $Filepath\Devices_$date.csv -NoTypeInformation

Write-Host "Done" -ForegroundColor Cyan