Creating a SysInternals PSExec Console Task for OpsMgr 2007

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.

image image

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.

‘start startpsexec.vbs

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")

‘End startpsexec.vbs


  • SysInternals PSTools (these need to be installed on all machines where the OpsMgr Console is being used)
  • Add the PSTools directory to the PATH System variable
  • Startpsexec.vbs script (this vbscript needs to be installed on all machines where the OpsMgr Console is being used)


  1. Save above Vbscript on a location where all OpsMgr Console have access to. (like d:\scripts\startpsexec.vbs)
  2. Create a new Console Command Line Task
  3. Give the Task a Name like “Remote Interactive CmdPrompt”
  4. Target the Task to Windows Server
  5. Enter at Application: %WINDIR%\SYSTEM32\cscript.exe
    Enter at Parameters: D:\Scripts\startpsexec.vbs $Target/Property[Type="MicrosoftWindowsLibrary6062780!Microsoft.Windows.Computer"]/DNSName$
    Disable Display output when this task is run.
  6. Save Task



Comments (2)

  1. Anonymous says:

    Hi Pete, Thanks for telling me. Why didn’t find your article before 😉

    You solved it by creatingediting the Console Task (without the space) directly in the MP XML file.



    Stefan Stranger

  2. Anonymous says:


    I blogged about this UI bug and created how-to with an MP a few months ago..

Skip to main content