Pete Zerger wrote an article about creating a Console Task to launch a Remote Interactive CmdPrompt for MOM 2005 using PSExec. A customer asked if this also could be done for OpsMgr 2007, this was not as easy as I thought. It turned out that an extra space is added before the servername where psexec wants to connect if you create a Command Line Console Task. I don’t know why this extra space is added after saving the Console Task yet.
To solve this issue I created a Vbscript which has the servername as argument and can be used to start psexec from within a vbscript.
Option Explicit On error resume next
Dim strServer strServer = CStr(WScript.Arguments(0)) Set objShell = CreateObject("WScript.Shell") ObjShell.Run ("%comspec% /C psexec.exe \\" & strServer & " cmd.exe /S, 4, true")