# Scripting (2.x)

How to automate KeePass 2.x.

In order to automate KeePass, you need either the KPScript tool or PowerShell.

- You can find the latest version of KPScript on the KeePass plugins page. The `KPScript.exe` file needs to be copied into the directory where KeePass is installed (which contains the `KeePass.exe` file).
- A suitable PowerShell version is included in Windows 10/11. On other operating systems, you may need to install it first.

There are three ways to automate KeePass:

- KPScript - Single Command Operations:
  KPScript can be invoked using single commands. By passing the database location, its key, a command and eventually some parameters, simple operations like adding an entry can be performed. The syntax is very simple, no scripting knowledge is required. This method is ideal when you quickly want to do some small changes to the database. It is not recommended when you need to perform many operations, because for each command the database needs to be loaded from file, decrypted, modified, encrypted and written back to file.
- KPScript - KPS Script Files:
  These files are a lot more powerful than single command operations, but are also more complicated. You need to have experience in C# programming and the KeePass 2.x internals.
- PowerShell:
  With PowerShell, you can load the `KeePass.exe` assembly and do everything that KeePass can do.
  Download KeePass example PowerShell scripts.