---
title: "Autonomous Persona Management using 1E Tachyon’s PowerShell Toolkit"
description: "Learn how to manage thousands of endpoints with dynamic tagging capabilities with 1E’s Tachon."
canonical: "https://adamtheautomator.com/1e-powershell-3/"
---

# Autonomous Persona Management using 1E Tachyon’s PowerShell Toolkit

> Learn how to manage thousands of endpoints with dynamic tagging capabilities with 1E’s Tachon.

Source: https://adamtheautomator.com/1e-powershell-3/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![Autonomous Persona Management using 1E Tachyon’s PowerShell Toolkit](https://adamtheautomator.com/wp-content/uploads/2022/02/Autonomous-Persona-Management-using-1E-Tachyons-PowerShell-Toolkit.jpg)

# Autonomous Persona Management using 1E Tachyon’s PowerShell Toolkit

[![](https://secure.gravatar.com/avatar/d0b9d42e21e5622713f8b693aa5c0f9244d5f7dd200ed29b8398f52dee5de337?s=192&d=mm&r=g)Adam Bertram](https://adamtheautomator.com/author/adam-bertram/)23 February 20225 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[1E](/tag/1e/)[1E Tachyon](/tag/1e-tachyon/)[Powershell Administration](/tag/powershell-administration/)[Sponsored](/tag/sponsored/)

Table of Contents

*   [Determining the Tachyon Device Persona](#determining-the-tachyon-device-persona)
*   [Removing Existing Device Persona Tags](#removing-existing-device-persona-tags)
*   [Updating Tachyon Device Persona Tags](#updating-tachyon-device-persona-tags)
*   [Creating or Updating Management Groups Based On Persona](#creating-or-updating-management-groups-based-on-persona)
*   [My Conclusion](#my-conclusion)

Grouping devices into different categories or sub-groups is a staple of endpoint management. Whether you’re tagging devices for a project pilot or giving them a persona classification, a good solution should allow you to do so programmatically.

Manual tagging or using a static list is counterproductive, and administrators always look for opportunities to automate tasks. Lucky for you, 1E’s [PowerShell integration module](https://1eportal.force.com/s/article/TachyonPowerShellToolkit) called `PSTachyonToolkit` allows you to step it up.

This article explores how `PSTachyonToolkit` can help automate the dynamic creation of endpoints lists and apply persona tags to those devices based on specific criteria — all within PowerShell.

## Determining the Tachyon Device Persona

In this use-case scenario, my goal is to apply different persona tags to devices in the Tachyon environment. Later on, I can use these personas to target corresponding endpoints for whatever Tachyon instruction I need to run.

My solution will determine each persona type by checking the number of distinct processes executed within a specific number of days on the device. The different personas in this example are as follows.

*   **Knowledge Worker** – devices that executed 1 to 3 distinct processes total.
*   **Task Worker** – devices that executed 4 to 8 distinct processes total.
*   **Power User** – devices that executed 9 or more distinct processes total.

Tachyon has a [Tachyon Activity Record (TAR)](https://help.1e.com/display/TCNSDK/Tachyon+Activity+Record) feature, which keeps historical data of all endpoints. The data I need is already available, and I only need to perform the appropriate Tachyon query using the `Invoke-TachyonDynamic` cmdlet with the `-Query` parameter.

First, I’ll set the oldest activity date of the query.

```powershell
## Import the PSTachyonToolkit module
Import-Module PSTachyonToolkit
## Connect to the Tachyon server
Set-TachyonServer' 1E01.corp.1EDemoLab.com'
## Set the licensed instruction prefix
Set-TachyonInstructionPrefix '1E-Demo'

## Define the past number of days to query
$numDays = 7
## Calculate the oldest activity date to query
$startDate = ((Get-Date).AddDays(-$numDays)).ToString('yyyy-MM-dd')
```

Next, I’ll create a splat to build the dynamic instruction. To better understand the code, here are the parameters I am using:

*   `TargetScope` – This parameter accepts the filter expression to specify which endpoint devices will be the target. The targets for this example are Windows devices only (`"ostype=Windows"`).
    
*   `Query` – This parameter accepts the SQL-based query string. This example counts the total `ProcessName` rows from the [`$SoftwareInteraction_Daily`](https://help.1e.com/display/TCNSDK/Tachyon+Activity+Record#TachyonActivityRecord-Softwareinteraction) table.
    
*   `Schema` – Overrides the default output schema. The custom schema in this example only returns the `ProcessCount` field value as an integer (`int32`) data type.
    

```powershell
## Build the dynamic instruction
$dynamicSplat = @{
    # Target only Windows devices
    TargetScope = "ostype=Windows"
    # Count process names SoftwareInteraction_Daily table that from the last $numDays
    Query = "SELECT Count(ProcessName) AS ProcessCount FROM `$SoftwareInteraction_Daily WHERE DATETIME(TS, 'unixepoch') >= '$($startDate)'"
    # Override the schema and return only the ProcessCount field as an integer
    Schema = 'ProcessCount int32'
}
## Invoke the dynamic instruction
$result = Invoke-TachyonDynamic @dynamicSplat
```

As you can see below, running the activity query returned the results in a hashtable.

![Getting distinct process count](https://adamtheautomator.com/wp-content/uploads/2022/02/image-279.png)

Getting distinct process count

At this point, the result only shows the process count for each endpoint. Now would be the best time to insert additional properties to assign a persona to each device based on my defined persona table.

```powershell
## Merge Fqdn and values and add the persona
$result.Keys |
ForEach-Object {
    $result[$_] | Add-Member -MemberType NoteProperty -Name Fqdn -Value $_ -Force
    $result[$_] | Add-Member -MemberType NoteProperty -Name Persona -Value $(
        if ($result[$_].ProcessCount -in 1..3) { 'Knowledge Worker' }
        if ($result[$_].ProcessCount -in 4..8) { 'Task Worker' }
        if ($result[$_].ProcessCount -ge 9) { 'Power User' }
    ) -Force
}
## Convert result from Hashtable to custom object and group by persona
$result = $result.Values.ToArray() | Sort-Object ProcessCount
$result
```

I have now converted the result to a custom object, clearly adding the `Fqdn` and `Persona` properties.

![Converting the result and adding the Persona value](https://adamtheautomator.com/wp-content/uploads/2022/02/image-280.png)

Converting the result and adding the Persona value

## Removing Existing Device Persona Tags

Assuming that devices already have persona tags, I will first clear out any existing persona tags on every device. I can do that by running a dynamic Tachyon instruction that calls the [`Tagging.Delete()`](https://help.1e.com/display/TCNSDK/Tagging.Delete) method.

The below code contains the instruction, which I saved as `DeletePersona.scale`.

```sql
/* Delete the 'Persona' device tag*/
@result = Tagging.Delete(Name: "Persona", Scopable: true);
```

Next, I’ll invoke the dynamic instruction by running the following commands.

```powershell
## Delete 'Persona' tags from all devices matching the '1EDemoLab.com' domain
Invoke-TachyonDynamic -Scale .\\DeletePersona.scale -TargetScope '1EDemoLab.com'
```

The result below confirms that the dynamic instruction deleted the device persona tag where the value contains “`Present":true`. If the device persona tag did not exist, the value would have been “`Present":false`.

![Deleting the device persona tag](https://adamtheautomator.com/wp-content/uploads/2022/02/image-281.png)

Deleting the device persona tag

## Updating Tachyon Device Persona Tags

Now I will run another dynamic instruction that will update each Tachyon device with their corresponding Persona tag using [`Tagging.Set()`](https://help.1e.com/display/TCNSDK/Tagging.Set) method.

> \_As of PSTachyonToolkit v1.0.0, the `Invoke-TachyonDynamic` cmdlet ignores the `-Parameters` parameter when used with the `-Scale` parameter. Meaning I cannot pass a parameter to the dynamic SCALE code.
> 
> While working in PowerShell, I favor running dynamic instructions instead of published instructions. If 1E can consider allowing parameters with dynamic SCALE in future module releases, that would be a significant feature upgrade, in my opinion.
> 
> To workaround that limitation for now, I am composing the SCALE code inside the script instead and writing it out to a file.\_

```powershell
## Set the dynamic scale file path
$scaleFile = '.\\SetPersonaTag.scale'
## Group devices by Persona
$result | Group-Object Persona |
## Process each device persona group
ForEach-Object {
    ## Create the dynamic SCALE code file for the current device persona group
    '@result = Tagging.Set(Name:"Persona",Value:"' + $_.Name + '",Scopable:true);' | Out-File $scaleFile -Force
    ## Invoke the dynamic SCALE instruction
    Invoke-TachyonDynamic -Scale $scaleFile -TargetFqdns $_.Group.Fqdn
}
```

The image below shows the result of running the dynamic SCALE. As you can see, each device persona tag now has a value based on the conditions I set earlier.

![Updating the device Persona tag](https://adamtheautomator.com/wp-content/uploads/2022/02/image-282.png)

Updating the device Persona tag

To further confirm, I’m running the `Get-TachyonDevice` command below to display the device tags.

```powershell
Get-TachyonDevice -Full | Format-Table Fqdn, CoverageTags, Tags
```

![Displaying device tags](https://adamtheautomator.com/wp-content/uploads/2022/02/image-283.png)

Displaying device tags

## Creating or Updating Management Groups Based On Persona

So now I’ve tagged the devices with their new Persona. My next step is to create new or update existing [Management Groups](https://help.1e.com/display/TCN80/Management+Groups+page) based on each Persona and add each device as a member. This way, I can group the devices with the same Persona.

To create the management groups, I’ll be running the `Set-TachyonSLADirectManagementGroup` cmdlet. Instead of running three separate commands to create the three management groups, I’ll instead [loop](https://adamtheautomator.com/powershell-foreach/) through each Persona and run the command inside the loop.

Related:[Back to Basics: The PowerShell Foreach Loop](https://adamtheautomator.com/powershell-foreach/)

```powershell
@('Knowledge Worker', 'Task Worker', 'Power User') |
ForEach-Object {
    $persona = $PSItem
    if ($fqdn = (Get-TachyonDevice -Full | Where-Object { $_.CoverageTags.Persona -eq $persona }).Fqdn) {
        Set-TachyonSLADirectManagementGroup -Name $persona -FqdnList $fqdn
    }
}
```

![Creating the Management Groups based on Persona](https://adamtheautomator.com/wp-content/uploads/2022/02/image-284.png)

Creating the Management Groups based on Persona

I can now confirm that the new groups exist by running the `Get-TachyonManagementGroup` cmdlet.

```powershell
Get-TachyonManagementGroup | Format-Table Name,UsableId,TachyonDeviceCount
```

![Listing the Management Groups](https://adamtheautomator.com/wp-content/uploads/2022/02/image-285.png)

Listing the Management Groups

Now I can create a scheduled task to run this script at an interval if needed, like once a week.

Related:[How to Set Up and Manage Scheduled Tasks with PowerShell](https://adamtheautomator.com/powershell-scheduled-task/)

> _You can download the complete script from this [Gist](https://gist.github.com/junecastillote/f9ce7eb414719e54c555ab8489b7f726)._

Additionally, I can now run instructions and target devices based on their persona or management group ID.

For example, if I want to determine the PowerShell script execution policy of the _Task Worker_ devices, I would run the below command.

```powershell
$instructionSplat = @{
    TargetScope = 'tagtxt=[Persona=Task Worker]'
    instruction = '1E-Explorer-TachyonCore-GetExecutionPolicyPowershellCommandLine'
    Drilldown   = $true
}
Invoke-TachyonInstruction @instructionSplat
```

Or target the member devices of the _Task Worker_ management group.

```powershell
$instructionSplat = @{
    TargetScope = 'managementgroup=47'
    instruction = '1E-Explorer-TachyonCore-GetExecutionPolicyPowershellCommandLine'
    Drilldown   = $true
}
Invoke-TachyonInstruction @instructionSplat
```

## My Conclusion

Using static lists or manually tagging devices is tedious, inefficient, and outdated. Being able to script your way into building device inventory is something that admins should be doing right now!

Having 1E’s Tachyon and PSTachyonToolkit module in your arsenal, I dare say that you’ve already won half the battle. Chances are, there are already out-of-the-box instructions that fit your use-case requirements.

If not, you can also check out the [Tachyon Exchange](https://tachyonexchange.1e.com/) community, where you can find 84 product packs, 799 verified instructions, and 18 policies, as of this writing.

Related:[Learning 1E’s Tachyon: Using Explorer](https://adamtheautomator.com/learn-with-me-tachyon-explorer/)

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2F1e-powershell-3%2F&text=Autonomous%20Persona%20Management%20using%201E%20Tachyon%E2%80%99s%20PowerShell%20Toolkit)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2F1e-powershell-3%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2F1e-powershell-3%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2022/02/Getting-Started-with-1Es-Tachyon-and-PowerShell-1.jpg)

### [Getting Started with 1E’s Tachyon and PowerShell](/1e-powershell/)

Wrangle your endpoints with 1E’s Tachyon product and PowerShell in this in-depth tutorial!

![](https://adamtheautomator.com/wp-content/uploads/2022/01/Exploring-Processes-and-Applications-with-1E-Tachyon.jpg)

### [Exploring Processes and Applications with 1E Tachyon](/1e-tachyon/)

Learn to use the PowerShell and Tachyon integration to solve a specific use-case scenario.

![](https://adamtheautomator.com/wp-content/uploads/2022/02/How-to-Up-Your-PowerShell-Game-with-1E-Tachyon.jpg)

### [How to Up Your PowerShell Game with 1E Tachyon](/1e-powershell-2/)

Learn how to build a PowerShell script to check for webserver response time and clear remote PC DNS caches using 1E’s Tachyon.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
