# Windows via Remote Desktop and other strangeness

- Link: https://tongfamily.com/2021/04/16/windows-via-remote-desktop-and-other-strangeness/
- Published: 2021-04-16T11:34:31-07:00
- Author: rich

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](https://support.microsoft.com/en-us/windows/upgrade-windows-10-home-to-windows-10-pro-ef34d520-e73f-3198-c525-d1a218cc2818#:~:text=1%20Select%20the%20Start%20button%2C%20then%20select%20Settings,the%20upgrade%20to%20Windows%2010%20Pro.%20See%20More)
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](https://dennymichael.net/2016/01/11/windows-10-remote-desktop-rpd-using-microsoft-account-aka-live-account/#:~:text=Windows%2010%20Remote%20Desktop%20%28RPD%29%20using%20Microsoft%20Account,8%20Now%20log%20in%20using%20.%5Cqwerty%40outlook.com.%20More%20items).
There is a bunch on the internet about [how you can get this to work](https://theitbros.com/how-to-remotely-enable-remote-desktop-using-powershell/)
with:

    ```wp-block-code
    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](https://stackoverflow.com/questions/7690994/running-a-command-as-administrator-using-powershell#:~:text=%20Create%20a%20shortcut%20to%20your%20script%20and,Advanced...%20and%20enable%20Run%20as%20administrator%20More%20).
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](https://www.thewindowsclub.com/change-registry-using-windows-powershell).
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.p`s1 for 
example to but make sure you have the ./ there as it needs a file path and doesn’t
default to the current directory.

    ```wp-block-code
    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.

### Share this:

 * [  Mastodon ](https://tongfamily.com/2021/04/16/windows-via-remote-desktop-and-other-strangeness/?share=mastodon)
 * [  LinkedIn ](https://tongfamily.com/2021/04/16/windows-via-remote-desktop-and-other-strangeness/?share=linkedin)
 * [  Facebook ](https://tongfamily.com/2021/04/16/windows-via-remote-desktop-and-other-strangeness/?share=facebook)
 * [  WhatsApp ](https://tongfamily.com/2021/04/16/windows-via-remote-desktop-and-other-strangeness/?share=jetpack-whatsapp)
 * [  Email ](https://tongfamily.com/2021/04/16/windows-via-remote-desktop-and-other-strangeness/?subject=%5BShared%20Post%5D%20Windows%20via%20Remote%20Desktop%20and%20other%20strangeness&body=https%3A%2F%2Ftongfamily.com%2F2021%2F04%2F16%2Fwindows-via-remote-desktop-and-other-strangeness%2F&share=email)
 * [More](https://tongfamily.com/2021/04/16/windows-via-remote-desktop-and-other-strangeness/#)

 * [  Telegram ](https://tongfamily.com/2021/04/16/windows-via-remote-desktop-and-other-strangeness/?share=telegram)
 * [  Print ](https://tongfamily.com/2021/04/16/windows-via-remote-desktop-and-other-strangeness/#print?share=print)
 * [  Pinterest ](https://tongfamily.com/2021/04/16/windows-via-remote-desktop-and-other-strangeness/?share=pinterest)
 * [  Tumblr ](https://tongfamily.com/2021/04/16/windows-via-remote-desktop-and-other-strangeness/?share=tumblr)
 * [  X ](https://tongfamily.com/2021/04/16/windows-via-remote-desktop-and-other-strangeness/?share=twitter)

### Like this:

Like Loading…
