Skip to main content
All CollectionsRemote Monitoring & ManagementDeploying Agents
Migrating your assets into SuperOps.ai using Scripts
Migrating your assets into SuperOps.ai using Scripts
Updated over a year ago

If you are looking to transfer all your assets from other platforms to SuperOps.ai, we’ve got you covered. Easily migrate your assets with our “Asset Migration Script”.

  1. Navigate to Profile > Product Onboarding

2. Once you're on the onboarding page, you will find the 'Migrate data' button at the top, as shown below.

3. Now, on the migrate data page, you will find the "Import Asset" tab listed. Click on the script button under that tab to migrate all your assets into SuperOps.ai

4. A pop-up message will appear, displaying the appropriate scripts for Windows, Mac, and Linux devices, as shown below:


For Windows:

The syntax would look like this:


# $clientName="<client_name>"

# $siteName="<site_name>"

# $apiToken="<api_token>"

# $subDomain="<subdomain_value>"


if([string]::IsNullOrEmpty($clientName)) {
Write-Host "ClientName field is mandatory"
[Environment]::Exit(1)

}

if([string]::IsNullOrEmpty($siteName)) {
Write-Host "SiteName field is Empty, Taking default SiteName"
}

if([string]::IsNullOrEmpty($apiToken)) {
Write-Host "API Token field is mandatory"
[Environment]::Exit(1)
}

if([string]::IsNullOrEmpty($subDomain)) {
Write-Host "SubDomain field is mandatory"
[Environment]::Exit(1)
}

function checkSuperops{
try{
$package = Get-WmiObject -Class Win32_Product | Where-Object { $_.IdentifyingNumber -contains "{3BB93941-0FBF-4E6E-CFC2-01C0FA4F9301}" }
if( $package) { return $true} else{ return $false}
}catch{
Write-Host "Error in checking the installation of Superops"
Write-Host $_.Exception.Message
[Environment]::Exit(1)
}
}

if (checkSuperops) {
Write-Host "Superops is already installed"
[Environment]::Exit(1)
}

$SuperOpsPath="${env:ProgramData}\Sopinstall"

#Create Folder if not exists
function CreateDirectory{
try {
If(!(Test-path -PathType container "$SuperOpsPath")){
New-Item -ItemType Directory -Path "$SuperOpsPath"
}
}catch {
write-Host "Error in creating Directory $SuperOpsPath"
write-Host $_.Exception.Message
[Environment]::Exit(1)
}
}


function GetDownloadUrl{

try{
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("CustomerSubDomain", "$subDomain")
$headers.Add("Authorization", "Bearer $apiToken")
$headers.Add("Content-Type", "application/json")

$api="https://api.superops.ai/msp/api"

$Urlbody = "{`"query`":`"query getInstallerInfo(`$input: InstallerInfoInput) {`\r`\n getInstallerInfo(input: `$input) {`\r`\n id`\r`\n installerDownloadUrl`\r`\n installerName`\r`\n os`\r`\n }`\r`\n}`",`"variables`":{`"input`":{`"clientName`":`"$clientName`",`"siteName`":`"$siteName`"}}}"
$response = Invoke-RestMethod $api -Method 'POST' -Headers $headers -Body $Urlbody

$installer_regex="windows_x64.msi"
if ((Get-WmiObject win32_operatingsystem | select osarchitecture).osarchitecture -ne "64-bit"){
$installer_regex="windows_x86.msi"
}

$URL=$response.data.getInstallerInfo | ForEach-Object {if ($_.installerName -contains $installer_regex){$_.installerDownloadUrl} }
Write-Host "Download URL fetched $URL"
return $URL

}catch {
write-Host "Error in getting download URL"
write-Host $_.Exception.Message
[Environment]::Exit(1)
}
}



function DownloadMsi{
try {
write-Host "Downloading using invoke-WebRequest"
invoke-WebRequest -Uri "$DownloadURL" -Outfile "$ParentPath"
if (!(Test-Path $ParentPath)){
Write-Host "Downloaded File doesn't exists"
[Environment]::Exit(1)
}
write-Host "Downloaded Successfully"
}
catch {
write-Host "Error while downloading superops"
write-Host $_.Exception.Message
[Environment]::Exit(1)
}

}



