Skip to main content

How to Script the Server Manager from the Command Line

Adding, changing, testing and removing a company, and moving companies onto the installed service software, can also be done from an elevated command prompt, for unattended or scripted installations. Start, Stop, Restart, Update now, Apply at... and Open logs have no command and are done in the ABM Service Server Manager window. The same program, ABM.Service.Server.Manager.exe in the Manager folder of the server's program folder, runs the same steps as the window when it is given a command, and prints what it did instead of showing it.

How do I add a company to ABM Service Server from a script?​

Run the server manager with add, the company's service name, and both connection strings, from an elevated command prompt. It prints each step and ends with the service name and is running on port followed by the port.

ABM.Service.Server.Manager.exe add /instance:<name> /connection:"<company database connection string>" /control:"<ABMControl connection string>" /site:"<display name>" /port:<port> /quiet
  • /instance: is required: the company's name on this server, the same as Service name in the Add a company window, with the same rules.
  • /connection: is required: the company database's SQL Server connection string. It must use a SQL Server login and password; Windows authentication is refused, as in the window. A string the command cannot read at all is refused with That is not a usable connection string: and the reason.
  • /control: is required: the connection string for ABM's control database.
  • /site: is optional: the display name, the same as Display name in the Add a company window and in Settings....
  • /port: is optional: without it the lowest free port from 5080 upwards is used. A port another company has is refused.
  • /database: is optional: the database name shown on the company's line in the manager.
  • /bind: is optional and not in the command's own help: /bind:127.0.0.1 makes the company answer only on the server itself, for a reverse proxy there. Do not give it one of the server's network addresses: the company checks itself at 127.0.0.1, so it fails that check and its web server keeps being restarted. Neither Settings... nor the set command can change the address later; How the Web Address and the Databases Are Connected says how it is changed by hand.

Before creating anything, add tests both connections exactly as Test does in the window, and stops with the same sentences if either fails. The control database's sentence starts ABM control database: so you can tell which connection it is about.

Run it from the program's own folder, or give its full path. The server manager is a Windows program, not a console one, so a command prompt does not wait for it: run it with start /wait in the Command Prompt, or with Start-Process and -Wait -PassThru in PowerShell, which is how the ABM Service Server setup runs it, to wait for it and read its exit code. Close the ABM Service Server Manager window first: while the window or a setup is open, every command except version waits up to two minutes and then stops with An ABM Service Server setup is running; try again when it has finished., even when it is the window that is open.

How do I change or test a company's connections from a script?​

Use set to change an existing company and test to check a connection without changing anything. Both run from an elevated command prompt.

ABM.Service.Server.Manager.exe set /instance:<name> /port:<port> /site:"<display name>" /connection:"<connection string>" /control:"<connection string>"
ABM.Service.Server.Manager.exe test /connection:"<connection string>" /control:"<connection string>"
  • set needs /instance: and changes only what you give it: leave an option out to keep what the company has. It tests any new connection first, rights included, then restarts the company's Windows service and prints was reconfigured and restarted. A company that has no control database connection yet is refused until you give it /control:.
  • test needs /connection:, /control: or both, and prints one verdict line for each, the same sentences as the window's Test. A connection that passes prints The database answered, and it looks like an ABM database. or ABM control database: answered, and it looks like ABM's control database.; one whose login lacks a right names the rights it lacks.

A new password is given by passing the whole connection string again with the new password in it.

What SQL login do the server manager's commands need?​

The commands of ABM.Service.Server.Manager.exe do not make SQL logins: the login in each connection string you give add, set or test must already exist and have every right ABM Service needs, the same ones as the login the Add a company window makes. In the company database that is reading and writing its tables, adding ABM Service's own tables and indexes, and running ABM's procedures; in the control database, reading UserList, CompanyList, ABMFlex and Settings.

The test each command runs checks every one of those rights. A login that can sign in but lacks one is refused, and nothing is created or changed, with Connected to the database, but this login cannot do everything it needs: followed by the rights it lacks, then Give this login the missing right: running the login script again does it, or ask whoever looks after SQL Server. For the control database the line starts ABM control database:.

The login the Add a company window makes, with Set it up for me or Copy script, has every one of them; How to Add a Company in the Server Manager describes it in full, roles included, so a database administrator can give a login of your own the same.

How do I remove a company or move companies onto new service software from a script?​

Use remove to delete a company and upgrade to move every company onto the service software that matches the installed server manager.

ABM.Service.Server.Manager.exe remove /instance:<name> /quiet
ABM.Service.Server.Manager.exe upgrade
ABM.Service.Server.Manager.exe version
  • remove deletes the company's Windows service, firewall rule, Apps & Features entry and folder, and prints was removed. Without /quiet it asks for confirmation in a window, as the company's Apps & Features entry does; answering No changes nothing and still exits with 0. A name that is not a company prints is not a company on this machine. The database is not touched.
  • upgrade is what the ABM Service Server setup runs itself, and the same as Update launchers in the window: it stops every company, moves it, starts it again and checks it. It prints Every company already runs the server software and the version when there is nothing to do. Run it at the server's own desktop, in person or through Remote Desktop, or as SYSTEM from a scheduled task, never from SSH or PowerShell remoting: from a remote session it cannot hear the companies answer, prints that they did not answer with the server software within 60 seconds, and puts every company back, though they are healthy.
  • version prints the installed ABM Service Server version.

What do the server manager's exit codes mean?​

Every command ends with an exit code a script can test: 0 when it did what was asked, 1 when it was refused, failed or was undone, and, for upgrade only, 3 when the companies were moved but at least one is not serving yet.

  • 0: done. For test, every connection given passed.
  • 1: refused, failed, or undone. The last lines printed say why. For upgrade, 1 means every company was put back on the previous service software.
  • 3: upgrade moved every company, but a company's web server did not come back within 90 seconds. The previous service software is kept on the server; read the named company's logs.

After exit 3 the command's last line says the server manager can put the companies back on the previous software, but the window offers that only straight after an Update launchers it ran itself. To go back after a scripted upgrade, run the previous version's ABM Service Server setup and answer Yes when it asks to install the older version over the newer one (or pass /downgrade with /quiet): it moves every company back onto the service software it kept.

Everything the commands print is also added to manager.log in C:\ProgramData\ABM Service\Server\logs, with the time, because a command run by a scheduled task or a deployment tool has nowhere else to show it. An unknown option prints the commands and their options, and an unknown command prints the list of commands; both exit with 1 and, unlike everything else, are not added to manager.log.

Note: Before add, set, remove or upgrade does anything, it finishes or undoes whatever an interrupted manager or setup left behind, and prints what it did.