> 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/es/knowledge-base/knowledge-base-articles/entry-settings/custom-powershell-synchronizer.md).

# Sincronizador personalizado (PowerShell)

Esta entrada es un potente sincronizador "híbrido" que le permite usar scripts de PowerShell para rellenar bóvedas, sincronizar descripciones, aplicar plantillas y más. Puede sincronizar desde orígenes para los que no tenemos un sincronizador dedicado. Aprovecha clases proxy para interactuar con los completos objetos de conexión de Remote Desktop Manager.

{% hint style="info" %}
Consulte [Comandos de PowerShell](https://docs.devolutions.net/powershell/es/powershell-commands) para ver una lista de los comandos PS personalizados de Devolutions, con descripciones, ejemplos y parámetros comunes admitidos.
{% endhint %}

### Casos de uso del sincronizador Custom (PowerShell)

#### Sesión simple

Proporcione el host, el nombre, la descripción y el grupo utilizando el tipo RDP predeterminado. Como alternativa, utilice una plantilla para fomentar la reutilización y la estandarización. Aquí tiene un ejemplo:

```powershell
# Obtain or generate your list of sessions to create, here we assume a $data table.
# Has been filled by querying an external source.
Foreach($row in $data)
{
  # Create a new session, the only mandatory property is 'Name' so we require it as a parameter in the Add method.
  $session = $RDM.Add($row.Name)
  # Set the other properties using $session.
  $session.Host = $row.Name
  $session.Description = $row.Description
  $session.Group = $row.Group # it can be multiple levels i.e. 'Folder1\Folder1a'
}
```

#### Sesión con credenciales

Para establecer las credenciales, utilice: `$session.SetCredentials($row.Username, $row.Password, $row.Domain);`.

Para establecer únicamente la contraseña, utilice: `$session.SetPassword($row.Password);`.

{% hint style="info" %}
La contraseña no se puede establecer mediante `$session.Password`.
{% endhint %}

#### Campos de uso habitual

Estos son los campos de uso habitual, como referencia rápida:

```
string CustomStatus
string Description
bool Encrypt
string Group
string Host
bool IncludeInFavorite
string Name
bool OpenEmbedded
bool ShowInTrayIcon
int SortPriority
<Color>#FF0000</Color>
string GroupTab
string Status
string TabTitle
```

#### Escenario avanzado

Utilizando el método descrito en [Ingeniería inversa de la estructura de una entrada](https://docs.devolutions.net/powershell/es/remote-desktop-manager-powershell/powershell-scripting/list-of-property-names-for-powershell-script#reverse-engineering-an-entrys-structure), puede crear una entrada con toda la información necesaria en los campos adecuados y observar cómo asignar valores mediante PowerShell.\
\
Por ejemplo, aquí tiene una entrada ***Host*** en la que se han rellenado muchos campos de la sección ***View*** – ***Asset***:

```xml
<?xml version="1.0" encoding="utf-8"?>
<ArrayOfConnection>
  <Connection>
    <AppVersion>~SET AUTOMATICALLY~</AppVersion>
    <Color>#FF0000</Color>
    <ConnectionType>Host</ConnectionType>
    <CreatedBy>~SET AUTOMATICALLY~</CreatedBy>
    <CreationDateTime>~SET AUTOMATICALLY~</CreationDateTime>
    <Description>phDescription</Description>
    <GroupTab>phTabGroupName</GroupTab>
    <ID>~SET AUTOMATICALLY~</ID>
    <Name>phName</Name>
    <OpenEmbedded>true</OpenEmbedded>
    <SortPriority>100</SortPriority>
    <Status>{123A44CB-7EDC-4ecb-926B-031793668148}</Status>
    <TabTitle>phTabPageTitle</TabTitle>
    <HostDetails>
      <Host>phName</Host>
    </HostDetails>
    <MetaInformation>
      <AssetSubType>Desktop</AssetSubType>
      <Domain>metadomain</Domain>
      <IP>metaIP</IP>
      <Keywords>MyTag1</Keywords>
      <MAC>metamac</MAC>
      <MachineName>metaHost</MachineName>
      <NetworkDHCPRange>MetaDHCPRange</NetworkDHCPRange>
      <NetworkDHCPServer>MetaDHCPServer</NetworkDHCPServer>
      <NetworkFirewallZone>MetaFirewall</NetworkFirewallZone>
      <NetworkGateway>MetaGateway</NetworkGateway>
      <NetworkIPRange>metaIPRange</NetworkIPRange>
      <NetworkSubnet>metaSubnet</NetworkSubnet>
      <NetworkVLANID>MetaVlan</NetworkVLANID>
      <OS>metaos</OS>
    </MetaInformation>
  </Connection>
</ArrayOfConnection>
```

Puede ver algunos objetos "complejos", concretamente `HostDetails` y `MetaInformation`. El primero es específico del tipo de entrada ***Host***, y el segundo es un contenedor para todo lo que hay en la sección ***View*** – ***Asset***. Añada el nombre de la sección como prefijo para escribir en los campos internos.

```powershell
Foreach($row in $data)
{
  $session = $RDM.Add($row.Name)
  $session.Kind = "Host"
  $session.HostDetails.Host = $row.Name
  $session.MetaInformation.AssetSubType = "Desktop"
  $session.MetaInformation.IP = "10.10.1.25"
}
```

**Puntos clave**

* Tenga en cuenta que las propiedades `Name` y `HostDetails.Host` comparten el mismo valor. Esta es una característica de la entrada ***Host***, y también debe tenerse precaución al trabajar con otros tipos de entrada.
* Algunos campos, como `MetaInformation.AssetSubType`, están vinculados a una enumeración y deben contener la cadena exacta. Otros, como `MetaInformation.NetworkGateway`, son simples cadenas y pueden contener cualquier valor. No dude en contactar con nuestro [equipo de soporte](mailto:service@devolutions.net) si tiene más preguntas.

**Temas relacionados**

* [Sincronizadores](/rdm/es/concepts/advanced-concepts/synchronizers.md)
* [Lista de nombres de propiedades para scripts de PowerShell](https://docs.devolutions.net/powershell/es/remote-desktop-manager-powershell/powershell-scripting/list-of-property-names-for-powershell-script)
* [Comandos de PowerShell](https://docs.devolutions.net/powershell/es/powershell-commands)


---

# 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/es/knowledge-base/knowledge-base-articles/entry-settings/custom-powershell-synchronizer.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.