function InstallSuperops{
try {
start-Process -Wait -FilePath msiexec -ArgumentList /i,"$ParentPath", "/QN /l*v installation.log LicenseAccepted=yes"
if (checkSuperops) {
Write-Host "Superops Installed Successfully"
}else{
Write-Host "Superops Installation failed"
}
Remove-Item -Path "$ParentPath"
}catch {
write-Host "Error while installing superops"
write-Host $_.Exception.Message
[Environment]::Exit(1)
}
}


CreateDirectory

$DownloadURL=GetDownloadUrl
if([string]::IsNullOrEmpty($DownloadURL)) {
Write-Host "Download URL is empty"
[Environment]::Exit(1)

}


$msiname=Split-Path -Path "$DownloadURL" -Leaf

$ParentPath=Join-Path -Path $SuperOpsPath -ChildPath $msiname

DownloadMsi
InstallSuperops

Write-Host "Successfully Installed the Superops Agent."

Here, you’ll need to uncomment the variables in the script and add the relevant values for these variables while executing the script. To uncomment variables in the script, remove the hashtag (#) that is included before the variable.

For example, if the client name is Acme and the site name is New York, then the script to install will look like this:


$clientName="Acme"

$siteName="NewYork"

$apiToken = "api-eyJhbGciOiJSUzI1NiJ9.eyJqdGkiOiI1MzIyNzUzNjg2NjAyMzAxNDQwIiwicmFuZG9taXplciI6Iu-_ve-_vVx1MDAxMu-_vXxFEB7-ml7nN6hNX2IFPU1P2NslgFyCxyyimsLJ6RqhseQEdbWnT56Mr8QlbQruRy4JLK23Co139T7l0OHoPYPsABBQieqfxuwhkoIMTu0bS1GD3cNJ0zIMWsxhiBedydwOojl9zAxlZ6QDyZstu5m0M27C6ZzyS2PWjXBSJrD0qQeMpkH7EA"

$subDomain="atom"


if([string]::IsNullOrEmpty($clientName)) {
Write-Host "ClientName field is mandatory"
[Environment]::Exit(1)

}

if([string]::IsNullOrEmpty($siteName)) {
Write-Host "SiteName field is Empty, Taking default SiteName"
}

if([string]::IsNullOrEmpty($apiToken)) {
Write-Host "API Token field is mandatory"
[Environment]::Exit(1)
}

if([string]::IsNullOrEmpty($subDomain)) {
Write-Host "SubDomain field is mandatory"
[Environment]::Exit(1)
}

function checkSuperops{
try{
$package = Get-WmiObject -Class Win32_Product | Where-Object { $_.IdentifyingNumber -contains "{3BB93941-0FBF-4E6E-CFC2-01C0FA4F9301}" }
if( $package) { return $true} else{ return $false}
}catch{
Write-Host "Error in checking the installation of Superops"
Write-Host $_.Exception.Message
[Environment]::Exit(1)
}
}

if (checkSuperops) {
Write-Host "Superops is already installed"
[Environment]::Exit(1)
}

$SuperOpsPath="${env:ProgramData}\Sopinstall"

#Create Folder if not exists
function CreateDirectory{
try {
If(!(Test-path -PathType container "$SuperOpsPath")){
New-Item -ItemType Directory -Path "$SuperOpsPath"
}
}catch {
write-Host "Error in creating Directory $SuperOpsPath"
write-Host $_.Exception.Message
[Environment]::Exit(1)
}
}


function GetDownloadUrl{

try{
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("CustomerSubDomain", "$subDomain")
$headers.Add("Authorization", "Bearer $apiToken")
$headers.Add("Content-Type", "application/json")

$api="https://api.superops.ai/msp/api"

$Urlbody = "{`"query`":`"query getInstallerInfo(`$input: InstallerInfoInput) {`\r`\n getInstallerInfo(input: `$input) {`\r`\n id`\r`\n installerDownloadUrl`\r`\n installerName`\r`\n os`\r`\n }`\r`\n}`",`"variables`":{`"input`":{`"clientName`":`"$clientName`",`"siteName`":`"$siteName`"}}}"
$response = Invoke-RestMethod $api -Method 'POST' -Headers $headers -Body $Urlbody

$installer_regex="windows_x64.msi"
if ((Get-WmiObject win32_operatingsystem | select osarchitecture).osarchitecture -ne "64-bit"){
$installer_regex="windows_x86.msi"
}

$URL=$response.data.getInstallerInfo | ForEach-Object {if ($_.installerName -contains $installer_regex){$_.installerDownloadUrl} }
Write-Host "Download URL fetched $URL"
return $URL

}catch {
write-Host "Error in getting download URL"
write-Host $_.Exception.Message
[Environment]::Exit(1)
}
}



