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

# Custom (PowerShell) synchronizer

This entry is a powerful "hybrid" synchronizer that lets you use PowerShell scripts to populate vaults, sync descriptions, apply templates and more. You can synchronize from sources that we don’t have a dedicated synchronizer for. It leverages proxy classes to interact with rich Remote Desktop Manager connection objects.

{% hint style="info" %}
See [PowerShell commands](https://docs.devolutions.net/powershell/powershell-commands/) for a list of Devolutions' custom PS commands, complete with descriptions, examples, and supported common parameters.
{% endhint %}

### Custom (PowerShell) synchronizer use cases

#### Simple session

Provide the host, name, description and group while using the default RDP type. Alternatively, use a template to promote reuse and standardization. Here is an example:

```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'
}
```

#### Session with credentials

To set the credentials, use: `$session.SetCredentials($row.Username, $row.Password, $row.Domain);`.

To only set the password, use: `$session.SetPassword($row.Password);`.

{% hint style="info" %}
The password cannot be set using `$session.Password`.
{% endhint %}

#### Commonly used fields

Here are commonly used fields for quick reference:

```
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
```

#### Advanced scenario

By using the method outlined in [Reverse engineering an entry's structure](https://docs.devolutions.net/powershell/rdm-powershell/powershell-scripting/tips-tricks/#reverse-engineering-an-entrys-structure), you can create an entry with all required information in the appropriate fields and observe how to assign values using PowerShell.\
\
For example, here is a ***Host*** entry for which many fields of the ***View*** – ***Asset*** section have been filled:

```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>
```

You can see a few "complex" objects, namely `HostDetails` and `MetaInformation`. The former is specific to the ***Host*** entry type, and the latter is a container for everything in the ***View*** – ***Asset*** section. Add the section name as a prefix to write to the inner fields.

```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"
}
```

**Key points**

* Note that `Name` and `HostDetails.Host` properties share the same value. This is a characteristic of the ***Host*** entry, and caution must be taken when working with other entry types as well.
* Some fields, like `MetaInformation.AssetSubType` are tied to an enumeration and must contain the exact string. Some others like `MetaInformation.NetworkGateway` are simple strings and can contain anything. Feel free to contact our [support team](mailto:service@devolutions.net) if you have further questions.

**Related topics**

* [Synchronizers](https://docs.devolutions.net/rdm/concepts/advanced-concepts/synchronizers/)
* [List of property names for PowerShell script](https://docs.devolutions.net/powershell/rdm-powershell/powershell-scripting/tips-tricks/)
* [PowerShell commands](https://docs.devolutions.net/powershell/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:

```
GET https://docs.devolutions.net/rdm/knowledge-base/knowledge-base-articles/entry-settings/custom-powershell-synchronizer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
