<developers/>

The stackregent.exe command line

stackregent.exe is the panel itself and its toolbox. Run it on the server to call the API locally, get back in after a lockout, change ports, set the license and run panel tasks.

Last changed 13 Nov 2026

Where stackregent.exe is and how to run it#

stackregent.exe is in the bin folder of the installation, normally:

C:\Program Files\StackRegent\bin\stackregent.exe

Run it in a command prompt or PowerShell opened with Run as administrator on the server. The folder is not on the PATH, so change into it or call it by full path:

cd 'C:\Program Files\StackRegent\bin'
.\stackregent version

Most commands read the panel configuration from the installation folder and open the panel database directly, so they work even when the web service is stopped. The exceptions are api, which talks to the running panel over HTTPS, and the task commands (website-apply, run-task, site-run), which need the StackRegentTask service to run the task.

Exit codes#

CodeMeaning
0The command finished. For task commands, check the last line of the output: it is success or failure.
1The command failed. The reason is printed after error:. For api, an HTTP status of 400 or above also gives 1, after the answer is printed.
2The command or its options were not understood; the usage line is printed.

stackregent.exe command line reference#

CommandWhat it does
stackregent versionPrints the version. --version and -v do the same.
stackregent api METHOD /api/PATH [JSON or @file]Calls the REST API as the main administrator and prints the answer
stackregent admin-password [-login NAME]Sets a new random password for an administrator and prints it
stackregent admin-add LOGINAdds a support administrator and prints its password once
stackregent admin-remove LOGINRemoves an administrator (not the main one)
stackregent sessions-purgeLogs everyone out of the panel
stackregent ip-access-resetLets administrators log in from any address again
stackregent firewall-resetTurns off Panic Mode and access limits and disables your own firewall rules
stackregent panel-url-resetClears Customize Panel URL
stackregent panel-port HTTPS [HTTP]Moves the panel to other ports
stackregent license-set [KEY]Saves a license key and checks it
stackregent license-checkChecks the license now
stackregent website-apply DOMAINApplies one website's hosting settings again
stackregent run-task KIND [JSON or @file]Queues a panel task, waits for it and prints its log
stackregent site-run ID PROGRAM [ARGS...]Runs a program as a website's subscription user
stackregent dkim-verify FILE [DNS-SERVER]Checks the DKIM signatures of a saved message
stackregent defender-excludeAdds Microsoft Defender exclusions for the panel's database folders
stackregent migration-agent [options]On a Plesk for Windows server: lets a StackRegent server migrate from it

api: call the REST API on the server#

stackregent api GET /api/subscriptions
stackregent api GET "/api/subscriptions?q=example.com"
stackregent api POST /api/subscriptions/12/status '{"status":"suspended"}'
stackregent api PUT /api/subscriptions/12/plan @plan.json
stackregent api DELETE /api/domains/31

The method is GET, POST, PUT or DELETE, and the path must start with /api/. For POST and PUT, add the JSON body as the third argument, or @file.json to read it from a file. Use a file from Windows PowerShell 5.1, which mangles quotes inside arguments passed to programs; a byte order mark at the start of the file is ignored.

For each call, the command creates a key for the main administrator that works only from 127.0.0.1 and ::1, lasts one minute and is deleted after the call. It connects to https://127.0.0.1 on the panel's configured HTTPS port, so it keeps working after panel-port and with a self-signed certificate. JSON answers are printed indented, and a call may take up to 10 minutes. The endpoints and fields are the same as over the network; see the REST API reference.

admin-password: reset an administrator's password#

stackregent admin-password
stackregent admin-password -login support1

Without -login, it resets admin. It prints the new password, turns off two-step sign-in for that administrator, closes their sessions and clears their failed-login counter. Turn two-step sign-in on again under Profile after logging in.

admin-add and admin-remove#

stackregent admin-add support1
stackregent admin-remove support1

admin-add creates a support administrator with a random 16-character password and prints it once. The login is stored in lower case and must not exist already. admin-remove deletes the administrator and their sessions; the main administrator cannot be removed.

Recovery after a lockout#

These undo a lockout without a browser:

  • sessions-purge closes every panel session and prints how many were closed.
  • ip-access-reset removes the administrator IP access restriction after it locks you out.
  • firewall-reset turns off Panic Mode and access limits and disables your own firewall rules.
  • panel-url-reset clears Customize Panel URL, so the panel answers on every host name again.

panel-port: move the panel to other ports#

stackregent panel-port 8443
stackregent panel-port 8443 8080

Both ports must be between 1024 and 65535, different from each other, and not one of the ports used by websites (80, 443), website preview (9444), FTP (21), mail (25), DNS (53), MariaDB (3306), SQL Server (1433) or the panel database. The command checks that the ports are free, saves them, replaces the StackRegent panel rules in Windows Firewall and restarts the panel service. Without the second argument the HTTP port stays as it is. Open the new port in any provider firewall too, and update the port in a custom panel URL if you use one.

license-set and license-check#

stackregent license-set SR-XXXXX-XXXXX-XXXXX-XXXXX

$env:STACKREGENT_LICENSE_KEY = 'SR-XXXXX-XXXXX-XXXXX-XXXXX'
stackregent license-set
Remove-Item Env:STACKREGENT_LICENSE_KEY

stackregent license-check

