Browse FAQs

How to run an automatic trim job after archiving data with SQL Express Edition?

Published date: 04 June 2020


User wants to run an automatic trim job after archiving the data when using SQL Express Edition


Production Line

Microsoft SQL


Microsoft SQL Express Edition


SQL Express Edition limits the database growth to 10GB and SQL Express Edition does not come with the SQL Server Management Studio

*Warning: Irreparable database damage can occur. This procedure should only be performed by users familiar with SQL Server Management Studio. Databases should be backed up prior to performing this procedure.*
A work around is possible in the Windows Task Scheduler to automatically archive and then trim the [ION_Data] database.

Go to 
...:\Program Files (x86)\Schneider Electric\Power Monitoring Expert\config\cfg\DbScheduledTasks\
Open ArchiveDB.ps1
Change $archiveDBDaystoKeep =  370
to $archiveDBDays toKeep = "# of days user would like the job to keep data of, and add 10 more days to be safe"
Example: To keep 90 days (3 months) of data in the database after trimming, then 
$archiveDBDaystoKeep =  370 to $archiveDBDaystoKeep = 100

Go to:
...:\Program Files (x86)\Schneider Electric\Power Monitoring Expert\config\cfg\DbScheduledTasks\Support
Open Configuration.ps1
Change the following code:
    $archiveDBDaysToKeep = 370
to $archiveDBDaysToKeep = 100 (or to whatever # of days user would like to keep data of)
    $trimInterval = 0
to $trimInterval = 1
    $trimEvents = 0
to  $trimEvents = 1
    $trimWaveforms = 0 to $trimWaveforms = 1
Open Task Scheduler:
Right click [ION_Data] - ARCHIVE - Job, and left click on Properties
Left click the tab: Triggers
Select the desired Settings (e.g. Monthly), the start date, what months, and which dates you want the task to run on.
Make sure that the box beside Enabled is checked.
Left click on OK
Try to save the task, password for IONMaintenance is required.
If password is not set, do the following:
      i.  Open control panel-->Administrative Tools-->Computer Management.
      ii. From the left side of the pane expand "Local Users and Groups". Click on the folder "Users".
      iii. Right click the user "IONMaintenance" and select "Set Password"
      iv. Please Note down the new password for future references.
If still not able to save the task, kindly go through the FA234145

Was this helpful?

What can we do to improve the information ?

Can't find what you are looking for?

Reach out to our customer care team to receive information on technical support, assistance for complaints and more.