PowerShell - Bulk-Add registry keys to profile from CSV

Add multiple registry keys listen in a CSV into the Additional Registry Keys section of the profile

Written by Ines

Last published at: July 24th, 2024

Requirements

 

Info

Tested with Secure Remote Worker 7.x, ThinKiosk 7.x and Thinscale Desktop Agent 8.x

 

 

Usage

  1. Download the script (.ps1) and the CSV file above locally onto the machine that is able to communicate with the Thinscale server/database
  2. Edit the CSV with required registry keys maintaining the format of the table, and do not change the name of the columns:

 

 

  1. Start a code terminal (powershell terminal, cmd, visual code etc.)
  2. Import the module as follows:

 

Import-Module "<path to the folder where you downloaded the .ps1 file>\Add-TSTMGMTBulkRegistryKeys.ps1"

 

Example:

 

Run the command as follows:

Add-TSTMGMTBulkRegistryKeys -URI "http://YourServer/tstmgmt" -ProfileName "Profile Name" -CSVPath "<path to the downloaded and edited CSV file>\bulkregistry.csv" -JSONInput "<path to where the original profile will be exported>\ProfileName.json" -JSONOutput "<path to where the new profile will be created>\ProfileName2.json"

 

Example:

 

 

Output:

 

 

Console view:

 

Details:

 

  • The script exports the original profile, makes changes to it, then saves it as a different file. In essence, it is a copy of the selected folder with additional registry keys - so it won't delete the old registry keys if there are any there.
  • It asks you if you want to import the new profile, and if yes (Y) is selected, then it will upload it to the same folder as your original profile.
  • You have to attach the new profile to the device folder to use it.
  • For TDA profiles, the script will not import the profile automatically, it has to be done manually.