> 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/es/readme/devolutions-powershell.md).

# Devolutions PowerShell

Los productos de Devolutions integran completamente Microsoft PowerShell, ofreciendo potentes capacidades de scripting y automatización. Puede controlar los propios productos de Devolutions y, a través de Remote Desktop Manager, ejecutar scripts de PowerShell en todo su entorno. Teniendo esto en cuenta, así es como se utiliza PowerShell en la plataforma de Devolutions.

| Integración                                                                        | Propósito                                                                                                                                     | Referencia                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ---------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Módulo Devolutions.PowerShell                                                      | Este módulo de PowerShell se utiliza para interactuar directamente con los productos de Devolutions.                                          | <ul><li><a href="https://www.powershellgallery.com/packages/Devolutions.PowerShell/">PowerShell Gallery</a></li></ul>                                                                                                                                                                                                                                                                                                        |
| Acciones de Remote Desktop Manager                                                 | Puede definir un script de PowerShell para ejecutarlo como acción por lotes en uno o varios hosts.                                            | <ul><li><a href="/pages/PoYAl5xcZnlXgFj1nJnW">Comandos personalizados de PowerShell</a></li><li><a href="/pages/PkQ8kCu4X0EHLNgWxU5R">Edición por lotes con PowerShell</a></li><li><a href="/pages/41gLaCCGMCW7hAuRfeyp">Modificar el origen de un sincronizador</a></li></ul>                                                                                                                                               |
| Informes de Remote Desktop Manager                                                 | Este tipo de entrada admite la ejecución de un script de PowerShell para generar un informe.                                                  | <ul><li><a href="/pages/Sjx5kzgr2BxaYC6Tto31">Informe personalizado de PowerShell</a></li></ul>                                                                                                                                                                                                                                                                                                                              |
| Tipos de entradas de Remote Desktop Manager                                        | Tanto el tipo de entrada PowerShell local como PowerShell remoto admiten la ejecución de scripts.                                             |                                                                                                                                                                                                                                                                                                                                                                                                                              |
| Proveedores de gestión de accesos privilegiados (PAM) y propagación de contraseñas | En Devolutions Server y Devolutions Cloud, PowerShell impulsa los proveedores PAM personalizados y los scripts de propagación de contraseñas. | <ul><li><a href="https://docs.devolutions.net/pam/es/pam-with-devolutions-server/getting-started/custom-pam-providers/create-a-custom-pam-provider-in-devolutions-server">Proveedor PAM personalizado de Devolutions Server</a></li><li><a href="https://docs.devolutions.net/pam/es/pam-with-devolutions-server/password-propagation-scripts">Scripts de propagación de contraseñas PAM de Devolutions Server</a></li></ul> |

### Primeros pasos con el módulo Devolutions.PowerShell

El módulo Devolutions.PowerShell requiere [PowerShell 7.4 o posterior](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7.4) y es compatible con los sistemas operativos Windows, macOS y Linux.

{% hint style="warning" %}
Windows PowerShell o las versiones anteriores de PowerShell 7 no son compatibles porque el módulo está construido a partir del mismo núcleo que Remote Desktop Manager y, por lo tanto, requiere una versión de PowerShell que utilice una versión compatible del runtime de .NET (.NET 9).
{% endhint %}

#### PowerShell Gallery (recomendado)

