> For the complete documentation index, see [llms.txt](https://docs.enginsight.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.enginsight.com/docs/knowledge-base/english/pulsar/how-can-i-automatically-roll-out-the-enginsight-pulsar-to-multiple-persistent-windows-systems.md).

# How can I automatically roll out the Enginsight Pulsar to multiple persistent Windows systems?

You can **automatically** roll out the Enginsight agent Pulsar to any number of **persistent hosts** with a Windows operating system based on a master image.

The steps described below apply to the following environments:

* *Persistent* Windows machines (such as static virtual machines, physical servers, clients, and other systems with dedicated hostnames)

{% hint style="success" icon="lightbulb" %}
For more information on how to roll out the Enginsight Pulsar *manually* to *persistent* *virtual* Windows environments or *automatically* to *volatile* Windows virtual desktop infrastructures, see the Knowledge Base: [How can I automatically roll out the Enginsight Pulsar to multiple persistent Windows systems?](/docs/knowledge-base/english/pulsar/how-can-i-automatically-roll-out-the-enginsight-pulsar-to-multiple-persistent-windows-systems.md) and [How can I automatically roll out the Enginsight Pulsar to volatile Windows VDI environments?](/docs/knowledge-base/english/pulsar/how-can-i-automatically-roll-out-the-enginsight-pulsar-to-volatile-windows-vdi-environments.md)
{% endhint %}

***

{% stepper %}
{% step %}

### Install Pulsar on a master host

1. Start the Windows system from which the master image with the prepared Pulsar installation is to be created.
2. Navigate to the Enginsight platform and follow the [Pulsar installation instructions](https://docs.enginsight.com/docs/manual/english/installation-und-konfiguration/installation-and-configuration/enginsight-components/pulsar) for the **automatic installation** *on* *Windows clients* as described in the Enginsight Manual.
3. Save the installation script from **step 4** of the Pulsar installation instructions, as you will need it again later.
   {% endstep %}

{% step %}

### Stop Pulsar services and adjust the startup type

1. After successful installation, stop the Pulsar services **Enginsight Pulsar** and **Enginsight Supervisor** via an administrator PowerShell using the following commands:

```
Stop-Service "Enginsight Pulsar"
Stop-Service "Enginsight Supervisor"
```

2. Set the startup type of the Pulsar services to **manual** using the following commands so that they do not start automatically while the image is being created:

```
Set-Service -Name "Enginsight Pulsar" -StartupType Manual
Set-Service -Name "Enginsight Supervisor" -StartupType Manual
```

{% endstep %}

{% step %}

### Delete the master host from the platform

In the Enginsight platform, navigate to **Hosts** → **Overview** and delete the Windows client that was automatically created for the master image during the Pulsar installation.

{% hint style="warning" %}
**Please note**: Deleting hosts from the host overview does ***not*** directly uninstall the associated Pulsar.
{% endhint %}
{% endstep %}

{% step %}

### Create a backup copy of the Pulsar configuration file

Create a backup copy of the Pulsar configuration file, as the original file will be overwritten during the automatic Pulsar rollout. Use the following commands:

```
Copy-Item "C:\Programme\Enginsight\Pulsar\config.json" `
"C:\Programme\Enginsight\Pulsar\config.json.bak"
```

{% hint style="warning" %}
**Please note**: If something does not work as expected during the automatic Pulsar rollout, you can restore the original configuration file from the backup. Then run the provisioning script from [step 7](#save-and-run-the-provisioning-script) again.
{% endhint %}
{% endstep %}

{% step %}

### Save the master image

Save the master image with the prepared Pulsar installation.
{% endstep %}

{% step %}

### Create a text file with host names

1. Now create a **.txt** file that contains all host names to which Pulsar is to be rolled out. Make sure that each host name is on a separate line, for example:

```
Example-Host-VM-01
Example-Host-VM-02
Example-Host-VM-03
```

{% hint style="danger" %}
**Please note**: The host names must match the names of the virtual or physical machines on which Pulsar is to be installed **exactly**. By default, the mapping is performed via `$env:computername`.
{% endhint %}

2. Save the text file with a descriptive name.
   {% endstep %}

{% step %}

### Save and run the provisioning script

1. Copy the following script:

```
param ($hosts, $accessKeyId, $accessKeySecret, $outFolder=".")

if ($hosts -eq $null) {
    throw "Must provide a file (-hosts) with line-by-line hostnames to create configs for"
}

if (($accessKeyId -eq $null) -or ($accessKeySecret -eq $null)) {
    throw "Must provide credentials (-accessKeyId, -accessKeySecret) suitable for Pulsar installation"
}

Write-Host "Creating configs for hosts from ${hosts} in `"${outFolder}`", using existing config.json as template"

if (-not (Test-Path -Path $outFolder)) {
    Write-Host "${outFolder} does not exist, creating it"
    try {
        New-Item -ItemType Directory -Path $outFolder | Out-Null
    } catch {
        throw "Failed to create output folder`n$_"
    }
}

