Installing Agent Control Center Using PowerShell on Windows Server

PowerShell can be used to install the Agent Control Center on a Windows Server quickly and easily. First confirm that the prerequisite setup of the SQL Server 2016+ database is installed and ready for use. Once confirmed, simply execute the below Powershell commands step by step with Administrator privileges on the Windows Server to quickly get the Agent Control Center up and running.

1. Enable the Web Server (IIS) using PowerShell

Install-WindowsFeature -name Web-Server -IncludeManagementTools

2. Install the .NET Core 3 Hosting Bundle

Start-Process -FilePath "<dotnet-hosting.exe FILEPATH ON THE SERVER>" -ArgumentList "/silent" 

3. Running Agent Control Center Setup using PowerShell

Start-Process -FilePath "<AGENT CONTROL CENTER SETUP.EXE FILEPATH>" -ArgumentList "/silent"

Please note that the above command will install the Agent Control Center at the default installation path which is C:/AgentControlCenter. If you want to change the default installation path then you can use the below command to specify your desired location path for the Agent Control Center installation.

Start-Process -FilePath "<SETUP.EXE PATH>" -ArgumentList "/dir=<YOUR_DESIRED_PATH> /silent"

 

4. Add Agent Control Center Database and other configuration settings by sending a POST REST request using PowerShell

$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "Bearer <BEARER_TOKEN>")
$headers.Add("Content-Type", "application/json")

$body = "{`"url`":`"http://localhost:8010`",`"organizationName`":`"Sequentum`",`"rootUsername`":`"<ROOT_USERNAME>`",`"rootPassword`":`"<ROOT_PASSWORD>`",`"confirmRootPassword`":`"<ROOT_PASSWORD>`",`"databaseHost`":`"EC2AMAZ-2VA2TVO`\`\SQLEXPRESS`",`"databaseName`":`"AgentControlCenter`",`"isCreateDatabase`":true,`"isCreateTables`":true,`"isUpdateDatabase`":true,`"isTrusted`":false,`"databaseUsername`":`"sa`",`"databasePassword`":`"<DB_PASSWORD>`",`"isEmailEnabled`":true,`"emailHost`":`"<EMAIL_HOST>`",`"emailPort`":25,`"emailThresholdPerDay`":3000,`"emailsRemainingForTheDay`":0,`"emailLogRetention`":0,`"isEmailSsl`":false,`"emailUsername`":`"<EMAIL_USERNAME>`",`"emailPassword`":`"<EMAIL_PASSWORD>`",`"senderAddress`":`"<SENDER>@address`",`"isNew`":true,`"isMicrosoftEnabled`":false,`"microsoftTenantId`":`"`",`"microsoftClientId`":`"`",`"isGoogleEnabled`":false,`"googleClientId`":`"`",`"isDefaultKey`":true,`"hasKey`":false,`"key`":null}"
$response = Invoke-RestMethod 'http://localhost:8010/api/app-config' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json;

NOTE

Adding Agent Control Center configuration setting through Powershell request will need a <BEARER_TOKEN> which can be obtained by web request monitoring using the web browser tool to get the authorization bearer token.

Bearer-Token-Config.png


5. Add a Server to Agent Control Center by sending a POST REST request using PowerShell

$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "Bearer <BEARER_TOKEN>")
$headers.Add("Content-Type", "application/json")

$body = "{`"name`":`"<NAME OF THE SERVER>`",`"key`":`"<SEQUETUM ENTERPRISE SERVER LICENSE KEY>`",`"ipAddress`":`"127.0.0.1`",`"port`":8004,`"cpuThreshold`":`"90`",`"memoryThreshold`":90,`"sessionThreshold`":35,`"localPath`":`"C:/AgentControlCenter`",`"isDefaultLocalPath`":false,`"useSsl`":false}"

$response = Invoke-RestMethod 'http://localhost:8010/api/server' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json

NOTE

Adding a Server to Agent Control Center will need a <BEARER_TOKEN> which can be obtained by either logging into the Agent Control Center through the root user and then creating an Admin user to generate an API Access token. Once the Access key is copied, then add Super Admin or Server Admin privilege to the newly created user. Alternatively, you can get the access token by web request monitoring using the web browser tool to get the currently logged-in user bearer token.
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.