> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/rdm/knowledge-base/how-to-articles/configure-laps-with-a-custom-credentials-entry.md).

# Configure LAPS with a custom credentials entry

The following guide describes how to add a PowerShell script in a custom credentials entry to connect on a remote machine using [Windows LAPS](https://learn.microsoft.com/en-us/windows-server/identity/laps/laps-overview). Windows LAPS is required and must be properly configured in your environment to use this solution.

{% hint style="success" %}
From Remote Desktop Manager v.2024.3 on, LAPS credentials entries are official entries and no longer need to be custom-made. The host's ***Username*** setting still needs to be changed to the remote host, otherwise the authentication will use the local host by default. To make this change, enter $HOST$\username (*username*stands for the remote host's username), in the ***General*** – ***Host*** - ***Username*** field.
{% endhint %}

1\. In Remote Desktop Manager Windows, create a new entry in the ribbon under the ***Edit*** tab. 2. In ***Credential management***, select the ***Custom*** entry type.

![](https://cdnweb.devolutions.net/docs/docs_en_kb_KB2334.png)

3. Name your entry and select its destination folder.
4. In the ***General*** tab, make sure the drop-down menu is set to ***PowerShell***.

   ![](https://cdnweb.devolutions.net/docs/docs_en_kb_KB2335.png)
5. Add the following PowerShell script in the ***Command*** box.

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>The script uses the <code>$HOST$</code> variable for the <code>-ComputerName</code> switch of the <code>Get-LapsADPassword</code> cmdlet and uses the <code>$PARAMETER1$</code> variable for the username (see step 6 below). Depending on your environment, the <code>$PARAMETER$</code> could be related to the <code>-Identity</code>. You can also configure the <em><strong>Parameter #2</strong></em> to set the username you need and change the script value from <code>%USERNAME%</code> to <code>$PARAMETER2$</code>. We recommend to launch Remote Desktop Manager as an administrator to gain elevated permissions.</p></div>

```powershell
Import-Module LAPS -ErrorAction SilentlyContinue
$isImport = Get-Module -List LAPS
if ($isImport)
{
    try
        {
         $null2 = [System.DirectoryServices.ActiveDirectory.Domain]::GetComputerDomain()
         $isDomain = $true
        }
    catch
        {
         $isDomain = $false
        }

    if ($isDomain)
    {
        $MyPassword=Get-LapsADPassword -Identity $PARAMETER1$ -AsPlainText
        if ($MyPassword.Password)
           {
            $Result.Username="%USERNAME%"
            $Result.Password=$MyPassword.Password
           }
        else
           {
            $Result.Cancel=$True
            $Result.ErrorMessage="LAPS did not return any value!"
           }
    }
    else
    {
        $Result.Cancel=$True
        $Result.ErrorMessage="Your computer must be connected to a domain to use LAPS features!"
    }
}
else
{
        $Result.Cancel=$True
        $Result.ErrorMessage="The LAPS module must be installed in this architecture!"
}
```

![](https://cdnweb.devolutions.net/docs/docs_en_kb_KB2336.png)

6. In the ***Parameters*** tab, add the local administrator account name in the ***Parameter #1*** field.

   ![](https://cdnweb.devolutions.net/docs/docs_en_kb_KB2337.png)
7. Click ***Add*** to save the entry in the specified destination folder.
8. In your RDP entry properties, set the credentials property to use the newly created ***Custom*** credentials entry.

   ![](https://cdnweb.devolutions.net/docs/docs_en_kb_KB2338.png)
9. Still in the RDP entry properties, go to ***Advanced*** – ***Advanced***.
10. Set the ***Override domain*** property to ***Use Host Name*** and the ***Username format property*** to ***{Domain}\\{User}***.

    ![](https://cdnweb.devolutions.net/docs/docs_en_kb_KB2339.png)
11. Click on ***Update*** to save your changes.

The RDP entry is now ready to be used and connect with the local administrator account managed by Windows LAPS.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.devolutions.net/rdm/knowledge-base/how-to-articles/configure-laps-with-a-custom-credentials-entry.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
