From 06d8c0182051345e72e68965f9d166307bcb347c Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Wed, 14 Dec 2022 16:17:42 -0800 Subject: [PATCH] Hide the console for WinRM remoting (#86) --- .../nativemsh/pwrshplugin/pwrshclrhost.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/powershell-native/nativemsh/pwrshplugin/pwrshclrhost.cpp b/src/powershell-native/nativemsh/pwrshplugin/pwrshclrhost.cpp index d2e56e5..69068f3 100644 --- a/src/powershell-native/nativemsh/pwrshplugin/pwrshclrhost.cpp +++ b/src/powershell-native/nativemsh/pwrshplugin/pwrshclrhost.cpp @@ -39,6 +39,13 @@ unsigned int PowerShellCoreClrWorker::LaunchClr( { // Allocate a console so that the codepage is setup correctly AllocConsole(); + HWND console = GetConsoleWindow(); + if (console != NULL) + { + // Hide the console window + ShowWindow(console, SW_HIDE); + } + return commonLib->LaunchCoreCLR(hostWrapper, hostEnvironment, friendlyName); }