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

# WdSetDevice

> WdSetDevice

Adds or updates a saved device record.

**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 WdSetDevice(
    _In_z_ const char* remoteDevice,
    _In_opt_z_ const char* publicKeyHash
);
```

### Parameters

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

The saved device name or IP address, encoded as UTF-8. This operation acts on the current user's local catalog.

`publicKeyHash`\
Type: **const char\***

The last-observed pairing device ID, or `nullptr` to clear it. This value isn't authorization.

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

Preserves application-owned metadata. The first device recorded in an empty catalog becomes the default. `publicKeyHash` is a last-observed 40-character hexadecimal pairing device ID; pass `nullptr` to clear it. An empty or malformed hash returns `E_INVALIDARG`.

Saving a record doesn't pair the device, verify its current identity, or grant access.

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)
- [WdSetDeviceProperty](https://docs.xbox.com/reference/remoting/functions/wdsetdeviceproperty.md)
- [WdSetDefaultDevice](https://docs.xbox.com/reference/remoting/functions/wdsetdefaultdevice.md)
- [WdGetDeviceProperty](https://docs.xbox.com/reference/remoting/functions/wdgetdeviceproperty.md)
- [WdGetDefaultDevice](https://docs.xbox.com/reference/remoting/functions/wdgetdefaultdevice.md)
