In November 2013 I published a PowerShell script on blazilla.de 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.
- Failed to connect to IKEv2 VPN using iPhone USB tethering - June 26, 2023
- Why you should change your KRBTGT password prior disabling RC4 - July 28, 2022
- Use app-only authentication with the Microsoft Graph PowerShell SDK - July 22, 2022
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)
with
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.
Brian