Configuring Agent as a Scheduled Task
Overview
The EPMware Agent needs to run continuously on Windows servers to poll for deployment tasks. Windows Task Scheduler provides a reliable way to ensure the agent starts automatically and remains running.
Prerequisites
Before configuring the scheduled task:
- [ ] Agent files are installed in the correct directory
- [ ]
agent.propertiesis configured - [ ] Java is installed and in the system PATH
- [ ] You have administrator privileges
Creating the Scheduled Task
Step 1: Open Task Scheduler
- Log on to the Windows server with Administrator privileges
- Open Task Scheduler using one of these methods:
- Search for "Task Scheduler" in the Start menu
- Run
taskschd.mscfrom the command prompt - Navigate through Control Panel → Administrative Tools

Opening Windows Task Scheduler
Step 2: Create New Task
- In Task Scheduler, click Create Task in the Actions panel (right side)

Create Task option in the Actions menu
Step 3: Configure General Settings
In the General tab, configure the following:
| Setting | Value |
|---|---|
| Name | EPMWARE TARGET AGENT SERVICE |
| Description | EPMware Agent for metadata deployment to target applications |
| Security Options | Run whether user is logged on or not |
| Run with highest privileges | ✓ Checked |
| Configure for | Windows Server 2016/2019/2022 (as appropriate) |

General settings for the scheduled task
Step 4: Configure Triggers
- Click on the Triggers tab
- Click New to create a trigger
- Configure the trigger settings:
| Setting | Value |
|---|---|
| Begin the task | At startup |
| Delay task for | 30 seconds (optional, allows services to start) |
| Enabled | ✓ Checked |

Configuring the startup trigger
Additional Triggers
You can add multiple triggers, such as: - Daily at specific time for regular restarts - On workstation unlock for development environments - On an event for integration with monitoring systems
Step 5: Configure Actions
- Click on the Actions tab
- Click New to create an action
- Configure the action settings:
| Field | Value | Notes |
|---|---|---|
| Action | Start a program | |
| Program/script | C:\cygwin64\bin\bash.exe |
Adjust path if Cygwin is installed elsewhere |
| Add arguments | -l -c "./ew_target_service.sh" |
|
| Start in | C:\cygwin64\bin |
Must be the Cygwin bin directory |

Configuring the action to start the agent
Path Accuracy
Ensure the Cygwin path matches your installation. The default is C:\cygwin64, but it may be different in your environment.
Step 6: Configure Conditions
- Click on the Conditions tab
- Configure the following settings:
| Setting | Value |
|---|---|
| Start only if on AC power | ☐ Unchecked (for servers) |
| Stop if switches to battery | ☐ Unchecked |
| Start only if network available | ✓ Checked |
| Wake computer to run | ☐ Unchecked |
Step 7: Configure Settings
- Click on the Settings tab
- Configure the following:
| Setting | Value |
|---|---|
| Allow task to be run on demand | ✓ Checked |
| Run task as soon as possible after missed start | ✓ Checked |
| If task fails, restart every | 1 minute |
| Attempt restart up to | 3 times |
| Stop task if runs longer than | ☐ Unchecked |
| If running task does not end when requested | ✓ Force stop |
Step 8: Save with Credentials
- Click OK to save the task
- Enter credentials when prompted:
- Username: Use the same user under which Cygwin is installed
- Password: Enter the user's password
- These credentials will be used to run the task

Entering credentials for the scheduled task
Starting the Scheduled Task
Manual Start
- In Task Scheduler, locate
EPMWARE TARGET AGENT SERVICE - Right-click the task
- Select Run

Manually starting the scheduled task
Verify Task is Running
Check the task status: 1. The Status column should show "Running" 2. Last Run Result should show "The operation completed successfully. (0x0)"

Scheduled task running successfully
Monitoring the Scheduled Task
Task History
Enable task history to track execution: 1. In Task Scheduler, click Enable All Tasks History in the Actions panel 2. Select your task and click the History tab
Check Agent Logs
Verify the agent is working by checking log files:
# Navigate to agent directory
cd C:\cygwin64\home\Administrator\logs
# Check polling log
type agent-poll.log
# Check main agent log
type agent.log
The logs should show: - agent-poll.log: Regular polling entries every 30 seconds - agent.log: Deployment activities and any errors

Sample agent log entries showing normal operation
Troubleshooting Scheduled Tasks
Common Issues
| Issue | Solution |
|---|---|
| Task won't start | Verify Cygwin path and user permissions |
| Task starts but stops immediately | Check agent.properties configuration |
| "Access Denied" error | Ensure user has "Log on as batch job" permission |
| Task runs but agent doesn't poll | Verify Java is in PATH for the task user |
Permission Requirements
The task user account needs: - Log on as a batch job right - Read/write access to agent directory - Execute permission for Java and Cygwin
To grant "Log on as batch job":
1. Run secpol.msc
2. Navigate to Local Policies → User Rights Assignment
3. Add user to "Log on as a batch job"
Debugging Steps
-
Check Task History
-
Run Manually in Cygwin
-
Enable Detailed Logging Add to agent.properties:
Best Practices
Security Recommendations
- Use a dedicated service account for the agent
- Implement least privilege principle
- Store credentials securely
- Regular password rotation for service account
Monitoring Setup
- Configure email notifications for task failures
- Set up monitoring alerts for log file errors
- Implement health check scripts
- Monitor disk space for log files
Maintenance Tasks
- Weekly: Review agent logs for errors
- Monthly: Clean up old log files
- Quarterly: Update agent software if needed
- Annually: Review and update service account permissions
High Availability
For production environments, consider setting up a secondary server with an identical scheduled task configuration for failover capabilities.
Java Process Cleanup
When stopping the scheduled task, the Java process may not terminate automatically. Always verify and manually terminate if necessary before restarting.
Advanced Configuration
Multiple Agent Instances
To run multiple agents for different applications:
- Create separate directories for each agent
- Configure unique
agent.propertiesfor each - Create separate scheduled tasks with distinct names
- Use different polling intervals to prevent conflicts
PowerShell Alternative
For environments preferring PowerShell:
# Create scheduled task via PowerShell
$action = New-ScheduledTaskAction -Execute "C:\cygwin64\bin\bash.exe" `
-Argument '-l -c "./ew_target_service.sh"' `
-WorkingDirectory "C:\cygwin64\bin"
$trigger = New-ScheduledTaskTrigger -AtStartup
$settings = New-ScheduledTaskSettingsSet -RestartCount 3 `
-RestartInterval (New-TimeSpan -Minutes 1)
Register-ScheduledTask -TaskName "EPMWARE TARGET AGENT SERVICE" `
-Action $action -Trigger $trigger -Settings $settings `
-User "DOMAIN\ServiceAccount" -Password "SecurePassword"
Next Steps
After configuring the scheduled task:
