The Dell Kace agent opens a blank command processor window. Users can close the window causing the script to end prematurely.

Script type: Online shell script.

Script text: cscript hidecmd.vbs

Dependencies: HideCMD.VBS, Test.bat

--- Test.bat ---

echo do something here

--- end test.bat

---- HideCMD.VBS ---

dim NameOfBatch, CurrentDirectory, FullPath
NameOfBatch = "test.bat"

'Get current directory where the batch file is running

CurrentDirectory = left(WScript.ScriptFullName,(Len(WScript.ScriptFullName))-(len(WScript.ScriptName)))

' for debugging only WScript.Echo currentDirectory

FullPath = CurrentDirectory&NameOfBatch

'From MS website on how to hide a command processor window

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = HIDDEN_WINDOW
Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")
errReturn = objProcess.Create(FullPath, CurrentDirectory, objConfig, intProcessID)
---- end HideCMD.VBS ---