try {
    $configTemplate = Get-Content -Raw -Path "C:\Program Files\Enginsight\Pulsar\config.json" | ConvertFrom-Json
} catch {
    throw "Failed to read C:\Program Files\Enginsight\Pulsar\config.json - is Pulsar installed properly?`n$_"
}

$args = "-install","-accessKeyId",$accessKeyId,"-accessKeySecret",$accessKeySecret,"-license",$configTemplate.license,
    "-api",$configTemplate.api.url
if ($configTemplate.api.proxy -ne "") {
    $args += "-proxy",$configTemplate.api.proxy,"-noProxy",$configTemplate.api.noProxy
}

foreach($hostname in Get-Content $hosts) {
    $hostname = $hostname.Trim()
    if ($hostname -eq "") {
        continue
    }

    $outFile = Join-Path -Path ${outFolder} -ChildPath "config_${hostname}.json"

    if (Test-Path -Path $outFile) {
        Write-Error "Configuration for host ${hostname} already exists at ${outFile}, skipping"
        continue
    }

    $proxyParams = ""

    Write-Host "Creating config for host ${hostname}"

    & "C:\Program Files\Enginsight\Pulsar\ngs-pulsar-amd64.exe" @args
    if (-not ($?)) {
        throw "Failed to create config for ${hostname}"
    }

    try {
        $config = Get-Content -Raw -Path "C:\Program Files\Enginsight\Pulsar\config.json" | ConvertFrom-Json
        $config.override = $configTemplate.override
        if ($configTemplate.tieredTransactionLog -ne $null) {
            $config.tieredTransactionLog = $configTemplate.tieredTransactionLog
        }
    } catch {
        throw "Failed to read newly created config file`n$_"
    }

    try {
        $config | ConvertTo-Json -Depth 4 | Set-Content -Path $outFile -Encoding UTF8NoBOM
        Write-Host "Successfully created config for ${hostname} at ${outFile}"
    } catch {
        throw "Failed to write config for ${hostname} to ${outFile}`n$_"
    }
}
```

2. Save the script under the following path:

```
C:\Programme\Enginsight\Pulsar\provision.ps1
```

3. Run the script with the following command:

```
& "C:\Program Files\Enginsight\Pulsar\provision.ps1" -hosts "<PathToHostsFile>\<HostsFileName>.txt" -accessKeyId "<AccessKeyID>" -accessKeySecret "<AccessKeySecret>"
```

{% hint style="info" %}
Remember to replace the following parameters in `<>` accordingly:

* `<PathToHostsFile>`: The path to the text file containing all hostnames.
* `<HostsFileName>`: The name of the text file containing all hostnames.
* `<AccessKeyID>` and `<AccessKeySecret>`: The access key and access key secret obtained from the installation script you saved in [step 1.3](#install-pulsar-on-a-master-host).
  {% endhint %}

When the script is executed, a separate Pulsar configuration file is created and a new host is added in the Enginsight platform under **Hosts** → **Overview** for each host that was correctly listed in the text file created in [step 6](#create-a-text-file-with-host-names).

{% hint style="danger" %}
**Please note**: Each host that is created this way consumes one **Asset** license from your license package! If you need to free up licensed assets, you need to delete hosts from the host overview in the Enginsight platform accordingly.
{% endhint %}
{% endstep %}

{% step %}

### Start the Pulsar services on each host and adjust the startup type

Now the matching configuration file must be copied to the Pulsar directory on each host on which Pulsar has been installed. The Pulsar services must then be restarted and their startup type set back to **automatic**.

Use the following startup script, which you can distribute to the relevant hosts, for example via a Windows Group Policy:

```
cp "<PathToConfigurationFile>\config_${env:computername}.json" "C:\Program Files\Enginsight\Pulsar\config.json"
Start-Service "Enginsight Pulsar"

Set-Service -Name "Enginsight Pulsar" -StartupType Automatic
Set-Service -Name "Enginsight Supervisor" -StartupType Automatic
```

{% hint style="info" %}
Remember to replace the parameter `<PathToConfigurationFile>` accordingly.
{% endhint %}
{% endstep %}
{% endstepper %}

***

## Further Resources

* [How can I manually roll out the Enginsight Pulsar to multiple persistent Windows VMs?](/docs/knowledge-base/english/pulsar/how-can-i-manually-roll-out-the-enginsight-pulsar-to-multiple-persistent-windows-vms.md)
* [How can I automatically roll out the Enginsight Pulsar to volatile Windows VDI environments?](/docs/knowledge-base/english/pulsar/how-can-i-automatically-roll-out-the-enginsight-pulsar-to-volatile-windows-vdi-environments.md)&#x20;
* [How can I roll out the Enginsight Pulsar via Windows Group Policy?](/docs/knowledge-base/english/pulsar/how-can-i-roll-out-the-enginsight-pulsar-via-windows-group-policy.md)

***