function DownloadMsi{
try {
write-Host "Downloading using invoke-WebRequest"
invoke-WebRequest -Uri "$DownloadURL" -Outfile "$ParentPath"
if (!(Test-Path $ParentPath)){
Write-Host "Downloaded File doesn't exists"
[Environment]::Exit(1)
}
write-Host "Downloaded Successfully"
}
catch {
write-Host "Error while downloading superops"
write-Host $_.Exception.Message
[Environment]::Exit(1)
}

}



function InstallSuperops{
try {
start-Process -Wait -FilePath msiexec -ArgumentList /i,"$ParentPath", "/QN /l*v installation.log LicenseAccepted=yes"
if (checkSuperops) {
Write-Host "Superops Installed Successfully"
}else{
Write-Host "Superops Installation failed"
}
Remove-Item -Path "$ParentPath"
}catch {
write-Host "Error while installing superops"
write-Host $_.Exception.Message
[Environment]::Exit(1)
}
}


CreateDirectory

$DownloadURL=GetDownloadUrl
if([string]::IsNullOrEmpty($DownloadURL)) {
Write-Host "Download URL is empty"
[Environment]::Exit(1)

}


$msiname=Split-Path -Path "$DownloadURL" -Leaf

$ParentPath=Join-Path -Path $SuperOpsPath -ChildPath $msiname

DownloadMsi
InstallSuperops

Write-Host "Successfully Installed the Superops Agent."

📝Note: You can generate the API token from the Migrate Assets page by clicking on the generate token button as shown below. Copy the generated token and add it to the variable $apiToken.

For Mac:

The syntax would look like this:

#!/bin/bash

# clientName="<client_name>"
# siteName="<site_name>"
# apiToken="<api_token>"
# subDomain="<sub_domain>"

function nullCheck(){
isnull=$(echo "$2" | xargs)
if [ -z "$isnull" ]; then
echo "$1 is empty"
exit 1
fi
}

function nullCheckForSite(){
isnull=$(echo "$2" | xargs)
if [ -z "$isnull" ]; then
echo "Site name is empty or null hence taking default site"
fi
}

function getDownloadUrl(){

api="https://api.superops.ai/msp/api"

url=$(curl --location --request POST "$api" \
--header "CustomerSubDomain: $subDomain" \
--header "Authorization: Bearer $apiToken" \
--header 'Content-Type: application/json' \
--data-raw '{"query":"query getInstallerInfo($input: InstallerInfoInput) {\n getInstallerInfo(input: $input) {\n id\n installerDownloadUrl\n installerName\n os\n }\n}","variables":{"input":{"clientName":"'"$clientName"'","siteName":"'"$siteName"'"}}}')|| {
echo $?
echo "Error while fetching download Url"
exit 1
}
downloadUrl=$(echo $url | grep -o '"installerDownloadUrl":"[^"]*"' | grep -o '[^"]*pkg"$' | sed 's/"//g')
echo "Download URL Fetched"

}

function downloadAndInstall(){

export baseName="$(basename $downloadUrl)"
curl -o /tmp/$baseName $downloadUrl
if [ $? -ne 0 ]; then
echo "Failed to download the pkg"
exit 1
fi
if [ -f "/tmp/$baseName" ]; then
echo "superops pkg downloaded successfully"
else
echo "Failed to download Superops pkg"
exit 1
fi

installer -pkg /tmp/$baseName -target /
if [ $? -ne 0 ]; then
echo "Failed to install superops"
exit 1
fi
echo "Installation Success"
rm -f /tmp/$baseName
}


#clientName="$1"
nullCheck "client name" $clientName

#siteName="$2"
nullCheckForSite "Site name" $siteName

#apitoken="$3"
nullCheck "api token" $apiToken

#domain="$4"
nullCheck "Domain name" $subDomain


getDownloadUrl
nullCheck "download Url" $downloadUrl


downloadAndInstall

