How To: Working with the K2 Server Service

This article describes how to work with the K2 Server service, including starting and stopping the service from MMC and by command-line, and how to update the service account credentials.

Bear in mind that stopping the K2 service will prevent workflows, SmartObjects, SmartForms and other K2 components from working. Take the necessary precautions when working with the K2 service in a production environment. 

Starting and stopping the K2 Server service with the Services application (MMC)

You may need to stop, start, or restart the K2 Server service. For example, you may have changed configuration settings and you need to restart the service for the change to take effect.

  1. Open the Microsoft Management Console (MMC), typically Start | Administrative Tools | Services or use the Run feature in windows to run services.msc
  2. Locate the K2 Server service. Select the service and click Stop to stop the service. Select the service and click Start to start the service. Select the service and click Restart to restart the service.MMC Services Console

Starting and stopping the K2 Server service by command-line

You may need to start or stop the K2 Server service using a command-line script. For example, you have created a batch file that runs in the background as a scheduled task for installing updates. To start the K2 service, use the following syntax:

net start "K2 Server"

To stop the K2 service, use the following syntax:

net stop "K2 Server"

To restart the service, use both "stop", then "start" commands.
Start and Stop Service

Running the K2 Server in console mode

You can run the K2 Server service in console mode, which displays a real-time list of actions running on behalf of the service. This can be useful when troubleshooting issues, especially those involving issues when starting the service, incorrect connection strings, or invalid authentication attempts.

To run the K2 server in console mode, first stop the service from either the MMC or using a command-line script, then start the console from the K2 Server (Service Account) link in your start menu.

  1. Open MMC and stop the K2 Server service.
  2. From your start menu, expand the K2 group. Click K2 Server (Service Account). This link starts the K2 Server service in console mode.
    K2 Server (Service Account)
    The K2 Server option will launch the K2 server in console mode using the account you are currently logged into windows with. This may or may not be what you intend. Typically, you would use the K2 Server (Service Account) option unless you specifically want to run the service with the account you are logged into windows with. Bear in mind that running the K2 service in an account other than the K2 service account may result in unexpected behavior. 
  3. The service is now running in console mode. Here, you can see each action performed on behalf of the service in real-time, including status codes, event IDs, and descriptions. If you need information on logging service activity, see Host Server Logging.
    Console Mode
    While the K2 Server (Service Account) shortcut will start the K2 service using the credentials of the account used to run the windows service, K2 recommends starting the K2 Server service in console mode while logged in as the K2 service account. This ensures that the windows session runs using the same credentials as the service and helps prevent skewed reports such as status, errors, or other issues. 

Updating K2 service credentials

You may need to change the K2 Server service account or password, for example your organization may have password policies that require changing of service account passwords at certain intervals. 

Changing the service account password requires an IIS reset which may cause interruptions to users of K2 and any other systems dependent on IIS. We recommend performing these actions during non-business hours.
Be sure to follow the steps below for updating the K2 Server service account credentials. The setup manager updates multiple files with the new account credentials. If you do not use the setup manager, you may run into errors down the road due to mismatched service account credentials.
  1. Run the K2 Setup Manager on the server hosting the K2 Server. You will find a link to the setup manager in your computer's start-up menu, in the K2 group.
    If you do not see a link to the K2 Setup Manager in the start menu, you can open the wizard from the default location: [Program Files (x86)]\K2\Setup\Setup.exe.
  2. When the wizard opens, select the Configure option and click Next.
    K2 Setup Manager - Configure
  3. Click Next to scroll through the wizard screens until you reach the Service Accounts Configuration screen.
  4. On the the Service Accounts Configuration screen, uncheck the Use Existing Credentials box, then enter the new name (including domain) and password. Click Test to confirm the account exists as entered.
    K2 Server (Service Account)
  5. Click Next to move through the wizard screens until you are on the Finished screen. Uncheck the Deploy K2 for SharePoint to your App Catalog option, and click Finish.
    Finish the Wizard
  6. Restart the K2 Server service.
  7. Run some basic tests in your K2 environment to validate that the environment is working as expected. 

If you change the K2 service account to a different account, bear in mind that other systems may need to be configured to allow the new K2 service account to work. For example, you may have a SQL Server Service instance that is configured to use the K2 Service account to log into a specific SQL database. If you change the K2 service account, you may need to set permissions and rights on the target SQL database to allow the new account to access the SQL database. Because these settings are environment-specific, you may need to do an impact analysis before changing the service account for the K2 service.