This article provides a solution by which you can automatically process failed service requests and mark them as REJECTED. To do so, you will use the Windows Task Scheduler to connect to the vCommander® API and make the status change. Embotics® recommends this be done once a day, at midnight or another time of low activity.


Preparing the Script

Download and extract the script to your vCommander application server. Embotics recommends storing all scripts called by vCommander in a single location, using sub-folders to identify the functions of scripts. With the script used for this solution extracted to C: on the vCommander server, the file system will look like this:

  • C:\scripts\cleanup\cleanupoldrequests.ps1

The script requires minor edits before it will work with your system.


The hostname or IP address of the vCommander server.

The credentials file which handles access to your vCommander. For more details refer to this knowledgebase article.

The age of failed service requests to be set as rejected, in days.

Filename and location of the transcript file to log this script's activity.

Set to true to record the script's activity to the log file named above.

Creating the Scheduled Task

Windows Task Scheduler is used to execute the script on a schedule you define. The steps below are an example using Windows 2008 R2. Other versions of the server OS may introduce slight variations. If you encounter these, please refer to Microsoft documentation or contact Embotics Technical Support for assistance.

  1. Logged in as an Administrator, open Task Scheduler from the Administrative Tools in the Start Menu.
  2. In the Actions pane, click Create Basic Task.
  3. Name the task Reject Failed vCommander Service Requests and add a meaningful Description. Click Next.

  4. Choose to trigger the task Daily and click Next. Choose a time to run the task, and set it to recur every day. Click Next.

  5. Choose Start a program and click Next.
  6. Click Browse... to locate the PowerShell executable. Set Add arguments (optional) to the following and click Next:

    "& ""C:\Scripts\cleanup\cleanupoldrequests.ps1"""

  7. Click Finish.

The task name will now appear in the Active Tasks list in the Task Scheduler