-
Notifications
You must be signed in to change notification settings - Fork 35
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
New-PSSession
throws a black window named 'c:\windows\system32\wsmprovhost.exe'
#85
Comments
New-Pssession
throws a black window named 'c:\windows\system32\wsmprovhost.exe'New-PSSession
throws a black window named 'c:\windows\system32\wsmprovhost.exe'
Looks like this is an unintended consequence of #70. The fact that it appears on your interactive desktop would indicate you also have The reason why this is happening is because This essentially means that we either need to
@SteveL-MSFT @PaulHigin do you have any thoughts on the matter? Personally I think the console should be explicitly hidden and I don't really think we should go out of our way to avoid the flash due to the limited use case where it will appear. |
Hello, I felt it worth weighing in on this since the I'm the architect and lead developer on an Enterprise grade automation tool which leverages PSSessions, Runspaces, etc to properly scope execution assignments. Our inherent process requires the Having read through the PowerShell/PowerShell#15128 and understanding as much of it as I could without a deep dive, I wonder if there's a more elegant solution to solve this, considering that 'EnableNetworkAccess' isn't even present in the linked comments. |
@jborean93 Thanks for your analysis on this. I agree that the /cc: @SteveL-MSFT |
Thanks for sharing your use case, I personally don't think it's a viable option as there are some nice low hanging fruit to try and reduce the impact here. One question I do, is there a reason why you are using
An alternative solution IIRC was to try and fix .NET so that Option 1 - Hide the Console After SpawningAllocConsole();
ShowWindow(GetConsoleWindow(), SW_HIDE); Only downside here is that there will still be a flash that occurs after it is spawned but before it is hidden. Advantages is that it's very simple and doesn't have much of an overhead. Option 2 - Hide the Console Before SpawningSTARTUPINFO startupInfo;
startupInfo.cb = sizeof(startupInfo);
startupInfo.dwFlags = STARTF_USESHOWWINDOW;
startupInfo.wShowWindow = SW_HIDE;
PROCESS_INFORMATION processInfo;
if (CreateProcess(NULL, "cmd.exe", NULL, NULL, FALSE,
CREATE_NEW_CONSOLE, NULL, NULL, &startupInfo, &processInfo))
{
AttachConsole(processInfo.dwProcessId);
TerminateProcess(processInfo.hProcess, 0);
} This spawns a new console app ( Option 3 - Do not spawn a console for -EnableNetworkAccessHANDLE token
DWORD length = 0;
DWORD sessionId = 0;
OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
if (GetTokenInformation(token, TokenSessionId, &sessionId, sizeof(sessionId), &length))
{
if (sessionId == 0)
{
AllocConsole();
}
} This only spawns the console when running in session 0 (not @tbakerweb do you find option 1 (with the brief flash) an acceptable middle ground here? |
Not that I'm aware of, PowerShell could just assume a code page but then it will have the same problem when it spawns a new process which creates the conhost and is set to a different code page. It could add some heuristics to try and find the correct default but even then that's not a guarantee it will be correct, you essentially need to have a console attached to get the actual value. PowerShell could delay the initialization of the conhost (what's in option 2) until it spawns it's first process but that doesn't help code that might call |
Notice, we already have |
hi @jborean93 , |
Hmm I have no idea why it appears for you then, without |
hi @tbakerweb kasini3000 kasini3000_agent_linux Shell script,one click install powershell on linux,modify sshd_config for PsRemote.
|
@WG-Remoting Removing WG-Remoting label since this is not a remoting issue, but instead a PowerShell console issue. |
@SteveL-MSFT This issue may be causing another recent remoting problem with GMSA accounts (#17367). I feel this change should be reverted. |
I experience this issue as well but I do not use Once a session is removed the ghost window disappears. I hope you guys don't give up from this as it's really annoying to minimize the window since it spawns over the PS console on which we work, is at least there a workaround to minimize the ghost window within a script? |
I feel this should be fixed and will bring it up with the review committee. |
@PowerShell/powershell-committee discussed this. We propose a short term fix of simply hiding the window as this will be least risky and will improve the current experience. Longer term, we should figure out a more ideal solution. |
Prerequisites
Steps to reproduce
Enable-PSRemoting
in pwsh v7.2.0 and config winrm to listen to HTTPS.Unregister-PSSessionConfiguration PowerShell.7
winrm invoke Restore http://schemas.microsoft.com/wbem/wsman/1/config/plugin '@{}'
Enable-PSRemoting
in pwsh v7.2.1 and re-config winrm to listen to HTTPS.p.s.
Get-PSSessionConfiguration
.Expected behavior
all pssession stuff runs in background and no black window pops up.
Actual behavior
Error details
No response
Environment data
Visuals
The text was updated successfully, but these errors were encountered: