# Installers Installers ensure that endpoint-specific artifacts (e.g. database tables, queues, directories, etc.) are created and configured. ## When to run installers Installers require permissions to administer resources such as database tables, queues, or directories. Following the [principle of least privilege](https://en.wikipedia.org/wiki/Principle_of_least_privilege), it is recommended to run an endpoint with these elevated permissions only during initial deployment. The alternative to using installers is to create the required resources before the endpoint is run. This may also result in slightly faster startup times. The method of doing this varies for each transport or persistence package. For more information, see [operations](/nservicebus/operations/index.md). ## Auto-subscribe is not part of installers NServiceBus detects all events an endpoint handles and [auto-subscribes to these events at startup](/nservicebus/messaging/publish-subscribe/controlling-what-is-subscribed.md#automatic-subscriptions). Automatic subscriptions can be turned off by [disabling the auto subscribe feature](/nservicebus/messaging/publish-subscribe/controlling-what-is-subscribed.md#disabling-auto-subscription). ## Running installers during endpoint startup By default, installers are disabled. Installers can be enabled to always run at startup: ```cs endpointConfiguration.EnableInstallers(); // this will run the installers await Endpoint.Start(endpointConfiguration); ``` Installers may need to be run depending on the arguments that are provided to the host or aspects the environment the endpoint is hosted in. For example, installers can be enabled based on command line arguments: ```cs var runInstallers = Environment.GetCommandLineArgs().Any(x => string.Equals(x, "/runInstallers", StringComparison.OrdinalIgnoreCase)); if (runInstallers) { endpointConfiguration.EnableInstallers(); // This will run the installers but not start the instance. await Endpoint.Create(endpointConfiguration); Environment.Exit(0); } ``` They can also be enabled by a machine name convention: ```cs if (!Environment.MachineName.EndsWith("-PROD")) { endpointConfiguration.EnableInstallers(); } ``` > [!NOTE] > Some combinations of transports / persisters / DI containers may require `.Start` to be called instead of `.Create`. In this case call both `.Start` and `.Stop` and allow the endpoint to shutdown immediately after startup. ## Custom installers Implement the `INeedToInstallSomething` interface to create a custom installer: ```cs public class MyInstaller : INeedToInstallSomething { public Task Install(string identity) { // Code to install something return Task.CompletedTask; } } ``` ### Installer registration Assemblies in the runtime directory are scanned for installers so no code is needed to register them. > [!WARNING] > In a future version of NServiceBus, [installers will not be scanned and must be registered manually](/nservicebus/upgrades/9to10/index.md#extensibility-installers).