Here, you’ll need to uncomment the variables in the script and add the relevant values for these variables while executing the script. To uncomment variables in the script, remove the hashtag (#) that is included before the variable.

For example, in case the client name is Acme and the site name is New York, then the script to install will look like this,

#!/bin/bash

clientName="Acme"
siteName="NewYork"
apiToken= "api-eyJhbGciOiJSUzI1NiJ9.eyJqdGkiOiI1MzIyNzUzNjg2NjAyMzAxNDQwIiwicmFuZG9taXplciI6Iu-_ve-_vVx1MDAxMu-_vXxFPXBA77-9In0.btt8Pmi2Q5fwURTcQjpu4vkOZ1ebCvo24kDA6ylNVAze9XdLvsukAQnyhlgnNQrjt2wfFtMYPsABBQieqfxuwhkoIMTu0bS1GD3cNJ0zIMWsxhiBedydwOojl9zAxlZ6QDyZstu5m0M27C6ZzyS2PWjXBSJrD0qQeMpkH7EA"

subDomain="atom"

function nullCheck(){
isnull=$(echo "$2" | xargs)
if [ -z "$isnull" ]; then
echo "$1 is empty"
exit 1
fi
}

function nullCheckForSite(){
isnull=$(echo "$2" | xargs)
if [ -z "$isnull" ]; then
echo "Site name is empty or null hence taking default site"
fi
}

function getDownloadUrl(){

api="https://api.superops.ai/msp/api"

url=$(curl --location --request POST "$api" \
--header "CustomerSubDomain: $subDomain" \
--header "Authorization: Bearer $apiToken" \
--header 'Content-Type: application/json' \
--data-raw '{"query":"query getInstallerInfo($input: InstallerInfoInput) {\n getInstallerInfo(input: $input) {\n id\n installerDownloadUrl\n installerName\n os\n }\n}","variables":{"input":{"clientName":"'"$clientName"'","siteName":"'"$siteName"'"}}}')|| {
echo $?
echo "Error while fetching download Url"
exit 1
}
downloadUrl=$(echo $url | grep -o '"installerDownloadUrl":"[^"]*"' | grep -o '[^"]*pkg"$' | sed 's/"//g')
echo "Download URL Fetched"

}

function downloadAndInstall(){

export baseName="$(basename $downloadUrl)"
curl -o /tmp/$baseName $downloadUrl
if [ $? -ne 0 ]; then
echo "Failed to download the pkg"
exit 1
fi
if [ -f "/tmp/$baseName" ]; then
echo "superops pkg downloaded successfully"
else
echo "Failed to download Superops pkg"
exit 1
fi

installer -pkg /tmp/$baseName -target /
if [ $? -ne 0 ]; then
echo "Failed to install superops"
exit 1
fi
echo "Installation Success"
rm -f /tmp/$baseName
}


#clientName="$1"
nullCheck "client name" $clientName

#siteName="$2"
nullCheckForSite "Site name" $siteName

#apitoken="$3"
nullCheck "api token" $apiToken

#domain="$4"
nullCheck "Domain name" $subDomain


getDownloadUrl
nullCheck "download Url" $downloadUrl


downloadAndInstall


For Linux

The syntax would look like this:

#!/bin/bash

# clientName="<client_name>"
# siteName="<site_name>"
# apiToken="<api_token>"
# subDomain="<sub_domain>"
#!/bin/bash


function nullCheck(){
isnull=$(echo "$2" | xargs)
if [ -z "$isnull" ]; then
echo "$1 is empty"
exit 1
fi
}

function nullCheckForSite(){
isnull=$(echo "$2" | xargs)
if [ -z "$isnull" ]; then
echo "Site name is empty or null hence taking default site"
fi
}

function getDownloadUrl(){

api="https://api.superops.ai/msp/api"

url=$(wget -qO- --method POST \
--timeout=0 \
--header "CustomerSubDomain: $subDomain" \
--header "Authorization: Bearer $apiToken" \
--header 'Content-Type: application/json' \
--body-data '{"query":"query getInstallerInfo($input:InstallerInfoInput){\r\n getInstallerInfo(input:$input){\r\n id\r\n installerDownloadUrl\r\n installerName\r\n os\r\n }\r\n}","variables":{"input":{"clientName":"'"$clientName"'","siteName":"'"$siteName"'"}}}' \
"$api")|| {
echo $?
echo "Error while fetching download Url"
exit 1
}
echo $url
downloadUrl=$(echo $url | grep -o '"installerDownloadUrl":"[^"]*"' | grep -o '[^"]*amd64"$' | sed 's/"//g')
echo "Download URL Fetched"

}

function downloadAndInstall(){

export baseName="$(basename $downloadUrl)"
#curl -o /tmp/$baseName $downloadUrl
wget $downloadUrl -O /tmp/$baseName
if [ $? -ne 0 ]; then
echo "Failed to download the installer"
exit 1
fi
if [ -f "/tmp/$baseName" ]; then
echo "superops installer downloaded successfully"
else
echo "Failed to download Superops installer"
exit 1
fi

#permission
chmod a+x /tmp/$baseName

#installation
/tmp/$baseName --quiet yes --AcceptLicense yes --verbose yes 2>&1 | tee /tmp/superopsInstallation.log

if [ $? -ne 0 ]; then
echo "Failed to install superops"
exit 1
fi
echo "Installation Success"
rm -f /tmp/$baseName
}


#clientName="$1"
nullCheck "client name" $clientName

#siteName="$2"
nullCheckForSite "Site name" $siteName

#apitoken="$3"
nullCheck "api token" $apiToken

#domain="$4"
nullCheck "Domain name" $subDomain


getDownloadUrl
nullCheck "download Url" $downloadUrl
echo $downloadUrl


downloadAndInstall

Here, you’ll need to uncomment the variables in the script and add the relevant values for these variables while executing the script. To uncomment variables in the script, remove the hashtag (#) that is included before the variable.

For example, in case the client name is Acme and the site name is New York, then the script to install will look like this,

#!/bin/bash

clientName="Acme"
siteName="New York"
apiToken="api-eyJhbGciOiJSUzI1NiJ9.eyJqdGkiOiI1MzIyNzUzNjg2NjAyMzAxNDQwIiwicmFuZG9taXplciI6Iu-_ve-_vVx1MDAxMu-_vXxFPXBA77-9In0.btt8Pmi2Q5fwURTcQjpu4vkOZ1ebCvo24kDA6ylNVAze9XdLvsukAQnyhlgnNQrjt2wfFtMYPsABBQieqfxuwhkoIMTu0bS1GD3cNJ0zIMWsxhiBedydwOojl9zAxlZ6QDyZstu5m0M27C6ZzyS2PWjXBSJrD0qQeMpkH7EA"
subDomain="atom"
#!/bin/bash


function nullCheck(){
isnull=$(echo "$2" | xargs)
if [ -z "$isnull" ]; then
echo "$1 is empty"
exit 1
fi
}

function nullCheckForSite(){
isnull=$(echo "$2" | xargs)
if [ -z "$isnull" ]; then
echo "Site name is empty or null hence taking default site"
fi
}

function getDownloadUrl(){

api="https://api.superops.ai/msp/api"

url=$(wget -qO- --method POST \
--timeout=0 \
--header "CustomerSubDomain: $subDomain" \
--header "Authorization: Bearer $apiToken" \
--header 'Content-Type: application/json' \
--body-data '{"query":"query getInstallerInfo($input:InstallerInfoInput){\r\n getInstallerInfo(input:$input){\r\n id\r\n installerDownloadUrl\r\n installerName\r\n os\r\n }\r\n}","variables":{"input":{"clientName":"'"$clientName"'","siteName":"'"$siteName"'"}}}' \
"$api")|| {
echo $?
echo "Error while fetching download Url"
exit 1
}
echo $url
downloadUrl=$(echo $url | grep -o '"installerDownloadUrl":"[^"]*"' | grep -o '[^"]*amd64"$' | sed 's/"//g')
echo "Download URL Fetched"

}

function downloadAndInstall(){

export baseName="$(basename $downloadUrl)"
#curl -o /tmp/$baseName $downloadUrl
wget $downloadUrl -O /tmp/$baseName
if [ $? -ne 0 ]; then
echo "Failed to download the installer"
exit 1
fi
if [ -f "/tmp/$baseName" ]; then
echo "superops installer downloaded successfully"
else
echo "Failed to download Superops installer"
exit 1
fi

#permission
chmod a+x /tmp/$baseName

#installation
/tmp/$baseName --quiet yes --AcceptLicense yes --verbose yes 2>&1 | tee /tmp/superopsInstallation.log

if [ $? -ne 0 ]; then
echo "Failed to install superops"
exit 1
fi
echo "Installation Success"
rm -f /tmp/$baseName
}


#clientName="$1"
nullCheck "client name" $clientName

#siteName="$2"
nullCheckForSite "Site name" $siteName

#apitoken="$3"
nullCheck "api token" $apiToken

#domain="$4"
nullCheck "Domain name" $subDomain


getDownloadUrl
nullCheck "download Url" $downloadUrl
echo $downloadUrl


downloadAndInstall

Did this answer your question?