---
title: "How can I capture the username when running a command?"
description: "Capturing the username when running a command in Geneos requires using a client-side xpath argument /geneos/client/runtimeParameters/@Username. This method works only for commands executed interactively in the Active Console, and background actions have no Username defined."
url: "https://docs.itrsgroup.com/docs/faq/geneos/115004021845-geneos-how-can-i-capture-the-username-when-running-a-command/index.html"
---
There is a special client-side xpath in a command that gives the user name.

1. Create a xpath argument to the command like this:
   */geneos/client/runtimeParameters/@Username*

2. Use parameters inside your command script, such as "$1", to capture the parameter in your code

This only works when the command is executed interactively in a Geneos user interface component such as the Active Console. When a command is run as part of a background action then no Username is defined and this situation should be tested for in your external script(s).


