Backup DataCore SANsymphony-V config using PowerShell

This posting is ~10 years years old. You should keep this in mind. IT is a short living business. This information might be outdated.

In November 2013 I published a PowerShell script on that creates a backup of your SANsymphony-V config by using the DataCore SANsymphony-V PowerShell cmdlets. I would like to thank Marcel, Michael and Frank for their feedback and comments to improve the script. The password is stored in the securestring.txt that needs to be stored in the same directory as the script. Kudos to Marcel, who has the part of the script contributed, that stores the password in an encrypted file.

Currently there is no way to schedule a configuration backup using the DataCore GUI. A valid backup of the configuration can be a lifesaver, especially in the case, that you storage server crashed and it has to be re-installed. So it’s a good idea to regularly backup the configuration to the local disk and copy this backup to another location. One way to create a backup, is an Outlook task and the DataCore GUI. Belive me, that will not work… At this point my script comes into play. The script uses Microsoft PowerShell, DataCore SANsymphony-V PowerShell cmdlets and the Windows Task Scheduler to automate the backup of SANsymphony-V configuration.

There are a couple of variables used in the script. Two of them are used to change the number of stored backups and the directory in which the backups will be saved. The script saves the last three versions of the configuration backups, but you can change this with the $Keep variable. The directory, in which the backup will be saved, is influenced by the $BackupFolder variable.

You can call the script using the Taskplanner with the following command:

powershell.exe -c "C:\Scripts\Backup-DataCoreConfig.ps1 | Out-Null"

You can select a different directory than C:\Scripts. The “Out-Null” behind the pipe symbol suppresses the output of the script.

5/5 - (6 votes)
Patrick Terlisten
Follow me

One thought on “Backup DataCore SANsymphony-V config using PowerShell

  1. Brian Farrugia

    Hi Patrick,
    thank you very much for this post. I am implementing this script on a setup we are doing.
    I would like to add a little something.
    I have updated the line

    do {$Files | Sort-Object CreationTime | Select-Object -First ($Files.Count – $Keep)| Remove-Item} until ($Files.Count -ge $Keep)


    If ($File.Count -gt 3) {
    do {$Files | Sort-Object CreationTime | Select-Object -First ($Files.Count – $Keep)| Remove-Item} until ($Files.Count -ge $Keep)

    I did this because when the Backup folder was empty or had less than 3 files in it,
    Powershell would generate the below errors in a continuous loop.

    Select-Object : Cannot validate argument on parameter ‘First’. The -3 argument is less than the minimum allowed range of 0. Supply an argument that is
    greater than or equal to 0 and then try the command again.
    At C:SSVBACKUP_ScriptBackup-DataCoreConfig.ps1:22 char:62
    + do {$Files | Sort-Object CreationTime | Select-Object -First ($Files.Count – $Ke …
    + ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (:) [Select-Object], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.SelectObjectCommand

    Thanks again.

Comments are closed.