Automating with Windows Task

Running Commander CLI commands using Windows Task automation

To set up a scheduled task in Windows to run a specific Keeper Commander CLI command on a scheduled basis, you can use the Task Scheduler tool.

In the below example, we'll re-generate a password in the vault on a daily basis.

Prerequisites:

(1) Install

Install Keeper Commander for Windows

(2) Login

Login to Commander by launching the application. For example:

server US
login email@company.com

(3) Enable persistent login

After login, set up persistent login so that the command can execute from Task Scheduler

As an example, the below commands will enable "Stay Logged In" for 30 days:

this-device register
this-device persistent-login on
this-device ip-auto-approve on
this-device timeout 30d
quit

To exit the shell session, type quit but don't type logout. Logout will expire the session and the automations won't work.

To confirm that persistent login is working, execute Commander again and it will automatically login to the shell.

(4) Create a record

From the command line, we'll create a quick record with a random password.

record-add -t "Test Record" password=$GEN --record-type=login

If you have the web vault or other Keeper vault opened, you'll see the record appear.

(5) Open Task Scheduler

  • Press Win + R to open the Run dialog.

  • Type taskschd.msc and press Enter. This opens the Task Scheduler.

(6) Create a New Basic Task

  • In the Task Scheduler, click on the "Create Basic Task..." option on the right side.

  • Enter a name and description for your task, such as "Daily Keeper Commander Task".

  • Click Next.

(7) Set the Trigger

  • Choose the "Daily" option and click Next.

  • Set the start date and time for the task to run. Ensure the recurrence is set to "1 day" to repeat the task daily.

  • Click Next.

(8) Set the Action

  • Choose the "Start a program" option and click Next.

  • In the "Program/script" field, enter the path to your Keeper Commander executable, for example:

"C:\Program Files (x86)\Keeper Commander\keeper-commander.exe"
  • In the "Add arguments (optional)" field, enter your Keeper Commander CLI command. For example:

record-update -r "Test Record" password=$GEN

(9) Finish the Task

  • Click Next to review the details of your task.

  • Click Finish to create the task.

(10) Execute

  • To make sure the command works, select the Task and click "Run" on the right side.

Summary

In this particular example, the password will rotate from the Keeper vault and you'll see this occur in realtime across all logged-in vault clients. Another example is running a security audit report, such as:

security-audit-report --output c:\path\to\file

Any feature or capability of the end-user vault or Admin Console can be automated this way. Take a look at all the Keeper Commander commands available.

To expand upon this use case, you would likely want to set up a Batch file and execute the batch of commands instead of adding them directly on the CLI arguments. More information about batch mode commands can be found here.

Last updated