> ## 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.

# WdSetDefaultDevice

> WdSetDefaultDevice

Sets or clears the saved default device.

**Introduced in:** [RIT 0.0.14-preview](https://docs.xbox.com/reference/remoting/release-versions.md#release-versions).

## Syntax

```cpp theme={null}
HRESULT WD_REMOTE_ITERATION_CALL WdSetDefaultDevice(
    _In_opt_z_ const char* remoteDevice,
    _In_ bool createIfMissing
);
```

### Parameters

`remoteDevice`\
Type: **const char\***

The UTF-8 saved device name to select, or `nullptr` to clear the default when `createIfMissing` is false.

`createIfMissing`\
Type: **bool**

Whether to create a minimal record when selecting a device that isn't saved.

### Return value

Type: **HRESULT**

Returns `S_OK` on success; otherwise returns a failure HRESULT. Catalog operations also return catalog-specific errors described in [Error codes](https://docs.xbox.com/reference/remoting/error-codes.md).

## Remarks

Set `createIfMissing` to `true` to create a minimal record when needed. Otherwise a missing record returns `WD_E_DEVICE_NOTFOUND`. Pass `nullptr` and `false` to clear the default without removing the record. Don't issue competing default changes as if they were a cross-process transaction.

Saved-device APIs and pairing-ID APIs change different local stores. They don't replace the explicit `remoteDevice` argument of a remote API call; callers that want default selection must resolve it themselves.

## Requirements

| Requirement | Value |
| - | - |
| **Header** | WdRemoteIteration.h |
| **Library** | wdremoteapi.lib |
| **NuGet Package** | [Microsoft.GDK.RemoteIterationClientApi](https://aka.ms/GameDevRemoteAPI) |

## See also

* [XBOX PC Remote Iteration API](https://docs.xbox.com/reference/remoting/remoteiteration_members.md)


## Related topics

- [XBOX PC Remote Iteration API](https://docs.xbox.com/reference/remoting/remoteiteration_members.md)
- [WdSetDevice](https://docs.xbox.com/reference/remoting/functions/wdsetdevice.md)
- [WdGetDefaultDevice](https://docs.xbox.com/reference/remoting/functions/wdgetdefaultdevice.md)
- [WdSetDeviceProperty](https://docs.xbox.com/reference/remoting/functions/wdsetdeviceproperty.md)
- [WdGetDeviceProperty](https://docs.xbox.com/reference/remoting/functions/wdgetdeviceproperty.md)
