netbird icon indicating copy to clipboard operation
netbird copied to clipboard

Pass management-url to msi installer.

Open svardie opened this issue 1 year ago • 4 comments

Is your feature request related to a problem? Please describe. We struggling to autodeploy MSI installer to our Windows users with custom management-url.

Describe the solution you'd like An option to provide management-url address to MSI packet during installation.

svardie avatar Jun 21 '24 00:06 svardie

You can populate the values in %PROGRAMDATA%/Netbird/config.json as an alternative, would that help?

lixmal avatar Jun 21 '24 11:06 lixmal

We managed to create custom msi installer with powershell script that populate needed value in config.json after installation.

svardie avatar Jun 24 '24 12:06 svardie

@svardie Would you by any chance be able to share details on creating the custom installer to do this? (I'm a linux guy that has been dropped in the deep end with windows admin and using Intune)

nicjohnston avatar Oct 15 '24 21:10 nicjohnston

@nicjohnston Sure. Here it is.

((Get-Content -path "C:\ProgramData\Netbird\config.json" -Raw) -replace 'api.netbird.io:443','your_custom_url') | Set-Content -Path "C:\ProgramData\Netbird\config.json"

We modified official Netbird msi installer with Advanced Installer software and stick this powershell script in it.

If you are using Microsoft Intune, then possible scenario can be to deploy official msi-packet without changing it, and then run PS script on clients via Intune. Maybe i am wrong, not worked with Intune.

Hope this will help.

svardie avatar Oct 16 '24 01:10 svardie

I used the below instead to acheive basically the same thing. It also changes the admin url too.

'# Define the path to the config file $configFilePath = "C:\ProgramData\Netbird\config.json"

Check if the config file exists

if (Test-Path -Path $configFilePath) { # Read the content of the config file $configContent = Get-Content -Path $configFilePath -Raw | ConvertFrom-Json

# Check if the Host values are correct
$isUpdated = $false
if ($configContent.ManagementURL.Host -ne "<self-hosted-url>:33073") {
    $configContent.ManagementURL.Host = "<self-hosted-url>:33073"
    $isUpdated = $true
}
if ($configContent.AdminURL.Host -ne "<self-hosted-url>:443") {
    $configContent.AdminURL.Host = "<self-hosted-url>:443"
    $isUpdated = $true
}

# If updates were made, convert the updated content back to JSON format and write it back to the file
if ($isUpdated) {
    $updatedConfigContent = $configContent | ConvertTo-Json -Depth 10
    Set-Content -Path $configFilePath -Value $updatedConfigContent
    Write-Output "Config file updated successfully."
} else {
    Write-Output "Config file is already up to date."
}

} else { Write-Output "Config file does not exist. No changes made." }'

itmunky avatar Nov 15 '24 08:11 itmunky