Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Powershell.exe #9

Open
djarbz opened this issue Aug 2, 2022 · 3 comments
Open

Powershell.exe #9

djarbz opened this issue Aug 2, 2022 · 3 comments

Comments

@djarbz
Copy link

djarbz commented Aug 2, 2022

Hello,

In a standard WSL2 image I am able to run powershell.exe in the WSL bash terminal in order to interact with the host Powershell.
I am unable to do so from the Fedora image.

This would be useful to allow automated port mapping on the HOST IP to podman services.
I could add the following lines to my service file as ExecStartPost and add the appropriate lines for the ExecStopPost to remove the entries.

netsh interface portproxy add v4tov4 listenport=<HOST PORT> connectport=<PODMAN MACHINE PORT> connectaddress=<PODMAN MACHINE IP>
New-NetFirewallRule -DisplayName "$($RuleName)" -Description "Rule to allow incoming traffic to port proxy to the Podman WSL2 machine instance." -Group "Podman Port Proxy" -Enabled True -Profile Any -Direction Inbound -Action Allow -Protocol TCP -LocalPort <HOST PORT>

@gbraad
Copy link
Member

gbraad commented Jun 19, 2023

This needs a binfmt registration. I think this can be set with:

sudo echo ":WSLInterop:M::MZ::/init:" > /proc/sys/fs/binfmt_misc/register

If this works this could be set from the podman machine init. I don't think this needs an image change.

@djarbz
Copy link
Author

djarbz commented Jun 22, 2023

This needs a binfmt registration. I think this can be set with:

sudo echo ":WSLInterop:M::MZ::/init:" > /proc/sys/fs/binfmt_misc/register

If this works this could be set from the podman machine init. I don't think this needs an image change.

Thanks for your input, unfortunately, I no longer have a Windows Podman setup to test this with.

@Karsten7
Copy link

This needs a binfmt registration. I think this can be set with:

sudo echo ":WSLInterop:M::MZ::/init:" > /proc/sys/fs/binfmt_misc/register

If this works this could be set from the podman machine init. I don't think this needs an image change.

I didn't try this, as one only needs to exit the nested namespace. pwsh.exe can be run from the parent namespace.

pwsh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants