> 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/devolutions-server-powershell/powershell-connectivity-methods-to-devolutions-server.md).

# Métodos de conectividad de PowerShell a Devolutions Server

Conéctese a Devolutions Server con PowerShell utilizando los cmdlets de Remote Desktop Manager o los cmdlets de Devolutions Server y la autenticación mediante clave de aplicación.

Los siguientes métodos describen cómo conectarse a Devolutions Server mediante PowerShell.

### Método 1: uso de los cmdlets de Remote Desktop Manager

{% hint style="info" %}
Este nuevo espacio de trabajo creado con PowerShell solo existirá en el contexto de usuario en el que se creó.
{% endhint %}

1. Siga las instrucciones del [módulo Devolutions.PowerShell](/powershell/es/remote-desktop-manager-powershell/devolutions.powershell-core-module.md) para instalar correctamente el módulo.
2. Cree un nuevo espacio de trabajo de Devolutions Server utilizando una [clave de aplicación y un secreto de aplicación](https://docs.devolutions.net/server/es/web-interface/administration/user-and-security-management/applications-identities) con el siguiente script. Este script solo debe utilizarse una vez para evitar crear muchos espacios de trabajo nuevos. Sustituya los valores de las cuatro variables (líneas 7 a 10) por su propia información y, a continuación, ejecute el script.

```powershell
$dsname = "DVLS PowerShell"
$ds = Get-RDMDataSource -Name $dsname

# If the workspace doesn't exist, create it.
if ([string]::IsNullOrEmpty($ds))
{
  $dsname = "DVLS PowerShell"
  $dsurl = "https://your_dvls_url"
  $appkey = "your_appkey"
  $appsecret = "your_appsecret"

  $ds = New-RDMDataSource -DVLS -Name $dsname -Server $dsurl -ScriptingTenantID $appkey -ScriptingApplicationPassword $appsecret -SetDatasource -WarningAction SilentlyContinue
  Set-RDMDataSource $ds
}

Set-RDMCurrentDataSource $ds
```

3. Para conectarse al espacio de trabajo, utilice estas líneas en todos sus scripts.

```powershell
$dsname = "DVLS PowerShell"
$ds = Get-RDMDataSource -Name $dsname
Set-RDMCurrentDataSource $ds
```

### Método 2: uso de los cmdlets de Devolutions Server

1. Siga las instrucciones del [módulo Devolutions.PowerShell](/powershell/es/remote-desktop-manager-powershell/devolutions.powershell-core-module.md) para instalar correctamente el módulo.
2. El script espera que se definan una [clave de aplicación y un secreto de aplicación](https://docs.devolutions.net/server/es/web-interface/administration/user-and-security-management/applications-identities) y una URL en variables de entorno. Puesto que almacenar credenciales en los scripts está mal visto, adapte un fichero local para ejecutar sus propias pruebas.

```powershell
$env:DS_URL= "https://localhost/dvls"
$env:DS_USER = "your_appkey"
$env:DS_PASSWORD = "your_appsecret"
```

3. El siguiente script de ejemplo puede utilizarse para conectarse mediante una [clave de aplicación y un secreto de aplicación](https://docs.devolutions.net/server/es/web-interface/administration/user-and-security-management/applications-identities).

```powershell
[string]$Username = $env:DS_USER
[string]$Password = $env:DS_PASSWORD
[string]$DVLSUrl = $env:DS_URL

[securestring]$SecPassword = ConvertTo-SecureString $Password -AsPlainText -Force
[pscredential]$Creds = New-Object System.Management.Automation.PSCredential ($Username, $SecPassword)

$Response = New-DSSession -Credential $Creds -BaseURI $DVLSUrl -AsApplication
```

4. Una vez completado el script y realizadas todas las tareas, cierre la sesión con el cmdlet `Close-DSSession`.

```powershell
Close-DSSession | out-null
Write-Output " "
Write-Output "...Done!"
Write-Output " "
```

### Véase también

* [Gestionar identidades de aplicación](https://docs.devolutions.net/cloud/es/web-interface/administration/management/application-identities/manage-application-identities)


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.devolutions.net/powershell/es/devolutions-server-powershell/powershell-connectivity-methods-to-devolutions-server.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
