> 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/powershell-universal/it/config/psucli.md).

# Strumento da riga di comando psu

`psu` è incluso nel supporto di installazione di PowerShell Universal.

## admin

Operazioni sull'account amministratore

### reset

Reimposta la password dell'account amministratore locale in caso di blocco. L'account sarà `admin` con password `admin` .

{% code overflow="wrap" %}

```powershell
psu admin reset --connection-string 'Data Source=C:\ProgramData\UniversalAutomation\database.db'
```

{% endcode %}

| Argomento           | Descrizione                                                                                 | Obbligatorio |
| ------------------- | ------------------------------------------------------------------------------------------- | ------------ |
| --connection-string | La stringa di connessione del database                                                      | ✅            |
| --database-type     | PostgreSQL, SQL o SQLite (predefinito)                                                      | ❌            |
| --encryption-key    | Chiave di crittografia della cassaforte del database, se modificata.                        | ❌            |
| --password          | Password della cassaforte del database, se modificata.                                      | ❌            |
| --key-size          | Dimensione della chiave della password della cassaforte del database, se modificata da 128. | ❌            |

## db

Comandi per lavorare con il database di PowerShell Universal.

### convert

Converte un database LiteDB v4 in SQLite

```
psu db convert --path C:\ProgramData\UniversalAutomation\databased.db
```

| Argomento | Descrizione                            | Obbligatorio |
| --------- | -------------------------------------- | ------------ |
| --path    | Il percorso del database da convertire | ✅            |

### schema

Migra da una versione dello schema a un'altra. La migrazione a versioni inferiori può causare perdita di dati. Può essere utilizzato anche per creare un nuovo database da zero con lo schema di destinazione.

```
psu db schema --connection-string 'Server=SQL;Data Source=PSU;Integrated Security=True' --schema-version 5.1.0 --database-type 'SQL'
```

| Argomento           | Descrizione                                                             | Obbligatorio |
| ------------------- | ----------------------------------------------------------------------- | ------------ |
| --connection-string | Stringa di connessione al database                                      | ✅            |
| --target-version    | La versione dello schema del database. Il valore predefinito è "Latest" | ❌            |
| --database-type     | PostgreSQL, SQL o SQLite (predefinito)                                  | ❌            |

### migrate

{% hint style="warning" %}
La conversione di un tipo di database in un altro può essere un processo problematico e potrebbe riscontrare dei problemi. È preferibile scegliere il tipo di database definitivo al momento della prima installazione. Tenga presente che SQLite non è scalabile; se prevede che la sua istanza cresca in futuro, dovrebbe scegliere un altro tipo di database.
{% endhint %}

Migra da un database a un altro. Questo comando può migrare tra tipi di database differenti.

```
psu db migrate --source-connection-string 'Server=SQL;Data Source=PSU;Integrated Security=True' -source-database-type 'SQL' --target-connection-string 'Server=PostgreSQL;Data Source=PSU;Integrated Security=True' --target-database-type 'PostgreSQL'
```

| Argomento                  | Descrizione                                         | Obbligatorio |
| -------------------------- | --------------------------------------------------- | ------------ |
| --target-connection-string | Stringa di connessione del database di destinazione | ✅            |
| --source-connection-string | Stringa di connessione del database di origine      | ✅            |
| --target-database-type     | PostgreSQL, SQL o SQLite (predefinito)              | ❌            |
| --source-database-type     | PostgreSQL, SQL o SQLite (predefinito)              | ❌            |

#### Migrazione tra versioni

Le consigliamo di aggiornare lo schema del suo database alla versione verso cui desidera migrare prima di eseguire il comando di migrazione, per evitare differenze nello schema.

{% code overflow="wrap" lineNumbers="true" fullWidth="false" %}

```powershell
# Update source schema version
psu db schema --connection-string 'Data Source=C:\ProgramData\UniversalAutomation\database.db' --database-type 'SQLite'
# Migrate to new data source
psu db migrate --source-connection-string 'Data Source=C:\ProgramData\UniversalAutomation\database.db' --target-connection-string 'Server=PostgreSQL;Data Source=PSU;Integrated Security=True' --target-database-type 'PostgreSQL'
```

{% endcode %}

## git

Comandi per lavorare con i repository git di PSU. Questo comando utilizza i servizi git interni per lavorare con il repository locale.

### clone

Clona un repository git utilizzando il servizio di sincronizzazione git.

```
psu git clone --url http://github.com/ironmansoftware/psu.git --path C:\ProgramData\UniversalAutomation\Repository --username 'adamdriscoll' --password 'gh__1234123' --branch main
```

| Argomento  | Descrizione                                          | Obbligatorio |
| ---------- | ---------------------------------------------------- | ------------ |
| --url      | L'URL del remote git.                                | ✅            |
| --path     | Il percorso locale in cui clonare                    | ✅            |
| --username | Il nome utente per il remote.                        | ❌            |
| --password | La password per il remote                            | ❌            |
| --branch   | Il branch da clonare (il valore predefinito è main). | ❌            |

### pull

Esegue il pull da un remote git. Se il repository locale non esiste, verrà eseguito un clone.

```
psu git pull --url http://github.com/ironmansoftware/psu.git --path C:\ProgramData\UniversalAutomation\Repository --username 'adamdriscoll' --password 'gh__1234123' --branch main
```

| Argomento  | Descrizione                                          | Obbligatorio |
| ---------- | ---------------------------------------------------- | ------------ |
| --url      | L'URL del remote git.                                | ✅            |
| --path     | Il percorso locale in cui clonare                    | ✅            |
| --username | Il nome utente per il remote.                        | ❌            |
| --password | La password per il remote                            | ❌            |
| --branch   | Il branch da clonare (il valore predefinito è main). | ❌            |

### push

Esegue il push verso un remote git. Il repository deve essere clonato prima. Le modifiche non verranno messe in staging durante il push.

```
psu git push --url http://github.com/ironmansoftware/psu.git --path C:\ProgramData\UniversalAutomation\Repository --username 'adamdriscoll' --password 'gh__1234123' --branch main
```

| Argomento  | Descrizione                                        | Obbligatorio |
| ---------- | -------------------------------------------------- | ------------ |
| --url      | L'URL del remote git.                              | ✅            |
| --path     | Il percorso locale in cui clonare                  | ✅            |
| --username | Il nome utente per il remoto.                      | ❌            |
| --password | La password per il remoto                          | ❌            |
| --branch   | Il ramo da clonare (il valore predefinito è main). | ❌            |


---

# 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/powershell-universal/it/config/psucli.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.
