Skip to main content

Would it be possible to search the rep console by email address? i would think that the jump client would need to gather this information and upload it to the appliance. 

 

 

I don’t think it grabs email address, only the logged-on user ID (which you should be able to search for, assuming someone is logged on). In our environment I have a job that loops through our jump clients and populates the comments field with various information such as who the computer is assigned to, the model, etc. I think that would probably be your best bet for being able to search by email address.

 

See answer to - 

Enhanced Jump Client Information Display: IP Address & Serial Number | Community


Would you be able to share details of how that job is setup and the location it runs from please. 


Here is a trimmed down version of mine that you could use as inspiration. There is room for improvement, but it gets the job done for us. There are several spots I have deleted that are specific to our environment that you will need to fill in. Use at your own risk.

 

You will have to create an API account for the secret and client ID. I run this on a side desktop that is always online and execute it on a schedule via the task scheduler. You can ask support or your technical contact if you need help setting it up in your environment.

 

<#
Author:
Date:

This script is used to manage Jump Clients in the BeyondTrust Remote Support environment.
It updates client comments, and logs all actions to a file.

The script takes three mandatory parameters: Secret, ClientID, and Namespace.
Secret and ClientID are used for API authentication, and Namespace is used to specify the API endpoint.

To run this script, use the following command in PowerShell:
.\YourScript.ps1 -Secret "YourSecret" -ClientID "YourClientID" -Namespace "YourNamespace"
Replace YourScript.ps1 with the name of this script file, and replace YourSecret, YourClientID, and YourNamespace with your actual values.

#>
param (
Parameter(Mandatory=$true)]
string]$Secret,
Parameter(Mandatory=$true)]
string]$ClientID,
Parameter(Mandatory=$true)]
string]$Namespace
)

# Define log file and timestamp
$LogFile = "{logFileLocation}\{logFileName}.log"
$Timestamp = Get-Date -format "MM/dd/yyyy HH:mm"

# Authorization region
$EncodeCred = dConvert]::ToBase64String(iSystem.Text.Encoding]::utf8.GetBytes($ClientID + ":" +$Secret))

# Get auth token
try {
$AuthToken = Invoke-RestMethod -Method POST -Header @{"authorization" = "Basic $EncodeCred"} -body @{"grant_type"="client_credentials"} -uri "https://$Namespace/oauth2/token"
$Token = $AuthToken.access_token
} catch {
Add-Content -Path $LogFile -Value "$Timestamp ERROR: Failed to get auth token: $_"
exit 1
}

# Import source of truth
$DataList = Import-Csv "{sourceOfTruth}.csv"

# Initialize page index and max page
$PageIndex = 1
$PageMax = 50 # Prevents corner case of having exactly x00 clients and loops forever

# Loop through the pages of data from the API
do{
# Query the API to get 100 records
try {
$JumpClientList = Invoke-RestMethod -Method Get -Headers @{"authorization"="Bearer $Token"; "Accept"="application/json"} -Uri "https://$Namespace/api/config/v1/jump-client?current_page=$PageIndex"
} catch {
Add-Content -Path $LogFile -Value "$Timestamp ERROR: Failed to get client list: $_"
exit 1
}

# Loop through each record
foreach($JumpClient in $JumpClientList){

# Update comments region
# Get the data for that record from the source truth
#TODO: Import your data

# Create the comment
$NewComment = "{New Comment}"

# Check if it's different than we already have. If so, update
if($NewComment.trim() -ne $JumpClient.Comments){
# Log the update action
Add-Content -Path $LogFile -Value "$Timestamp Updating comments on $($JumpClient.hostname)]. Old comments: t$($JumpClient.Comments)] New comments: t$NewComment]"
# Convert the comments into JSON
$jsonPayload = @{"comments"=$NewComment} | ConvertTo-JSON
# Update the record with an API call
try {
Invoke-RestMethod -Method Patch -Headers @{"authorization"="Bearer $Token"; "content-type"="application/json"} -Body $jsonPayload -Uri "https://$Namespace/api/config/v1/jump-client/$($JumpClient.ID)" | Out-Null
} catch {
Add-Content -Path $LogFile -Value "$Timestamp ERROR: Failed to update client: $_"
}
}
}

# Increment the page index
$PageIndex++
} while($JumpClientList.count -eq 100 -and ($PageMax - $PageIndex) -gt 0)

 


Reply