Windows via Remote Desktop and other strangeness

Ok, I think this might be my actual last post, but had a great conversation about Windows development with Vlad, and here is what I learned:

  1. The easiest way to work is to Remote Desktop, this is easy to get and if you are on the Mac, means that you get things that work well (like Zoom!), but it’s complicated to setup. This works great for static development, but when you try to run a game engine for instance, performance is not surprisingly terrible with default settings. A machine that gives 100 fps slows to 0.5-2 frames per second with RDP. So it’s great for things like still editing or development, but not for video games. You can see why nVidia has put so much work into their remoting technology.
  2. Second lesson is that I should give up scripting and reproducibility, there are many things that are documented as scriptable but which don’t work. The easiest way to get reproducibility is to just save a disk image and reload it. I’m way too used to the Linux/MacOS way of everything is in a batch script.
  3. Finally a bunch of notes about dead ends I’ve tried but mainly getting Powershell scripts to work is a real pain if you are starting from turning on Remote Desktop automatically to running as an Admin with Powerscript.
  4. I tried and failed to get docker desktop to work (see below)

More notes are below (and more breadcrumbs):

Remote Desktop needs Windows Pro or higher.. First note is that the Windows Home I’ve been using doesn’t support RDP, so you have to upgrade to Windows Pro to do this. Fortunately this worked sort of. I got a product key from the Microsoft Store, but upgrading is not simple. It’s buried way down in the Settings menu, but you have to Settings and then hit change Product Key, there is no upgrade button. Then it says activation failed, but when you reboot and try again, it does work. Strange.

Turning on Remote Desktop. There is a bunch on the internet about how you can get this to work with:

Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server'-name "fDenyTSConnections" -Value 0

in PowerShell, but this is one case where even though it said it set it, it did not work. I guess the latest version of Windows has a different registry key. And the UI for the current Windows 10 version looks nothing like the various things on Slack. So you have to enable it manually from the Windows menubar at Settings > System > Remote Desktop. I can see that I set this registry key ok, but it didn’t turn it on. It then asks to do an enable a Network group, but that group policy isn’t even found.

Then on the Mac side, things are a bit easier, you can brew install microsoft-remotedesktop and then comes the hackery of figuring out your password. It says that you can go to your Windows machines and switch to a local account, set the password, and then relogin as a Microsoft account, but this didn’t work for me, so it looks like only local account works.

One nice thing is that you can remote your files on your Mac with something called folder redirection. If you do this, then your home folders for instance show up in the Windows Explorer in the strange category of redirected drives and folders so it looks like it uses a network drive to give you the illusion that you are connected at as \\tsclient.

Note that WSL2 does the same trick you get a network drive called \\wsl$ and yes that’s a dollar sign and you can see the various Linux virtual machines. For instance, I can see \\wsl$\docker desktop (but that’s another story). And if you start WSL2, then you will see a $wsl$\Ubuntu 20.04 which is how they unify the file systems. Similarly in WSL2 land, you see /mnt/c/Users for instance as the c:\Users directory but performance is pretty bad on each side I found, so for instance you need git installed on both sides with separate trees if you want to do some things on the WSL side and other things on the Windows side.

Finally, configuring the thing correctly for Windows, you want to change a few things to make it useful, here are the settings that I use, “reconnect if the connection is dropped” and then the key settings are “optimize for retina displays` and then “update the session resolution on resize” so that you can resize the window and you don’t pass the entire 4K sessions and you can maximize the Windows application and treat it like a single purpose application.

This is particularly important since the Mac hides most of the interesting control keys like Command so it is hard to do window management.rich


Using Administrative Shell. On scripting I made some small progress, the really painful need to right click to get an administrative privilege is sort of handled in scoop with a sudo that you can get in emulation from scoop install psutils this gives you the ability to do sudo choco install vscode for instance from PowerShell so you don’t always have to run back and forth. The manual way to do this is with powershell.exe Start-Process powershell -RunAs -ArgumentList('choco list') for instance, but I definitely have not figured out the quoting necessary to take your from a WSL2 bash script to a bash function to running this properly. So instead, you can just run powershell.exe sudo choco list from WSL2 and this works.

Changing registry entries from a script. Ok this is painful but doable. The main issue is that the registry settings may change, but basically you can use a command-let (and yes I don’t know what that means), but git if some options and yes in Windows options are single dash not double dash and you can set things. And you can even do a sudo ./install-ssh.ps1 for example to but make sure you have the ./ there as it needs a file path and doesn’t default to the current directory.

Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer -Name HideSCAVolume -Value 0 -Force

And a final reminder, remember to set git config core.autocrlf auto because on the Windows side, they are using CRLF as the ending while Unix uses CR and this fixes it.

I’m Rich & Co.

Welcome to Tongfamily, our cozy corner of the internet dedicated to all things technology and interesting. Here, we invite you to join us on a journey of tips, tricks, and traps. Let’s get geeky!

Let’s connect

Recent posts

Loading Mastodon feed…