# This Device Commands

### Overview

This page provides documentation related to functionalities of keeper which can be done related to the currently logged in device. enabling some of these functionalities helps with easing of logging in process and other useful functionalities from next login.

The following commands are supported

* Device Information Command
* Device Register Command
* Device Persistent Login Command
* Set Device Logout Timer Command
* Device Rename Command
* Device IP AutoApprove Command
* Device-Yubikey Relation Command

### Device Information Command

This command informs of the current device and helps setting device controls for login support.

<details>

<summary>DotNet CLI</summary>

**Command:** `this-device`

**Example:**

```
My Vault> this-device

         Device Name: PowerShell Commander
      Client Version: Commander 17.0.0
    Data Key Present: True
     IP Auto Approve: True
    Persistent Login: False
      Logout Timeout: 1 hour(s)
     Biometric Login: False

Available sub-commands: rename, register, persistent_login, ip_disable_auto_approve, timeout, bio
```

</details>

<details>

<summary>DotNet SDK</summary>

Not Available

</details>

<details>

<summary>PowerCommander</summary>

**Command**: `Get-KeeperDeviceSettings`

**Aliases:** `this-device`

**Syntax:**

```powershell
Get-KeeperDeviceSettings [<CommonParameters>]
```

**Examples:**

```powershell
PS> Get-KeeperDeviceSettings

DeviceName          : PowerShell Commander
PersistentLogin     : False
DataKeyPresent      : True
IpAutoApprove       : True
IsSsoUser           : False
DeviceLogoutTimeout : 60 minute(s)
```

</details>

<details>

<summary>Python CLI</summary>

**Command:** `this-device`&#x20;

**Example:**

```sh
My Vault> this-device
          Device Name  Python Keeper API
     Data Key Present  False
      IP Auto Approve  True
     Persistent Login  False
Device Logout Timeout  30 days
          Is SSO User  False
```

</details>

<details>

<summary>Python SDK</summary>

**Function:** `load_account_summary`

```python
keeper_auth.load_account_summary(auth_context)
```

</details>

### Device Register Command

This command is used to encrypts the user's data key with the device public key in order to utilize persistent login sessions

<details>

<summary>DotNet CLI</summary>

**Command:** `this-device register`

**Example:**

```
My Vault> this-device register
Device already registered.
```

</details>

<details>

<summary>DotNet SDK</summary>

**Function:** `RegisterDataKeyForDevice`

```csharp
public static async Task RegisterDataKeyForDevice(this IAuthentication auth, DeviceInfo device)
```

**Example:**

```csharp
// assuming device is DeviceInfo object
if (!device.EncryptedDataKeyPresent)
{
    await _auth.RegisterDataKeyForDevice(device);
}
```

</details>

<details>

<summary>PowerCommander</summary>

**Command**: `Set-KeeperDeviceSettings`

**Parameters:**

* `-Register` - Register

**Syntax:**

```powershell
Set-KeeperDeviceSettings -Register
```

</details>

<details>

<summary>Python CLI</summary>

**Command:** `this-device register`&#x20;

**Flags:** NA

**Example:**

```sh
My Vault> this-device register
Successfully registered device
```

</details>

<details>

<summary>Python SDK</summary>

**Function:** `register_data_key_for_device`

```python
keeper_auth.register_data_key_for_device(auth_context)
```

</details>

### Device Persistent Login Commandthis-device persistent-login

Use this command to turn on or off the "Stay Logged In" setting for your account

<details>

<summary>DotNet CLI</summary>

**Command:** `this-device persistent_login`

**Example:**

```bash
My Vault> this-device persistent_login ON

My Vault> this-device persistent_login OFF
```

</details>

<details>

<summary>DotNet SDK</summary>

**Command:** `SetSessionParameter`

```csharp
public static async Task SetSessionParameter(this IAuthentication auth, string name, string value)
```

**Example:**

```csharp
await _auth.SetSessionParameter("this-device", "1");
```

</details>

<details>

<summary>PowerCommander</summary>

**Command**: `Set-KeeperDeviceSettings`

**Parameters:**

* `-PersistentLogin` - Enable/disable persistent login

**Examples:**

```powershell
Set-KeeperDeviceSettings -PersistentLogin $true
```

</details>

<details>

<summary>Python CLI</summary>

**Command:** `this-device persistent-login`

**Flags:** NA

**Example:**

```sh
My Vault> this-device persistent-login on
Successfully ENABLED Persistent Login on this account
```

</details>

<details>

<summary>Python SDK</summary>

**Function:** `set_user_setting`

```python
keeper_auth.set_user_setting(auth_context, 'persistent_login', '1')
```

</details>

### Set Device Logout Timer Command

Use this command to set inactivity duration before automatic logout. Default unit is minutes (can be set to hours or days by appending "h" or "d", respectively).

<details>

<summary>DotNet CLI</summary>

**Command:** `this-device timeout`

**Example:**

```bash
My Vault> this-device timeout 200 
```

</details>

<details>

<summary>DotNet SDK</summary>

**Function:** `SetSessionParameter`

```csharp
public static async Task SetSessionParameter(this IAuthentication auth, string name, string value)
```

**Example:**

