> 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/it/knowledge-base/how-to-articles/configure-laps-with-a-custom-credentials-entry.md).

# Configurare LAPS con una voce di credenziali personalizzata

La guida seguente descrive come aggiungere uno script PowerShell in una voce di credenziali personalizzata per connettersi a una macchina remota utilizzando [Windows LAPS](https://learn.microsoft.com/en-us/windows-server/identity/laps/laps-overview). Windows LAPS è richiesto e deve essere configurato correttamente nel suo ambiente per utilizzare questa soluzione.

{% hint style="success" %}
A partire da Remote Desktop Manager v.2024.3, le voci di credenziali LAPS sono voci ufficiali e non devono più essere personalizzate. L'impostazione ***Username*** dell'host deve comunque essere modificata con l'host remoto, altrimenti l'autenticazione utilizzerà l'host locale per impostazione predefinita. Per effettuare questa modifica, inserisca $HOST$\username (*username*sta per il nome utente dell'host remoto), nel campo ***General*** – ***Host*** - ***Username***.
{% endhint %}

1\. In Remote Desktop Manager Windows, crei una nuova voce nella barra multifunzione, nella scheda ***Edit***. 2. In ***Credential management***, selezioni il tipo di voce ***Custom***.

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

3. Assegni un nome alla voce e selezioni la cartella di destinazione.
4. Nella scheda ***General***, si assicuri che il menu a discesa sia impostato su ***PowerShell***.

   ![](https://cdnweb.devolutions.net/docs/docs_en_kb_KB2335.png)
5. Aggiunga il seguente script PowerShell nella casella ***Command***.

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>Lo script utilizza la variabile <code>$HOST$</code> per lo switch <code>-ComputerName</code> del cmdlet <code>Get-LapsADPassword</code> e utilizza la variabile <code>$PARAMETER1$</code> per il nome utente (veda il passaggio 6 di seguito). A seconda del suo ambiente, il <code>$PARAMETER$</code> potrebbe essere correlato a <code>-Identity</code>. Può anche configurare il <em><strong>Parameter #2</strong></em> per impostare il nome utente di cui ha bisogno e modificare il valore dello script da <code>%USERNAME%</code> a <code>$PARAMETER2$</code>. Consigliamo di avviare Remote Desktop Manager come amministratore per ottenere autorizzazioni elevate.</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. Nella scheda ***Parameters***, aggiunga il nome dell'account amministratore locale nel campo ***Parameter #1***.

   ![](https://cdnweb.devolutions.net/docs/docs_en_kb_KB2337.png)
7. Clicchi su ***Add*** per salvare la voce nella cartella di destinazione specificata.
8. Nelle proprietà della sua voce RDP, imposti la proprietà delle credenziali per utilizzare la voce di credenziali ***Custom*** appena creata.

   ![](https://cdnweb.devolutions.net/docs/docs_en_kb_KB2338.png)
9. Sempre nelle proprietà della voce RDP, vada in ***Advanced*** – ***Advanced***.
10. Imposti la proprietà ***Override domain*** su ***Use Host Name*** e la proprietà ***Username format property*** su ***{Domain}\\{User}***.

    ![](https://cdnweb.devolutions.net/docs/docs_en_kb_KB2339.png)
11. Clicchi su ***Update*** per salvare le modifiche.

La voce RDP è ora pronta per essere utilizzata e per connettersi con l'account amministratore locale gestito da 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