El módulo Devolutions.PowerShell está disponible en [PowerShell Gallery](https://www.powershellgallery.com/packages/Devolutions.PowerShell) y es el método de instalación predeterminado recomendado:

```powershell
Install-Module Devolutions.PowerShell -Force
```

Dado que PowerShell Gallery suele ser un repositorio marcado como no confiable (los paquetes no se seleccionan ni se revisan), es necesario usar `-Force` para evitar el mensaje de confirmación.

#### Cloudsmith

Como alternativa a PowerShell Gallery, ofrecemos un [repositorio de Devolutions PowerShell](https://cloudsmith.io/~devolutions/repos/powershell/packages/) alojado por [Cloudsmith](https://cloudsmith.com/).

1. Registre el repositorio de Devolutions PowerShell, que puede marcarse como confiable:

   ```powershell
   Register-PSRepository -Name 'Devolutions' -SourceLocation 'https://nuget.cloudsmith.io/devolutions/powershell/v2/' -InstallationPolicy Trusted
   ```
2. Desinstale las versiones anteriores del módulo Devolutions.PowerShell instaladas desde PowerShell Gallery:

   ```powershell
   Uninstall-Module Devolutions.PowerShell -AllVersions
   ```
3. Instale el módulo Devolutions.PowerShell explícitamente desde el repositorio «Devolutions»:

   ```powershell
   Install-Module Devolutions.PowerShell -Repository Devolutions
   ```
4. Confirme que el repositorio de origen de la instalación del módulo Devolutions.PowerShell es «Devolutions» y no «PSGallery»:

   ```powershell
   Get-InstalledModule Devolutions.PowerShell | Select-Object -Property Name, Repository

   Name                   Repository
   ----                   ----------
   Devolutions.PowerShell Devolutions
   ```

{% hint style="info" %}
Dado que el módulo Devolutions.PowerShell está disponible en más de un repositorio registrado, el parámetro `-Repository` pasa a ser obligatorio. Sin embargo, si ha marcado el repositorio «Devolutions» como confiable, no es necesario `-Force` para evitar el mensaje de confirmación.
{% endhint %}

#### Sin conexión

Si necesita instalar el módulo Devolutions.PowerShell en un sistema con acceso limitado a Internet o sin acceso, puede hacerlo siguiendo estos pasos:

1. Cree un nuevo repositorio de PowerShell llamado «local» en el directorio que elija; el ejemplo siguiente utiliza `C:\PSRepo`.

   ```powershell
   $RepoPath = "C:\PSRepo"
   New-Item -Path $RepoPath -ItemType 'Directory' -Force | Out-Null
   Register-PSRepository -Name 'local' -SourceLocation $RepoPath -PublishLocation $RepoPath -InstallationPolicy Trusted
   ```
2. Descargue el fichero `.nupkg` del módulo Devolutions.PowerShell mediante el botón ***Download the raw nupkg file*** en ***Manual Download*** en [PowerShell Gallery](https://www.powershellgallery.com/packages/Devolutions.PowerShell). Copie el fichero `.nupkg` en el directorio del repositorio local de PowerShell creado anteriormente.
3. Desinstale las versiones anteriores del módulo Devolutions.PowerShell instaladas desde otras fuentes.

   ```powershell
   Uninstall-Module Devolutions.PowerShell -AllVersions
   ```
4. Instale el módulo Devolutions.PowerShell explícitamente desde el repositorio `local`.

   ```powershell
   Install-Module Devolutions.PowerShell -Repository local
   ```
5. Confirme que el origen de la instalación del módulo Devolutions.PowerShell es `local`.

   ```powershell
   Get-InstalledModule Devolutions.PowerShell | Select-Object -Property Name, Repository

   Name                   Repository
   ----                   ----------
   Devolutions.PowerShell local
   ```

{% hint style="info" %}
Como alternativa, se puede utilizar un directorio en un recurso compartido de red en lugar de un directorio local, lo que facilita la distribución del módulo de PowerShell en una red local.
{% endhint %}

### Ejemplos

Para empezar rápidamente con algunos ejemplos habituales del módulo Devolutions.PowerShell, siga leyendo a continuación.

#### Remote Desktop Manager

```powershell
# [Import module]
Import-Module Devolutions.PowerShell

# [Load workspace] Example for a local workspace (SQLite) or SQL Server
$DatasourceLocal = Get-RDMDataSource -Name "Local workspace"; Set-RDMCurrentDataSource $DatasourceLocal

$DatasourceSQL = Get-RDMDataSource -Name "SQL Server"; Set-RDMCurrentDataSource $DatasourceSQL

# [Create vault] Only the SQL Server workspace supports vaults (as do Devolutions Server and Devolutions Cloud)
$Vault = New-RDMRepository -Name 'MyVault' -Description 'My vault description' -SetRepository | Set-RDMCurrentRepository | Update-RDMUI

# [Retrieve vault]
Get-RDMRepository -Name 'MyVault'

# [Create entry] Example to create an RDP and Credential entry
$Entry = New-RDMSession -Host 'MyHost' -Type RDPConfigured -Name 'MyHost'; Set-RDMSession -Session $Entry -Refresh; Update-RDMUI

$Entry = New-RDMSession -Name 'MyCredential' -Type Credential; $Entry.Credentials.Username = 'Administrator'; Set-RDMSession $Entry -Refresh; Set-RDMSessionPassword -ID $Entry.ID -Password (ConvertTo-SecureString 'Test123$' -AsPlainText -Force)

# [Retrieve entries]
Get-RDMSession -GroupName 'MyFolder' -Name 'MyHost'

# [Update entry]
$Entry = Get-RDMSession -Name 'MyHost'; $Entry.Name = 'MyUpdatedHost'; Set-RDMSEssion $Entry | Update-RDMUI

# [Export entries]
$Entries = Get-RDMSession; $Entries | Select-Object * | Export-CSV 'C:\Export\FileName.csv' -NoTypeInformation

# [Remove entry]
Get-RDMSession -Name 'MyUpdatedHost' | Remove-RDMSession; Update-RDMUI
```

#### Devolutions Server

```powershell
# [Import module]
Import-Module Devolutions.PowerShell

# [Load workspace]
New-DSSession -Credential (Get-Credential) -BaseURI 'https://MyServer/devolutions-server/'

# [Create vault]
$Vault = New-DSVault -Name 'MyVault' -Description 'My vault description'

# [Retrieve vault]
Get-DSVault -All | Where-Object DisplayName -EQ 'MyVault'

# [Create entry]
New-DSRDPEntry -Name 'MyHost' -HostName 'MyHost' -Username 'Administrator' -Password 'Test123$' -Domain 'MyDomain' -VaultID 'VaultGUID'

New-DSCredentialEntry -Name 'MyCredential' -Username 'Administrator' -Password 'Test123$' -Domain 'MyDomain' -VaultID 'VaultGUID'

# [Retrieve entries]
Get-DSEntry -FilterBy 'Name' -FilterMatch 'StartsWith' -FilterValue 'MyHost' -SearchAllVaults

# [Update entry]
$Entry = Get-DSEntry -EntryId 'EntryGUID'; $Entry.Name = 'MyUpdatedHost'; Update-DSEntryBase -JsonBody (ConvertTo-JSON -InputObject $Entry -Depth 10)

# [Export entries]
$Entries = Get-DSEntry -SearchAllVaults; $Entries | Select-Object * | Export-CSV 'C:\Export\FileName.csv' -NoTypeInformation

# [Remove entry]
Remove-DSEntry -EntryID 'EntryGUID'
```

#### Devolutions Cloud

```powershell
# [Import module]
Import-Module Devolutions.PowerShell

# [Load workspace]
Connect-HubAccount -Url 'https://mycloud.devolutions.app' -ApplicationKey 'ApplicationKey' -ApplicationSecret 'ApplicationSecret'

# [Create vault]
$Vault = New-HubVault -VaultName 'MyVault' -VaultDescription 'My vault description'

# [Retrieve vault]
Get-HubVault

# [Create entry]
$Entry = [Devolutions.Hub.PowerShell.Entities.Hub.PSDecryptedEntry]@{
    PsMetadata = [Devolutions.Hub.PowerShell.Entities.Hub.PSEntryMetadata]@{
        Name = 'MyHost'
        ConnectionType = [Devolutions.RemoteDesktopManager.ConnectionType]::Credential
    }
    Connection = [Devolutions.RemoteDesktopManager.Business.Connection]@{
        Credentials = [Devolutions.RemoteDesktopManager.Business.CredentialsConnection]@{
            CredentialType = [Devolutions.RemoteDesktopManager.CredentialResolverConnectionType]::Default
            UserName = 'Administrator'
            Password = 'Test123$'
        }
    }
}

New-HubEntry -VaultId 'VaultGUID' -PSDecryptedEntry $Entry

# [Retrieve entries]
Get-HubEntry -VaultId 'VaultGUID' | Where-Object { $PSItem.PSMetaData.Name -EQ 'MyHost' }

# [Update entry]
$Entry = Get-HubEntry -VaultId 'VaultGUID' -EntryId 'EntryGUID'; $Entry.PsMetadata.Name = 'MyUpdatedHost'; Set-HubEntry -VaultId 'VaultGUID' -EntryId $Entry.Entry.ID.Guid -PSDecryptedEntry $Entry

# [Export entries]
$Entries = Get-HubEntry -VaultId 'VaultGUID'; $Entries | Select-Object * | Export-CSV 'C:\Export\FileName.csv' -NoTypeInformation

# [Remove entry]
Remove-HubEntry -VaultId 'VaultGUID' -EntryId 'EntryGUID'
```

### Desinstalar el módulo Devolutions.PowerShell

Desinstale todas las versiones del módulo Devolutions.PowerShell:

```powershell
Uninstall-Module Devolutions.PowerShell -AllVersions
```

Si el módulo se instaló mediante Cloudsmith, puede anular el registro del repositorio «Devolutions» de la siguiente manera:

```powershell
Unregister-PSRepository Devolutions
```

Por último, si ha instalado el módulo sin conexión, puede anular el registro del repositorio «local» basado en ficheros y eliminar el directorio asociado (el nombre de su directorio puede ser diferente):

```powershell
Unregister-PSRepository local
Remove-Item "C:\PSRepo" -Recurse -ErrorAction SilentlyContinue
```


---

# 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/es/readme/devolutions-powershell.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.