```
await _auth.SetSessionInactivityTimeout(200);
```

</details>

<details>

<summary>PowerCommander</summary>

**Command**: `Set-KeeperDeviceSettings`

**Parameters:**

* `-Timeout` - Session timeout in minutes

**Example:**

```powershell
Set-KeeperDeviceSettings -Timeout 30
```

</details>

<details>

<summary>Python CLI</summary>

**Command:** `this-device timeout`

**Flags:** NA

**Example:**

```sh
My Vault> this-device timeout 30d
Successfully set "logout_timer" to 30 days.
```

</details>

<details>

<summary>Python SDK</summary>

**Function:** `set_user_setting`

```
keeper_auth.set_user_setting(auth_context, 'logout_timer', str(timeout_in_minutes))
```

</details>

### Device Rename Command

Use this command to change the name of the device

<details>

<summary>DotNet CLI</summary>

**Command:** `this-device rename <NewNameHere>`&#x20;

**Example:**

```bash
My Vault> this-device

         Device Name: MacKeeper
      Client Version: Commander 17.0.0
    Data Key Present: True
     IP Auto Approve: True
    Persistent Login: False
      Logout Timeout: 3.3333333333333335 hour(s)
     Biometric Login: False

Available sub-commands: rename, register, persistent_login, ip_disable_auto_approve, timeout, bio

My Vault> this-device rename NewMacKeeper

My Vault> this-device

         Device Name: NewMacKeeper
      Client Version: Commander 17.0.0
    Data Key Present: True
     IP Auto Approve: True
    Persistent Login: False
      Logout Timeout: 3.3333333333333335 hour(s)
     Biometric Login: False

Available sub-commands: rename, register, persistent_login, ip_disable_auto_approve, timeout, bio
```

</details>

<details>

<summary>DotNet SDK</summary>

**Command:** Not Applicable

</details>

<details>

<summary>PowerCommander</summary>

**Command:** `Set-KeeperDeviceSettings -NewName <SomeNewName>`&#x20;

**Example:**

```powershell
PS> Get-KeeperDeviceSettings                     

DeviceName          : NewMacKeeper
PersistentLogin     : False
DataKeyPresent      : True
IpAutoApprove       : True
IsSsoUser           : False
DeviceLogoutTimeout : 3 hour(s)

PS> Set-KeeperDeviceSettings -NewName MacKeeper
PS> Get-KeeperDeviceSettings                        

DeviceName          : MacKeeper
PersistentLogin     : False
DataKeyPresent      : True
IpAutoApprove       : True
IsSsoUser           : False
DeviceLogoutTimeout : 3 hour(s)
```

</details>

<details>

<summary>Python CLI</summary>

**Command:** `this-device rename`

**Flags:** NA

```shell
My Vault> this-device rename "New Device Name"
Successfully renamed device to New Device Name
```

</details>

<details>

<summary>Python SDK</summary>

**Function:** `rename_device`

```
keeper_auth.rename_device(auth_context, 'New Device Name')
```

</details>

### Device IP AutoApprove Command

Use this command to control the IP Address device auto-approval security setting for your account

<details>

<summary>DotNet CLI</summary>

**Command:** `this-device timeout`

**Example:**

```
My Vault> this-device ip_disable_auto_approve ON
```

</details>

<details>

<summary>DotNet SDK</summary>

**Function:** `SetSessionParameter`

```csharp
public static async Task SetSessionParameter(this IAuthentication auth, string name, string value)
```

&#x20;**Example:**

```csharp
await SetSessionParameter("ip_disable_auto_approve, "1");
```

</details>

<details>

<summary>PowerCommander</summary>

**Command:** `Set-KeeperDeviceSettings -IpAutoApprove OFF`&#x20;

**Example:**

```powershell
PS> Set-KeeperDeviceSettings -IpAutoApprove OFF
```

</details>

<details>

<summary>Python CLI</summary>

**Command:** `this-device ip-auto-approve`

**Flags:** NA

**Example:**

```sh
My Vault> this-device ip-auto-approve on
Successfully ENABLED `ip_auto_approve`
```

</details>

<details>

<summary>Python SDK</summary>

**Function:** `set_user_setting`

```python
keeper_auth.set_user_setting(auth_context, 'ip_disable_auto_approve', '0')
#set '0' to enable and '1' to disable auto-approve
```

</details>

### Device-Yubikey Relation Command

Use this command to turn on or off the PIN usage on Security Key (Webauthn) devices.

<details>

<summary>DotNet CLI</summary>

**Command:** Not supported

</details>

<details>

<summary>DotNet SDK</summary>

**Command:**&#x4E;ot supported

</details>

<details>

<summary>PowerCommander</summary>

**Command:** Not supported

</details>

<details>

<summary>Python CLI</summary>

**Command:** `this-device no-yubikey-pin`

**Flags:** NA

**Example:**

```sh
My Vault> this-device no-yubikey-pin on
Successfully DISABLED Security Key PIN verification
```

</details>

<details>

<summary>Python SDK</summary>

**Function:** `set_user_setting`

```python
keeper_auth.set_user_setting(auth_context, 'security_keys_no_user_verify', '1')
```

</details>
