I'm trying to use Windows Sandbox with a PowerShell logon command. This is the LogonCommand section of my WSB file:
<LogonCommand>
<Command>C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -executionpolicy unrestricted -file "C:\\Users\\WDAGUtilityAccount\\Desktop\\boot.ps1" -noexit</Command>
</LogonCommand>
The Windows Sandbox instance loads up okay suggesting no syntactic/validation issues with the WSB file content, but the PowerShell window is not shown. Adding -windowstyle normal has no effect.
I suspect the LogonCommand content is run in a command prompt which is not made visible so running the command to open PowerShell from it somehow "inherits" the terminal window not being visible.
Is it possible to force the PowerShell terminal window to reveal itself in such a case? I want to do this so that I can see the errors that I get because the PowerShell script is not executing as expected and I'm blind to any output/progress indication.
Found an answer (doesn't look like the cleanest option, but works):
powershellswitches from CMD to PowerShell-windowstyle normalwon't work to make this PowerShell window visible-executionpolicy unrestrictedallows the nested PowerShell to run from filestart powershellruns another PowerShell with visible windowLogonCommandwill not work-noexittells the nested PowerShell to remain visible-file C:\Users\WDAGUtilityAccount\Desktop\boot.ps1runs the given scriptMappedFolderin the WSB configuration