Use a Powershell Script to Restore Datazen Server


Happy Wednesday, everybody.  This post is short and sweet, but potentially a big time saver for you.  So you need to backup and restore your Datazen server for whatever reason.  There’s instructions in the documentation on how to do this, but the process of restoring the server can be automated even further using Powershell.

I’ve included a download link to a Powershell script that automates the restoration process of Datazen.  While you’ll still need to setup and run the backup through the control panel as either a one-time event or on a scheduled basis, this script will do the following –

– Stop All Datazen Services
– Delete the Data Folder
– Restore the backup using Raven
– Defrag the database
– Run Datazen.Server in console mode to sanitize the installation
– Start the services again

Note (thanks, Rui!) – Make sure the service account that is running the core service has access to the new data folder, whether by updating the script or confirming access is available manually.  If it doesn’t, the core service will hang when it starts.

The biggest thing to remember when doing this process is that you are using the correct Datazen Instance ID that you want to restore.  This process assumes your current server and your backup are using the same instance id.  If, however, you need to restore or move the Datazen server to a new server, and restore an existing db there, you’ll need to reinstall Datazen using the command line and specify the instance id.  That process is outlined here.

As promised, here’s the Powershell script you can use –

Thanks for reading!