Map your Nextcloud server to a Windows drive letter with NcDavTray

NcDavTray — Tiny Nextcloud WebDAV Tray for Windows

Windows WebDAV tray watcher + watchdog (PowerShell 5.1 + WinForms)

Release License PowerShell 5.1

Map your Nextcloud server to a real Windows drive letter (e.g. Z:) and keep it healthy. NcDavTray is a small, self‑contained tray app written in Windows PowerShell 5.1 + WinForms with a small amount of embedded C# for DPI and shell notifications. It runs without admin rights and supports both Installed and Portable modes.


Features

  • One‑click drive mapping to a persistent letter (your choice)
  • Auto‑reconnect & watchdog — if the server goes offline or into maintenance mode the tray icon turns red and the drive is cleanly unmapped; as soon as the server is back the drive remounts automatically
  • Optional subfolder mapping — map any folder within your Nextcloud, not just the root
  • Friendly Explorer appearance — custom drive label and icon pulled from your Nextcloud favicon
  • Tray UI: connect/disconnect (pause), status balloon, Settings, About, Exit
  • Two security models:
    • Installed: credentials protected with Windows DPAPI (bound to your Windows user profile)
    • Portable: credentials encrypted with AES‑256‑CBC + PBKDF2 (100 000 iterations, passphrase you choose)
  • Automatic file locking for Office apps — Office applications (Microsoft 365, LibreOffice, Collabora …) lock files automatically via WebDAV when opened from the drive. With the optional files_lock server app, non-Office files are locked too. This works on an NcDavTray network drive and does not work with the official Nextcloud Desktop Client.
  • Watchdog process for clean unmount if the main app crashes or a USB stick (portable mode) disappears
  • WebClient tuning tab — inspect and adjust Windows WebDAV redirector (WebClient) limits and timeouts with safe defaults, inline help texts, and a UAC-guarded Apply changes button
  • WebDAV cache tab — monitor the WebClient cache in real time, view cached items, clear them manually or auto-wipe on watcher exit
  • Multi‑language (i18n) with live switching (no restart) and simple JSON language packs

Requirements

  • Windows 10 / 11 with Windows PowerShell 5.1 (the provided launcher starts PS 5.1 in STA mode automatically)
  • WebClient service (Windows WebDAV mini‑redirector) — enabled and set to Manual or Automatic
  • Nextcloud reachable via HTTPS using a Nextcloud App Password

No administrator permissions are required except for the optional WebClient service handling and the cache watcher.


Install & Quick Start

  1. Download the latest ZIP from the Releases page.

  2. Extract the ZIP to a folder inside your user profile.

  3. Run installNcDavTray.cmd and choose:

    • 1 — Installed mode: copies the app into %LOCALAPPDATA%\NcDavTray, sets optional per‑user auto‑start, creates Start Menu / Desktop shortcuts, and safely stops + restarts any running instance while preserving your config.
    • 2 — Portable mode: creates a self‑contained portable package in the selected folder. Launch via the generated Start NcDavTray.cmd.

Multiple instances can run side by side — one installed and any number of portable mounts, even from different Nextcloud accounts:

Multiple tray instances

First run: open Settings from the tray icon, enter:

Field Notes
Server Host only, e.g. cloud.example.com
User Your Nextcloud user ID
App password Create in Nextcloud → Profile → Security; used for WebDAV only
Subfolder Optional — pick via the built-in folder browser
Drive letter Next free letter is pre‑selected
Display name Label shown in Explorer (auto‑suggested from subfolder / user)
Language Auto‑detected or pick from installed language packs
Check interval How often the watchdog polls (seconds)

Click Save → NcDavTray maps the drive, applies the icon and label, and keeps it online.

Settings dialog — Basic settings tab   Mapped drives in Explorer with custom icons and labels


Using the tray

Action Effect
Left‑click Status balloon (server · drive · subpath · state)
Right‑click → Connect Map drive / resume after pause
Right‑click → Disconnect Unmap and pause auto-reconnect
Right‑click → Open in Explorer Opens the mapped drive
Right‑click → Settings Open the Settings dialog
Right‑click → Exit Clean unmount + exit

Tray icon with drive letter   Left-click status balloon

Right-click context menu (Installed mode)   Right-click context menu (Portable mode)   Needs-setup state


File locking

NcDavTray exposes Nextcloud storage as a standard Windows network drive. Because of this, Office applications (Microsoft 365, LibreOffice, Collabora and others) open a direct WebDAV connection to the server and issue a LOCK request automatically before editing any file. This means:

  • Automatic, per-application file locking works out of the box — no extra configuration required.
  • Another user attempting to open the same file sees the standard Office “file is locked by another user” warning.
  • When the application closes the file, the lock is released automatically.

This automatic locking does not work with the official Nextcloud Desktop Client (sync client / virtual files). The Desktop Client synchronises files locally and does not send WebDAV LOCK requests when an application opens a synced file.

With the files_lock app

When the Nextcloud files_lock app is installed on the server, locking is extended further:

  • Non-Office files are also locked when opened through NcDavTray — any application that opens a file over the WebDAV drive triggers a server-side lock.
  • The Desktop Client gains a manual lock/unlock option in the file context menu.
  • The server enforces locks (HTTP 423) towards other users.

Known limitation (files_lock issue #228): The same user who created a lock can bypass it — they can still edit, rename, move, or delete the file. Locking is therefore effective for multi-user collaboration but does not protect a file from the user who locked it.

Comparison

NcDavTray and the official Desktop Client are fully complementary:

NcDavTray (WebDAV drive) Nextcloud Desktop Client
Automatic Office file locking :white_check_mark: :cross_mark:
Non-Office file locking (requires files_lock) :white_check_mark: :cross_mark:
Manual lock via context menu (requires files_lock) :cross_mark: :white_check_mark:
Offline / sync capability :cross_mark: :white_check_mark:
Works like a standard network drive :white_check_mark: —

Using both together gives you the best of both worlds.


Tuning the WebClient service

The WebClient tuning tab in Settings exposes the most relevant registry settings of the Windows WebDAV redirector in a safe, documented way:

  • Maximum number of files per folder (attribute cache limit)
  • Maximum file size (up to 4 GB)
  • Local / internet server timeouts
  • Send/receive timeout
  • Server not found cache lifetime
  • Start / restart the service
  • Service startup type (Disabled, Manual, Automatic)

All values show both the current registry value and a readable explanation; each option has an inline help text.
Reading the current values requires no admin rights. Elevation (UAC) is only requested when you click Apply changes.

Settings dialog — WebClient tuning tab


Monitoring the WebDAV cache

The WebDAV cache tab exposes the Windows WebClient cache directory used for all WebDAV drives including NcDavTray. The lightweight elevated cache watcher gives you visibility into what the redirector has stored and lets you clear it safely without touching WebClient or your mapped drive.

  • Real-time cache overview (UUID-based entries, grouped by type)
  • Total cache size and file count
  • Optional live updates while the watcher is active
  • One-click Clear cache
  • Clear cache on exit — wipes the redirector cache automatically when the watcher is stopped (useful for privacy, shared devices, or tuning tests)

Settings dialog — WebDAV cache tab


Multi‑language (i18n)

Live language switching — no restart required. Language packs are simple JSON files.

Source Languages
Built-in English
Included i18n files German · Spanish · French · Italian · Dutch · Portuguese (Brazil)

More languages welcome — copy an existing JSON pack, translate the strings, and drop it into the i18n/ folder (or import it via Settings → Install language pack).


Security & Privacy

Password handling

  • Installed: stored via Windows DPAPI, bound to your user account — never written in plain text or passed on the command line.
  • Portable: stored in NcDavTray_secret.dat, encrypted with AES‑256‑CBC, key derived via PBKDF2 (100 000 iterations) from your passphrase; decrypted only in memory for the current session.

Network scope — NcDavTray only ever connects to your Nextcloud host for:

  • reachability / maintenance-mode check (/status.php)
  • folder picker and validation (Nextcloud OCS API)
  • server favicon and user avatar
  • WebDAV operations for mapping and unmapping

No telemetry. No analytics. No third-party calls. No background update checks.

Cleanup — on disconnect or exit the app unmounts the drive and removes all cosmetic branding (Explorer label, drive icon) so no stale entries remain. The optional cache auto-clear ensures no WebDAV redirector data is left behind on shared or untrusted systems.


Updating & Uninstall

Procedure
Update (Installed) Download the new ZIP, run installNcDavTray.cmd → 1. The running instance is stopped and restarted automatically; your configuration is preserved.
Update (Portable) Run installNcDavTray.cmd → 2 and point to your existing portable folder. Your *_portable.json and *_secret.dat are untouched.
Uninstall (Installed) Open Settings → Uninstall.
Uninstall (Portable) Exit the app and delete the portable folder.

Enjoy!

ernolf

Love it, installed it under installed mode (option 1) and an icon shows in the tray to tell me to open settings with the exclamation mark. However which settings? Nothing shows when right-clicking the icon in the tray what normally provides you with settings.
Had a look into the installed folder, but there is no settings.json file, just the language JSONs.
What am I missing?

Hi @RdedR,

thank you very much for your reply!

Yes. Normaly the settings dialog should open automaticaly on the first run or at least you should become a right-klick-contextmenu with the option to open Setup.

If this persists, even after a restart of windows, could you please open an issue on https://github.com/ernolf/NcDavTray/issues with as much information as possible about your windows version, environment, the role of your windows user etc., since I am not able to reconstruct that behaviour.
There I can ask more specific questions and instructions how to debug. That would be a great help!

ernolf

A restart did the trick. Thanks.

The window it opens looks a bit squeezed though:

to help me diagnose the cramped UI layout you’re seeing, please do the following:

  1. Open Windows PowerShell (x64).
  2. Copy-paste the script below into the console and press Enter.
  3. Send me the entire output.
  4. Additionally, please attach two screenshots:
  • Settings → System → Display: the page that shows the Scaling (%) for the monitor where the app window appears (if you have multiple monitors, one screenshot per monitor).
  • Settings → Accessibility → Text size: the percentage value shown there.

No admin rights are needed. The script is read-only and does not change anything.

Thanks!


Script (copy-paste into Windows PowerShell (x64))

# NcDavTray - Font/DPI environment probe (single-block)
# This script is read-only and does not change any settings.

$ErrorActionPreference = 'SilentlyContinue'
Add-Type -AssemblyName System.Drawing

# OS / basic
$os    = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
$arch  = (Get-CimInstance Win32_OperatingSystem).OSArchitecture

# Accessibility / text size & high contrast
$acc   = Get-ItemProperty 'HKCU:\Software\Microsoft\Accessibility'
$hc    = Get-ItemProperty 'HKCU:\Control Panel\Accessibility\HighContrast'
$desk  = Get-ItemProperty 'HKCU:\Control Panel\Desktop'

# Fonts registry & substitutions
$sub   = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes'
$reg   = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts'

# Installed font families (runtime)
$installed = [System.Drawing.Text.InstalledFontCollection]::new().Families | Select-Object -Expand Name

function Get-FontMap([string]$name) {
  if ($sub.PSObject.Properties.Name -contains $name) { "$name => " + $sub.$name } else { "$name => <not set>" }
}
function Get-FontReg([string]$name) {
  if ($reg.PSObject.Properties.Name -contains $name) { $reg.$name } else { "<missing>" }
}

# What WinForms would actually use at runtime
$probeTahoma = (New-Object System.Drawing.Font('Tahoma', 9)).Name
$probeShell2 = (New-Object System.Drawing.Font('MS Shell Dlg 2', 9)).Name

# Tahoma files present on disk (optional)
$tahomaFiles = Get-ChildItem 'C:\Windows\Fonts\tahoma*' -ErrorAction SilentlyContinue |
               Select-Object -Expand Name

$report = [PSCustomObject]@{
  OS_Version              = "$($os.DisplayVersion) (Build $($os.CurrentBuild).$($os.UBR))"
  Edition                 = $os.EditionID
  Architecture            = $arch
  UILanguage_Region       = ((Get-WinSystemLocale).Name + " | " + (Get-Culture).Name)
  Text_Size_Percent       = if ($acc.TextScaleFactor) { "$($acc.TextScaleFactor)%" } else { "100% (default)" }
  HighContrast_Flags      = $hc.Flags
  FontSub_MS_Shell_Dlg    = Get-FontMap 'MS Shell Dlg'
  FontSub_MS_Shell_Dlg_2  = Get-FontMap 'MS Shell Dlg 2'
  FontSub_Tahoma          = Get-FontMap 'Tahoma'
  Reg_Tahoma_Regular      = Get-FontReg 'Tahoma (TrueType)'
  Reg_Tahoma_Bold         = Get-FontReg 'Tahoma Bold (TrueType)'
  Installed_Tahoma        = ($installed -contains 'Tahoma')
  Installed_MSSansSerif   = ($installed -contains 'Microsoft Sans Serif')
  Installed_SegoeUI       = ($installed -contains 'Segoe UI')
  Probe_Tahoma_Runtime    = $probeTahoma
  Probe_ShellDlg2_Runtime = $probeShell2
  Tahoma_FontFiles_OnDisk = if ($tahomaFiles) { ($tahomaFiles -join '; ') } else { "<none found>" }
}

$report | Format-List *

ernolf

Version 1.1.0:

Add tabbed Settings dialog and WebClient tuning tab

  • Switch Settings dialog to a tabbed layout (Basic / WebClient tuning)
  • Add WebClient tuning tab for WebDAV WebClient limits and timeouts with UAC-guarded “Apply changes”
  • Improve dirty tracking for Settings and WebClient tuning values
  • Tweak labels, layout and tooltips; fix several minor UI issues

To upgrade from a previous version..

  • Update (Installed): download the new ZIP and run installNcDavTray.cmd → choose 1. The running instance is stopped and restarted automatically; your configuration is preserved.
  • Update (Portable): run installNcDavTray.cmd → choose 2 and point to your existing portable folder. Your *_portable.json and *_secret.dat are kept.

ernolf

Version 1.1.1:

Handle disabled WebClient service more clearly and add Italian i18n

  • Track when the WebClient service start type is set to “Disabled” and expose it via ServiceDeactivated
  • Reflect the disabled-service state in the tray icon and status texts so users see why the drive cannot be mapped
  • Add explicit warning text that points users to the “WebClient tuning” tab when the service is disabled
  • Do some minor cleanup around the WebClient tuning/UI code and remove no-longer-used bits
  • Add a complete Italian translation JSON, including WebClient tuning, tray, and service-related strings

To upgrade from a previous version..

  • Update (Installed): download the new ZIP and run installNcDavTray.cmd → choose 1. The running instance is stopped and restarted automatically; your configuration is preserved.
  • Update (Portable): run installNcDavTray.cmd → choose 2 and point to your existing portable folder. Your *_portable.json and *_secret.dat are kept.

ernolf

NcDavTray 1.1.2 — Maintenance & Stability Release

This release focuses exclusively on reliability improvements and correctness fixes.
No new features are introduced; this version is intended as a stable baseline before the upcoming 1.2.x feature series.

:check_mark: Fixes

  • Fixed Nextcloud folder picker
    A whitespace-related regression caused malformed OCS URLs (depth = …, path = …) which prevented descending into subfolders.
    The picker now works as in 1.0.x again.
  • Improved Watchdog isolation
    The Watchdog process is now scoped to the calling script’s PID, preventing cross-instance interference and enabling multiple NcDavTray instances to run concurrently, each with its own dedicated Watchdog.
  • More robust unmapping behavior
    The Watchdog now re-loads configuration before unmapping and responds more reliably to sudden USB drive removal in portable mode.

:check_mark: Cleanup

  • Removed accidental trailing spaces across the script.
  • Minor internal refactoring with no behavioral changes.

Full Changelog: Comparing v1.1.1...v1.1.2 · ernolf/NcDavTray · GitHub


Steps to upgrade from a previous version..

  • Update (Installed): download the new ZIP and run installNcDavTray.cmd → choose 1. The running instance is stopped and restarted automatically; your configuration is preserved.
  • Update (Portable): run installNcDavTray.cmd → choose 2 and point to your existing portable folder. Your *_portable.json and *_secret.dat are kept.

ernolf

NcDavTray v1.2.0

This release introduces a full WebDAV Cache Watcher & Cleaner, integrated directly into the Settings UI.

:new_button: New

  • WebDAV Cache Tab
    • Displays all files currently stored in the Windows WebDAV cache (SYSTEM-scoped WebClient cache).
    • Shows name, size, modification time & entry type for better visibility and understanding.
    • Can be started/stopped from any instance – the watcher runs elevated when needed.
    • Shared across all running NcDavTray instances (single watcher for the machine).
  • One-click cache cleanup
    • Immediate Clear Cache button to wipe all cached WebDAV files.
    • Optional privacy feature: Clear cache on exit
      If enabled, the watcher wipes the cache automatically when the last NcDavTray instance closes.

:light_bulb: Why this matters

  • Windows normally cleans WebDAV cache opportunistically, but not always perfectly.
    This feature lets advanced users observe, control and reset the cache on demand,
    helpful for troubleshooting performance issues, large file usage, or when working on shared PCs.


With this release, NcDavTray now includes every feature I personally consider essential.
Please test it thoroughly — especially the new WebDAV Cache Watcher — and let me know how it performs for you.
Feedback is highly appreciated, whether you are a power user with improvement ideas or simply enjoy the tool as it is.
I’d love to hear from both sides.

If I’m not mistaken, this is currently the smallest Nextcloud WebDAV tray client for Windows — roughly 180 KB in size. It can’t compete with the official desktop client in terms of features, but it also doesn’t dig deep into the OS and is fully removable within seconds (unlike the ~160 MB official sync client, which is a p.i.t.a. to completely uninstall).

If you like it, please spread the word and help others discover it too.


ernolf

NcDavTray v1.2.1 — A small but handy update! :rocket:

:new_button: New

  • Added a new menu option to open the mapped drive.
    You can now open your mapped drive straight from the tray. No more hunting around Windows Explorer. :tada:

:white_check_mark: Fixes & Cleanup

  • A few small gremlins were caught and removed. :bug::water_pistol:

ernolf

NcDavTray v1.2.2 — A tidy-up release

smaller, stabler, better documented. :broom::sparkles:

:new_button: What’s new

  • Screenshots in the README — the documentation now shows what NcDavTray actually looks like: tray states, context menus, Settings dialog tabs, Explorer
    with custom drive icons and labels.

  • Corrected file locking docs — the README now accurately describes how automatic Office file locking works (with and without the files_lock app), including the known same-user bypass behaviour.

:high_voltage: Smaller footprint

  • An embedded bitmap has been replaced with a more compact variant — the script is about 43 KB lighter without any visual change.

:bug: Fixes

  • Settings / UAC shield — a subtle Heisenbug that caused the WebDAV cache tab to silently ignore the first interaction is now gone
  • Cache watcher status label was missing quotes in an i18n call — fixed
  • $args in Start-InstalledInstance was shadowing a PowerShell automatic variable — renamed to $psArgs
  • Duplicate tab-variable cleanup in the FormClosed handler — removed
  • Unnecessary global: scope qualifier on an internal function — removed
  • Redundant UpdateSaveButton call in the avatar TextChanged handler — removed

:wrench: Internal

  • Extracted a shared New-HttpGetRequest factory to eliminate repeated HTTP setup boilerplate across four functions (~40 lines removed).

ernolf