Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Synchronizing spiceworks ticket due dates


Published on

This presentation discusses how you can use a script to synchronize ticket due dates from the Spiceworks database into a more meaningful format, i.e. Outlook or other iCAL supporting applications.

Published in: Technology
  • Be the first to like this

Synchronizing spiceworks ticket due dates

  1. 1. Using Scheduled Tasks and ICALto keep track of ticket due dates
  2. 2. Set your due now what?dates…
  3. 3. Using due dates can help you keep track of upcoming oroverdue tickets.The biggest problem people face with due dates inSpiceworks: you must be working within the Spiceworksapplication to view these ticket due dates and act uponthem.
  4. 4. The best way would be to somehow import these dates intoOutlook, PHPiCalendar, iCal, etc…
  5. 5. Due dates can be queried from the Spiceworks databaseSpiceworks (since 5.0) locks the entire database frequentlyduring normal operation, so a direct DB query isn‟t viable.We must then make a copy of the spiceworks_prod.db fileto query from instead.
  6. 6. Make a copy of the spiceworks_prod.db database to analternate locationQuery the database copy for any open tickets with duedatesWrite ticket information as calendar events into aniCalendar (*.ICS) fileCopy calendar file to another location to be viewed byadmin staff or used by other applications
  7. 7. iCalendar is a computer file format which allows Internetusers to send meeting requests and tasks to other Internetusers, via email, or sharing files with an extension of .ics.iCalendar is used and supported by a large number ofproducts, including Google Calendar, Apple Calendar(formerly iCal), GoDaddy Online Group Calendar, IBMLotus Notes, Yahoo! Calendar, Evolution (software), eMClient, Lightning extension for Mozilla Thunderbird andSeaMonkey, and partially by Microsoft Outlook and NovellGroupWise.
  8. 8. • Disk space for copy of the Spiceworks database (spiceworks_prod.db)• SQLite3 ODBC Driver (64 or 32-bit, depending on server architecture)• “Sync due dates to ICS” script from Spiceworks Community• Folder for calendar file to be accessed by people who care about due dates(!)• A scheduled task which will copy your database and then run the synchronization script
  9. 9. 1. Create two folders, one for the copy of the Spiceworks database, another for the sync script2. Create a batch file which copies the database – this will be used in a scheduled task later.3. Perform a one-time manual copy of spiceworks_prod.db to destination folder so we can create an ODBC connection later (DSN).
  10. 10. On your Spiceworks server, create c:scripts and c:sqlitedbdb…
  11. 11. Create a new batch file to copy your database, we‟ll use it in a scheduled tasklater. Save this file in the c:scripts folder.
  12. 12. Copy your spiceworks_prod.db file to c:sqlitedbdb, this is where we‟ll point ourOBDC Connector (aka “DSN”) later…
  13. 13. “Where the magic happens”
  14. 14. • The script queries your offline copy of spiceworks_prod.db for any open tickets from the last 30 days with due dates (configurable).• The script then writes individual calendar entries to a text file called „spiceworks.ics‟ in the same folder where the script resides.• Once all tickets with due dates have processed, the calendar file will be moved to the destination folder.• If the folder is shared, admin staff can import the calendar into their MS Outlook (2007 and above), Thunderbird or iCal clients to view.• Note the calendar is read-only.
  15. 15. 1. Download and install SQLite ODBC drivers (respecting CPU architecture)2. Prepare a folder where your calendar (ICS) file will end up (this can be on the same server), i.e. c:scriptsics3. Download and tweak the Synchronization script (tell it where to write the calendar file)4. Create new SQLite3 ODBC Connection (DSN) pointing at our new copy of the offline spiceworks_prod.db file5. Test the script
  16. 16. Download and install the SQLite3 ODBC driver from
  17. 17. From the Administrative Tools in the Control Panel, open „DataSources,‟ click the „System DSN‟ tab, then click „Add…‟
  18. 18. Name this DSN „Spiceworks,‟ then under „Database Name,‟browse to the offline copy of spiceworks_prod.db‟ underc:sqlitedbdb, click „OK.‟
  19. 19. Download the sync script from (SpiceworksScript Center)
  20. 20. When downloaded, the file will save with a „.txt‟ extension.Rename it to „synctickets.vbs‟ in your c:scripts folder.
  21. 21. Open the synctickets.vbs file with a text editor, you‟ll need to edit thevariables „sPathToSpiceworks‟ and „sPublishToPath‟ – any others areoptional.
  22. 22. Open your database copy batch file from c:scripts. Lets add a line to run thenewly downloaded synctickets.vbs script after the database copy is executed(you will want to call it with cscript.exe).Add “Call cscript.exe c:scriptssynctickets.vbs” to your batch file and save.
  23. 23. From Accessories > System Tools, open the Task Scheduler.Note this is called „Scheduled Tasks‟ on Windows XP/2003
  24. 24. Make sure the account you use to run the task has appropriatepermissions to get to the original Spiceworks database and to thefolder where you will write the ICS file.
  25. 25. From the „Triggers‟ tab, set up your schedule to execute oncedaily, repeating every 10 or 30 minutes (your time may differdepending on your needs)
  26. 26. Under the „Actions‟ tab, select your batch file you created earlier.
  27. 27. Right click your new scheduled task and select „Run.‟ Wait aminute or so.Look at the output folder where you told the script to write the ICSfile.
  28. 28. Look in your c:sqlitedbdb folder. You should see a recentlyupdated version of the Spiceworks_prod.db file.
  29. 29. 1. From a computer where MS Outlook 2007 or newer is installed, browse to the folder where the calendar file is stored2. Double-click the file, Outlook should recognize it and import it as a calendar3. Added bonus: If you have a relatively modern smartphone synchronizing with your Exchange server (if you have one), the calendar should also show up on your mobile device!
  30. 30. • Not only can you use this database copy to retrieve due dates, but you can query the data for external reporting like Excel, Crystal Reports, MS Access, etc.• You can set up other web services internally that utlize ICS files like PHPiCalendar so non-Spiceworks users can view the calendar through a web browser• As an alternative to using Windows file copy, you could use DeltaCopy, a Windows port of rsync, which is very efficient at copying larger files
  31. 31. Rob Dunn – “Rob Dunn” in the Spiceworks CommunityEmail: