diff --git a/scripts/Windows/Scripts/Context.ps1 b/scripts/Windows/Scripts/Context.ps1
index ab1e89ad..ba347e29 100644
--- a/scripts/Windows/Scripts/Context.ps1
+++ b/scripts/Windows/Scripts/Context.ps1
@@ -219,6 +219,32 @@ class Context {
         return "$env:APPDATA/Nextcloud/nextcloud.cfg";
     }
 
+    [void] AddNextcloudSync([string] $localPath, [string] $targetPath) {
+        $this.AddNextcloudSync($localPath, $targetPath, $false);
+    }
+
+    [void] AddNextcloudSync([string] $localPath, [string] $targetPath, [bool] $virtualFiles) {
+        $pattern = "^\d+\\Folders(?:WithPlaceholders)?\\(\d+)"
+
+        $folderID = (
+            Get-Content $($this.GetNextcloudConfigFile()) | `
+                Where-Object { $_ -match "$pattern" } | `
+                ForEach-Object { $_ -replace "$pattern.*$","`$1" } | `
+                Sort-Object -Unique | `
+                Measure-Object -Maximum).Maximum + 1;
+
+        $configName = "Folders" + (if ($virtualFiles) { "WithPlaceholders" } else { "" });
+        $localPath = $localPath -replace "\","/";
+        $targetPath = $targetPath -replace "\","/";
+
+        Add-Content $this.GetNextcloudConfigFile() `
+            [string]::Join(
+                "`n",
+                @(
+                    "0\$configName\$folderID\localPath=$localPath",
+                    "0\$configName\$folderID\targetPath=$targetPath"));
+    }
+
     [void] Reboot() {
         Write-Host "Restarting Computer...";
         $this.RegisterReboot();