From bf811d3a19af28ba8cae9e6d220f3b18eb4266aa Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Wed, 14 Dec 2022 15:08:57 -0800 Subject: [PATCH] hide the console for WinRM remoting --- .../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); }