Scheduled Federation FireScope to Cherwell CMDB Using Windows Task Scheduler.

Windows Task Scheduler (equivalent will work with other OS like Linux):

If you are not familiar with Task Scheduler, first visit a website that explains how to use it.

Could not get PowerShell to run from TS, so used two tasks that hit the preview then export URIs separately, thirty minutes apart.

The query strings below (provided by FireScope thanks) invoke staging (preview) and federation (export)--

Preview command
http://stratis.yourdomain/cw_cmdb_mgmt.php?ajax=1&action=outboundgeneratepreview&page=3&token=<yourtoken>

Export command
http://stratis.yourdomain/cw_cmdb_mgmt.php?ajax=1&action=outboundexportnow&page=3&token=<yourtoken>

Create a new administrator account in Stratis. Create a token for same account that does not expire.

Log into a Windows machine that will be online at the time of the task executions. Launch Task Scheduler.

Under Actions, click on Create Task.

- General Tab
This is the preview task, so name it appropriately. Select 'Run whether user is logged in or not.'

-Triggers Tab
Click on the New button then set up the time and frequency to run the task.

-Actions Tab

Action: Start a program
Program/script: Browse to the desired web browser. I used Google Chrome.
Add arguments: http://stratis.yourdomain/Preview query string


-Conditions Tab
I left at default settings, but can be customized to meet any need.

-Settings Tab
I changed 'Stop the task if it runs longer than:' to 1 hour.

Click on the OK button. You might be prompted to enter username and password.

Create a second task then repeat for the export command.

Can export the tasks to XML as backup and to import to a different Windows system.

  • Figured out how get PowerShell to run from Windows Task Scheduler.

    I ran into problems using the web browser call. Sometimes the export task would fail to run.

    By examining PowerShell scripts that were running in Windows Task Scheduler on my workstation, I saw this syntax:

    -executionpolicy bypass -windowstyle hidden -file "c:\temp\untitled1.ps1"

    So I wrote two .ps1 files, one for preview, one for export:

    Preview.ps1
    Invoke-WebRequest -Uri "stratisqa.yourdomain/cw_cmdb_mgmt.php -Method Get

    Export.ps1
    Invoke-WebRequest -Uri "stratisqa.yourdomain/cw_cmdb_mgmt.php -Method Get


    Windows Task Scheduler Configuration for PowerShell:


    Program/Script
    powershell.exe

    Add Arguments (optional)
    -executionpolicy bypass -windowstyle hidden -file "path to your script goes between the quotes"

    Set your desired timings.

    Select to run if user not logged in. Must have right to run batch file.