> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AddConsole

> IXtfConsoleManager::AddConsole method

Adds a development console to the [IXtfConsoleManager](https://docs.xbox.com/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManager/ixtfconsolemanager-xtfconsolemanager-xbox-microsoft-t.md) instance.

## Syntax

```cpp theme={null}
public:
HRESULT AddConsole(
         LPCWSTR pszAlias,
         LPCWSTR pszAddress,
         XTF_ADD_CONSOLE_FLAGS dwFlags
)  
```

### Parameters

*pszAlias*\
Type: LPCWSTR

A pointer to the name of the console to add.

*pszAddress*\
Type: LPCWSTR

A pointer to the Tools IP address of the console to add.

*dwFlags*\
Type: XTF\_ADD\_CONSOLE\_FLAGS

A combination of bitwise-OR flags that specify how to add the console to the instance. The following table describes the available flags.

| Value | Macro | Description |
| - | - | - |
| 0x0 | XTF\_ADD\_CONSOLE\_FLAGS\_NONE | No flags are specified. |
| 0x1 | XTF\_ADD\_CONSOLE\_FLAGS\_SETDEFAULT | After the development console is added, set it as the default development console for this PC. |

### Return value

Type: HRESULT

Returns `S_OK` if successful; otherwise, returns an HRESULT error code.

## Remarks

This method adds the development console specified in `pszAddress`, using the name specified in `pszAlias`, to the [IXtfConsoleManager](https://docs.xbox.com/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManager/ixtfconsolemanager-xtfconsolemanager-xbox-microsoft-t.md) instance. If `XTF_ADD_CONSOLE_FLAGS_SETDEFAULT` is specified in `dwFlags`, the development console is also set as the default development console for this PC. For more information about the default development console, see [IXtfConsoleManager::SetDefaultConsole Method](https://docs.xbox.com/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManager/methods/setdefaultconsole-ixtfconsolemanager-xtfconsolemanager-xbox-microsoft-m.md).

After this method is successfully called, the `IXtfConsoleManager` instance invokes the [OnAddConsole](https://docs.xbox.com/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManagerCallback/methods/onaddconsole-ixtfconsolemanagercallback-xtfconsolemanager-xbox-microsoft.md) callback method from the associated [IXtfConsoleManagerCallback](https://docs.xbox.com/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManagerCallback/ixtfconsolemanagercallback-xtfconsolemanager-xbox-microsoft-t.md) instance. If `XTF_ADD_CONSOLE_FLAGS_SETDEFAULT` is specified in `dwFlags`, the [OnChangedDefaultConsole](https://docs.xbox.com/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManagerCallback/methods/onchangeddefaultconsole-ixtfconsolemanagercallback-xtfconsolemanager-xbox.md) callback method from the associated `IXtfConsoleManagerCallback` instance is also invoked.

For more information about connecting and querying development consoles, see [Connect (xbconnect.exe) (NDA topic)](https://docs.xbox.com/tools/tools-console/commandlinetools/xbconnect.md).

## Requirements

**Header:** xtfconsolemanager.h

**Library:** xtfconsolemanager.lib

**Supported platforms:** Windows (for XBOX console tools)

## See also

[IXtfConsoleManager::GetConsole Method](https://docs.xbox.com/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManager/methods/getconsole-ixtfconsolemanager-xtfconsolemanager-xbox-microsoft-m.md)\
[IXtfConsoleManager::RemoveConsole Method](https://docs.xbox.com/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManager/methods/removeconsole-ixtfconsolemanager-xtfconsolemanager-xbox-microsoft-m.md)\
[IXtfConsoleManager Interface](https://docs.xbox.com/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManager/ixtfconsolemanager-xtfconsolemanager-xbox-microsoft-t.md)\
[XtfConsoleManager](https://docs.xbox.com/reference/tools/xtf/xtfconsolemanager/xtfconsolemanager-xbox-microsoft-n.md)


## Related topics

- [OnAddConsole](https://docs.xbox.com/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManagerCallback/methods/onaddconsole-ixtfconsolemanagercallback-xtfconsolemanager-xbox-microsoft.md)
- [OnChangedDefaultConsole](https://docs.xbox.com/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManagerCallback/methods/onchangeddefaultconsole-ixtfconsolemanagercallback-xtfconsolemanager-xbox.md)
- [IXtfConsoleManager Interface (Interface contents)](https://docs.xbox.com/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManager/ixtfconsolemanager-xtfconsolemanager-xbox-microsoft-t.md)
- [XBOX Manager: managing consoles and groups](https://docs.xbox.com/tools/tools-console/xbom/manager-tool-groups.md)
- [AddUser](https://docs.xbox.com/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/adduser-ixtfuserclient-xtfuser-xbox-windows-m.md)
