Navigation
Introduction
Leveraging Workspace One APIs via PowerShell scripts can be extremely useful in automating tasks, however there may be circumstances where you have a need to run scripts at a specific time, or have a script regularly run on a schedule.
In this post I’ll run you through how you can achieve this by using Windows Server, and task scheduler using my ForceReprocess.ps1 script.
All screenshots on this page can be enlarged by clicking on the image.
What You’ll Need
- 1 x Physical or Virtual Windows Server with access to the internet (this can be a VM)
- A service account
💡This is required as scripts will be run using this account - PowerShell script/s such as those in my Github Repo copied to a location on the server eg. C:\Scripting\
💡If using any of my scripts, ensure you’ve run them manually once as the service account, to generate an encrypted credentials XML file so the script can run successfully without any user interaction
How-To
The below instructions is an example of setting the ForceReprocess.ps1 script from my Github Repo once per day. You can customise the script that is run, or frequency based upon your use case / needs.
- RDP into the Windows Server using an admin account
- Open Task Scheduler by going to Start > Control Panel > Administrative Tools > Task Scheduler
- Select Task Scheduler Library and right-click to open the context menu on the right hand side of the screen.
- Choose Create Task

- Enter a name for this new task, and select Change User
- Specify the service account you’ll be using to run this scheduled task
- Select the Run whether user is logged on or not option, and untick Do not store password
- Click OK

- Select the Triggers tab and click New…

- Set Begin the task as On a schedule
- Under settings, choose a frequency. For this example I have set this as Daily
- Specify a Start date and time for the task to be run
- Ensure the Enabled check box is ticked
- Click OK

- Select the Actions tab and click New…

- Set the Action as Start a program
- In the Program/script box type in powershell
- In the Add arguments box type in -NonInteractive -file “filepath of script”
- Example: -NonInteractive -file “C:\Scripts\ForceReprocess.ps1”
- Click OK

- Select the Settings tab and specify additional settings that affect the behaviour of the task
💡It’s a good idea to enable the Stop the task if it runs longer than option to ensure the task is stopped if the script were ever to stall - Click OK

- Type in the password for the service account
- Click OK

- If the task was successfully created, then you’ll see a new task in the Task Scheduler library with the name you set earlier
- Rinse and repeat the above steps for any additional powershell scripts you’d like to run on a schedule

Conclusion
Scheduling PowerShell scripts using Windows Task Scheduler is a straightforward and effective way to automate Workspace One API tasks. By following the steps outlined in this guide, you can ensure that scripts run at the desired intervals without manual intervention.
Using a dedicated service account enhances security and reliability, while configuring task settings such as execution frequency and timeout options helps prevent issues like stalled scripts.