tomashubelbauer / ps-remoting Goto Github PK
View Code? Open in Web Editor NEWPowerShell remoting with Windows Sandbox
License: MIT License
PowerShell remoting with Windows Sandbox
License: MIT License
I was looking for ways to remote into a Windows Sandbox VM, and found this.
I tried Enable-PSRemoting
within the sandbox, and got the following error:
I then ran Get-NetConnectionProfile | Set-NetConnectionProfile -NetworkCategory Private
, though there may be a configuration possible in the Sandbox definition to address this, and then Enable-PSRemoting -Force
. You could also use -SkipNetworkProfileCheck
, of course.
After this, running Invoke-Command
(or Enter-PSSession
) against the machine worked (on my box, at least).
I suspect that you may need to add something to your trusted hosts, such that you can authenticate. Have a look at something like this.
The credential you should use is provided to the WindowsSandboxClient as process arguments (and I haven't yet figured out how to run Sandbox headlessly) - you can retrieve it by viewing the process in procexp.exe (or task manager), or with PowerShell, as below:
if ((Get-Process WindowsSandboxClient).CommandLine -match "<AccountUser>(?<User>.+)</AccountUser><AccountPassword>(?<Password>.+?)</") {
$Credential = [PSCredential]::new(
$Matches.User,
($Matches.Password | ConvertTo-SecureString -AsPlainText -Force)
)
} else {Write-Error "Didn't find a match"}
Unless folk change the disk image being used for the sandbox, it's unlikely to ever use a different username, but may as well grab it out!
The only problem remaining, then, is getting the machine name or connection address out. Connecting to the container ID specified in the arguments passed to WindowsSandboxClient doesn't work (but would have solved a lot of problems). I suspect it's not being treated like that sort of container.
We could mount a directory, and have the init commands for the Sandbox write a file to that location, but there should be a better way!
Sorry if you'd already solved all of this! I'd be interested to hear if you're already past all of this, or if there were any updates for this repository.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.