Every team has that one legacy build still tethered to a Windows Server 2019 box running Mercurial. It works fine, until someone new joins, asks for access, and you realize the server configuration lives in someone’s decade-old notes. Getting Mercurial running predictably on modern Windows Server infrastructure is possible, and easier than you think.
Mercurial is a distributed version control system known for speed and simplicity. Windows Server 2019 adds strong domain security, robust PowerShell automation, and identity-based permissions through Active Directory. When combined, they create a controlled environment where source history and server policy can live peacefully.
The logic is simple. Use Windows authentication to gate repository access, then let Mercurial handle versioning without extra user management. A service account connects to the shared repo folders. NTFS permissions define read and write boundaries. Administrators can tie everything to their central AD schema, and developers only see what they should.
To set it up cleanly, start with a dedicated repository directory. Assign least privilege to a group like “HgUsers.” Configure Mercurial’s hgrc file to point to that folder, referencing user identities from your domain. Map logs to an event collector, not just local text files, so you can audit who cloned or pushed. Windows Server’s built-in backup and volume shadow copies take care of disaster recovery.
A common snag is permissions caching. Developers sometimes inherit access long after they leave a group. Solve that by refreshing group membership tokens on login and regularly pruning AD roles. Also watch for Mercurial hooks that trigger scripts using outdated Python paths or local credentials. A short PowerShell health check can flag these before they break builds.