license-set saves the key and checks it with the license server at once. If you leave out the argument, the key is read from STACKREGENT_LICENSE_KEY, which keeps it out of command histories and transcripts; the installer uses it that way. license-check checks the saved key again. Both print a line such as Licence: licensed. ..., where the state is licensed, grace or restricted, followed by the license server's message. They wait up to 30 seconds for the license server.

website-apply: apply a website's settings again#

stackregent website-apply example.com

Queues the task that writes one website's IIS and hosting settings again, waits up to five minutes, and prints the task log followed by success or failure. Use it after something was changed by hand in IIS Manager, or to see exactly where a website's configuration fails.

run-task: queue a panel task#

stackregent run-task update.check
stackregent run-task component.install @component.json

Queues a task of the given kind with optional JSON parameters (inline or from @file), waits up to 10 minutes and prints the log followed by success or failure. The installer uses it to set up hosting components, with a file such as:

{"id":"git","key":""}

Component IDs are listed under Tools & Settings › Server Components and on the install script page. Other task kinds take parameters that are internal to the panel; prefer the REST API for anything it covers.

site-run: run a program as the subscription user#

stackregent site-run 31 whoami

ID is the domain's ID (from GET /api/domains). The task service runs the program as the Windows user of that website's subscription, so it sees exactly the permissions the website has. The output and success or failure are printed; the command waits up to 15 minutes.

dkim-verify: check a message's DKIM signatures#

stackregent dkim-verify C:\temp\message.eml
stackregent dkim-verify C:\temp\message.eml 1.1.1.1

Checks the DKIM signatures in a saved message, looking up the public keys in DNS, optionally through the DNS server you name.

defender-exclude#

Adds Microsoft Defender exclusions for the panel's database folders and prints the result. Run it again if a policy removed them.

Migration agent options#

migration-agent runs on a Plesk for Windows server, from a copy of stackregent.exe taken from the bin folder of the StackRegent package, so that a StackRegent server can migrate accounts from it over HTTPS.

stackregent migration-agent --allow 203.0.113.50
stackregent migration-agent --allow 203.0.113.50,198.51.100.0/24 --port 9445 --key MY-FIXED-KEY
OptionDefaultMeaning
--allownoneIP addresses or networks of the new server, comma-separated
--port9445HTTPS port the agent listens on
--keya new key each startA fixed key to keep across restarts
--confignoneRuns the background agent from its settings file (used by the StackRegent Migrator extension for Plesk)

The agent uses a self-signed certificate and prints its SHA-256 fingerprint, so you can compare it when the new server connects. It runs until you press Ctrl+C. The Plesk extension controls its background agent with migration-agent-ctl. See the migration chapter of the administrator guide.

Commands used by the installer and the services#

These exist for the installer, the Windows services and support. You normally do not run them yourself; to repair or upgrade an installation, run the installer again.

CommandUsed byWhat it does
webService StackRegentRuns the panel web server
taskService StackRegentTaskRuns the task runner and scheduler
guardService StackRegentGuardRuns the brute-force guard
spamdService StackRegentSpamd (SpamAssassin component)Runs the spam filter service
setup [options]install.ps1First-time configuration (see below)
migrateinstall.ps1Updates the panel database schema
service-install, service-removeinstall.ps1Registers or removes the Windows services
service-restart NAMEPanel tasksRestarts one service after a short pause
mail-pickupMailEnableSigns outgoing mail with DKIM
user-op, monitor-test, git-selftest, safefs-testPanel internals and supportInternal operations and self-tests

setup options#

setup writes the configuration, creates the panel database schema and, on the first run only, creates the admin account and prints ADMIN_LOGIN=admin and ADMIN_PASSWORD=.... On later runs it leaves the password alone.

OptionDefaultMeaning
--dirThe folder above binInstallation folder
--db-passSTACKREGENT_DB_PASSPassword of the panel database user (required)
--db-port8306Panel database port
--admin-emailemptyAdministrator email address
--hostnameemptyPanel host name
--https-port9443Panel HTTPS port
--http-port9080Panel HTTP port, which redirects to HTTPS

Use the install script rather than calling setup yourself; the script also prepares the database, services and firewall.

Frequently asked questions

Where is stackregent.exe installed?

In the bin folder of the installation, normally C:\Program Files\StackRegent\bin. Run it from an elevated command prompt or PowerShell on the server.

How do I reset the StackRegent admin password from the command line?

Run stackregent admin-password in an elevated prompt on the server. It prints a new password for admin, turns off two-step sign-in for that account and closes its sessions. Add -login NAME for another administrator.

I locked myself out with IP access restriction. How do I get back in?

Run stackregent ip-access-reset on the server. If the firewall is the problem, stackregent firewall-reset turns off Panic Mode and access limits; if a custom panel URL is, stackregent panel-url-reset clears it.

How do I change the StackRegent panel port?

Run stackregent panel-port with the new HTTPS port and optionally the HTTP port, for example stackregent panel-port 8443 8080. It checks the ports, updates Windows Firewall and restarts the panel.

Does stackregent api need an API key?

No. It makes a one-minute key for the main administrator that works only from the server itself, and deletes it after the call.

Why does stackregent api fail to connect?

It calls the running panel on 127.0.0.1. Check that the StackRegent service is running, for example in the Service Monitor or with Get-Service StackRegent.

How do I pass JSON to stackregent from PowerShell 5.1?

Save the JSON in a file and pass @file.json. Windows PowerShell 5.1 changes quotes inside arguments, which breaks inline JSON.