2

I set Bash to be the primary shell on Windows when I SSH, using the following:

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\WINDOWS\System32\bash.exe" -PropertyType String -Force

Now, when I SSH into my Windows machine, I get a Bash shell (as I wanted). Ordinarily, if I want to reboot a Linux computer during an ssh session I can just type reboot in the terminal. But when I ssh into a Bash shell on Windows Subsystem for Linux and type reboot I get an error message:

System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down

I want to be able to reboot my Windows machine (not just the ssh-session) so that my computer returns to the grub menu (I am dual booting). Is there a way for me to do this? Can I, for example, type a command to spawn a Powershell session through ssh? Thanks!

2

1 Answer 1

4

From some google searches, I've determined that you can type the following into a remote instance of WSL to achieve the result I want:

powershell.exe -command restart-computer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .