Where is the SG_-XXXX ID on a client machine?

We are hoping to add the Technician launch link (simplehelp://?JW_machine=SG_XXXXXXXXXXXX) to a custom field in SyncroMSP so we can launch SimpleHelp Tech console connection directly from the asset, the plan is to run a script from SyncroMSP on the client machine to fetch the SG_XXXX id (from registry, config file etc.) and add it to a custom field in Syncro.
The question is where is the SG_XXX ID is stored?

So I was not able to find the key in the registery, but I was able to find it in the SharedConfig folder. It’s not the cleanest, but you can find the SG_XXX in the following path:

C:\ProgramData\JWrapper-Remote Access\JWAppsSharedConfig\sgalive

You would have to parse it out with powershell or could use findstr I’m sure or some other ninja magic. Hope this helps!

1 Like

Thanks for that, much appreciated.

If anyone is using SyncroMSP and SimpleHelp, below is the PowerShell code that will parse the ID and add it to a custom field in Syncro.
If you want Loging and Alert functions to work make sure to add $Activity_Log and $Alert to the variables as dropdown with Yes and No options when creating the script in SyncroMSP.
This script should also be available in the Syncro Community Scripts soon.

This script should also work in most other RMM’s with some basic tweaks to the code below.

#This script parses the SimpleHelp SG_XXXX ID from "C:\ProgramData\JWrapper-Remote Access\JWAppsSharedConfig\sgalive"
#sanitises it and adds it to a clickable custom field in your asset, creating a technician link, that starts a remote
#session if you have SimpleHelp Technician installed.
#
#Make Sure you create a custom field in you assets called "SimpleHelp Link" as a Web Link by going to 
#"Admin>Asset Custom Fields(Under Customers)>Syncro Device (Manage Fields)"
#

Import-Module $env:SyncroModule

# Define the path to the file
$file = "C:\ProgramData\JWrapper-Remote Access\JWAppsSharedConfig\sgalive"

# Read the file's contents
$content = Get-Content $file

# Find the line containing the ID, accommodating both possible formats
$idLine = $content | Where-Object { $_ -match "^ID=SG(_SG)?_(-?\d+)" }

# Extract and format the numeric part of the ID
if ($idLine -match "^ID=SG(_SG)?_(-?\d+)") {
    # Format the ID as required
    $formattedID = "SG_" + $matches[2]
    $link = "simplehelp://?JW_machine=" + $formattedID
    # Output the formatted ID
    Write-Output "Formatted ID: $formattedID"
    # Output an appurl:// link
    Write-Output "AppUrl://: $link"
    Set-Asset-Field -Name "SimpleHelp Link" -Value $link
    if($Activity_Log -eq "Yes"){
        #Add note to Activity Log
        Log-Activity -Message "SimpleHelp ID Found, Link generated and appended to Asset Custom Field" -EventName "SimpleHelp Link Added"
    }
    
} else {
    Write-Output "ID not found or does not match the expected format."
    if($Alert -eq "Yes"){
    #Create an Alert
    Rmm-Alert -Category 'SimpleHelp' -Body 'SimpleHelp ID Not found, Link could not be generated.'
    }
}
1 Like

You can also get this information via the integration api.

https://simple-help.com/simplehelp-integration-api-v1.html#listing-machines%20\
Login to the SimpleHelpAdmin , under administration/integrations enable the api and generate an api token

Then you can use something like the following to grab all the machine ids.

Example:

$headers = @{ "content-type" = "application/json" } 
$response = Invoke-RestMethod -Uri 'https://host:port/api/v1/api_token/query/machines/list' -Headers $headers -Method POST 

foreach ($machineid in $response)

{

write-host "$($response.machineid)"

}
1 Like

Considered the API route at the start, but went the way was more comfortable with. Might revisit if we decide to use it for Mac’s as well, currently we only support like 4 so was easier to just copy paste those by hand.