Files
PowerShell/docs/install-syncthing.md
Markus Fleschutz d8690419ea Updated the manuals
2025-06-22 10:38:33 +02:00

2.0 KiB

The install-syncthing.ps1 Script

This PowerShell script installs Syncthing on your computer. Syncthing is a continuous file synchronization program. See https://syncthing.net for details.

Parameters

/Repos/PowerShell/scripts/install-syncthing.ps1 [<CommonParameters>]

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

Example

PS> ./install-syncthing.ps1
 Installing Syncthing from WinGet...
...

Notes

https://github.com/fleschutz/PowerShell

{@{uri=Author: Markus Fleschutz | License: CC0}, @{linkText=Author: Markus Fleschutz | License: CC0}}

Script Content

<#
.SYNOPSIS
	Installs Syncthing
.DESCRIPTION
	This PowerShell script installs Syncthing on your computer.
	Syncthing is a continuous file synchronization program. See https://syncthing.net for details.
.EXAMPLE
	PS> ./install-syncthing.ps1
	⏳ Installing Syncthing from WinGet...
	...
.LINK
	Author: Markus Fleschutz | License: CC0
.NOTES
	https://github.com/fleschutz/PowerShell
#>

try {
	$stopWatch = [system.diagnostics.stopwatch]::startNew()

	if ($IsLinux) {
		"⏳ Installing Syncthing..."
		& sudo apt install syncthing
	} else {
		"⏳ Installing Syncthing from WinGet..."
		& winget install --id Syncthing.Syncthing --accept-package-agreements --accept-source-agreements

		"⏳ Starting Syncthing as daemon..."
		Start-Process -NoNewWindow "$env:LOCALAPPDATA\Microsoft\WinGet\Links\syncthing.exe"
	}
	[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
	"✅ Syncthing installed successfully in $($elapsed)s."
	"   Web interface:  http://127.0.0.1:8384  (open by: <Ctrl> <click>)"
	"   Sync folder at: ~/Sync/                (execute: cd-sync.ps1)"
	exit 0 # success
} catch {
	"⚠️ Error: $($Error[0])"
	exit 1
}

(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:37)