Software⏱️ 5 min read📅 2026-06-15

How to Fix: Windows scheduled Task - Stopping Console w/ error & Re-starting the service

Windows scheduled task issue with Java console error and restart

Quick Answer: Use a batch script to cancel the Java console, then start it again.

A scheduled task in Windows can be used to automate tasks, including starting and stopping services. However, some users may encounter issues with the task not working as expected, such as stopping the console with an error and then restarting the service. This issue affects users who need to manage their Java-based services, like Wowza, which can experience heap errors.

This problem is frustrating because it prevents the user from achieving their desired outcome, which is to restart the Wowza service without any issues. However, don't worry, we have a solution for you.

🔍 Why This Happens

  • The primary reason why this error happens is due to the task not being able to stop the console process correctly, resulting in an error message. This can be caused by various factors, such as the task being set up incorrectly or the console process not being properly terminated.
  • Another possible cause of this issue could be related to the Windows Task Scheduler itself, which may have limitations or issues with certain tasks.

🛠️ Step-by-Step Verified Fixes

Stopping Console w/ error & Re-starting the service

  1. Step 1: Step 1: Create a new task in the Task Scheduler.
  2. Step 2: Open the Task Scheduler and create a new task by clicking on 'Create Basic Task' in the right-hand Actions panel. Give your task a name, such as 'Restart Wowza Service'.
  3. Step 3: Step 2: Set up the task to stop the console process with an error and then restart it.
  4. Step 4: In the 'Triggers' tab, set up a trigger that runs the task at the desired time (e.g., every night). In the 'Actions' tab, select 'Start a program' and enter the path to the Java executable. Add the following command-line arguments: `java -Xms1024m -Xmx2048m -jar wowza.jar`. This will start the Wowza service with increased heap size. Next, add another action to stop the console process: `taskkill /im console.exe /f`. Finally, add an action to restart the Wowza service: `java -Xms1024m -Xmx2048m -jar wowza.jar` (same as before).
  5. Step 5: Step 3: Save and test the task.
  6. Step 6: Save the task by clicking 'OK' and then test it by running the task manually or waiting for the scheduled trigger to run.

Alternative Method using PowerShell

  1. Step 1: Step 1: Open PowerShell as an administrator.
  2. Step 2: Open PowerShell as an administrator and navigate to the directory where your Wowza service is located. You can do this by running `cd C:\Path\To\Wowza` (replace with the actual path).
  3. Step 3: Step 2: Create a new task using PowerShell.
  4. Step 4: Run the following command to create a new task: `New-ScheduledTaskAction -Action 'Start-Process' -ArgumentList ('C:\Path\To\Java\bin\java.exe', '-Xms1024m', '-Xmx2048m', '-jar wowza.jar') -Name 'Restart Wowza Service'`. This will create a new task that starts the Wowza service with increased heap size. Next, add another action to stop the console process: `New-ScheduledTaskAction -Action 'Taskkill' -ArgumentList '/im console.exe /f' -Name 'Stop Console Process'`. Finally, add an action to restart the Wowza service: `New-ScheduledTaskAction -Action 'Start-Process' -ArgumentList ('C:\Path\To\Java\bin\java.exe', '-Xms1024m', '-Xmx2048m', '-jar wowza.jar') -Name 'Restart Wowza Service'`.
  5. Step 5: Step 3: Save and test the task.
  6. Step 6: Save the task by running `Register-ScheduledTask -ActionId 'Restart Wowza Service'` (replace with the actual action ID). Then, test the task by waiting for the scheduled trigger to run or running it manually.

✨ Wrapping Up

By following these steps, you should be able to create a scheduled task that stops the Java console process with an error and then restarts the Wowza service. Remember to save and test your task regularly to ensure it's working as expected.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions