rset(1) : Formulas

Windows

Windows may be used as a target for rset(1) by enabling the OpenSSH server and by installing a Linux-like environment.

Enable SSH

The SSH daemon is installed using Optional Features.

Enable

Set-Service -Name sshd -StartupType 'Automatic'
Start-Service -Name sshd

SSH clients have elevated permissions, so there is no need for the equivalent of sudo.

winget install Microsoft.Edit --source winget
edit \ProgramData\ssh\administrators_authorized_keys

Install Unix Tools

winget install Cygwin.Cygwin --source winget

Change the default shell

Set-ItemProperty -Path "HKLM:\HKEY_LOCAL_MACHINE\SOFTWARE\OpenSSH" -Name "DefaultShell" -Value "C:\cygwin64\bin\sh.exe"

Ensure Unix tools are found first in the search path

[Environment]::SetEnvironmentVariable(
  "Path",
  "C:\cygwin64\bin;" + [Environment]::GetEnvironmentVariable("Path", [EnvironmentVariableTarget]::Machine),
  [EnvironmentVariableTarget]::Machine)

Windows Scripting

PowerShell scripts are normally blocked by the Windows Execution Policy, but they are unrestricted when reading commands interactively, or on Standard In

interpreter=powershell -NonInteractive -NoLogo -Command -

ip6_config:
   Set-NetIPv6Protocol -RandomizeIdentifiers Disabled
   Set-NetIPv6Protocol -UseTemporaryAddresses Disabled

ip6_lookup:
   ( Resolve-DNSName -Type AAAA "$env:computername.lan" ).IPAddress