# Backups

Parallels recommends setting up recurrent backups of Parallels RAS farm settings. This can be accomplished using Parallels RAS PowerShell, which is a part of Parallels RAS beginning with version 15.5.2. Parallels RAS PowerShell is installed by default when you install Parallels RAS. If you chose not to install it, please run the Parallels RAS installer again and install the Parallels RAS PowerShell component.

The following sample PowerShell script shows how to export Parallels RAS farm settings to a file.

```
#Get the current datetime to be used as a name for the backup file.
#You can use any other unique name format that you like.
$Date = Get-Date -Format yyyy.MM.dd.mm.ss

#Import the Parallels RAS PowerShell module.
Import-Module RASAdmin

#Create a Parallels RAS session.
#Since the password must be passed as SecureString, we need to convert it first.
#In your own script, replace "secret" with your Parallels RAS password.
$Pass = "secret" | ConvertTo-SecureString -AsPlainText -Force

#We can now create a Parallels RAS session.
#Replace "user" and "server.company.dom" with your RAS user and server names.
#If executing the script locally, you can omit the -Server parameter. 
New-RASSession -Username "user" -Password $Pass -Server "server.company.dom"

#Export farm settings to a file.
#You can specify a different folder for saving the file if you wish.
#.dat2 is the default extension Parallels RAS uses for backup files.
Invoke-RASExportSettings $env:userprofile\$Date.dat2

#Close the current RAS session.
Remove-RASSession
```

Save the above sample script to a file with the ".ps1" extension. To test the script, you can execute it in the PowerShell console. To execute the script on a schedule, do the following:

1. Open Windows Scheduler and click **Create Task**.
2. On the **General** tab page of the **Create Task** dialog, fill in all required fields.
3. Select the **Actions** tab page and then click the **New** button.
4. In the **New Action** dialog, make sure **Start a program** is selected in the **Action** drop-down list, then click **Browse** and select your .ps1 script file.
5. Click **OK** in the **New Action** dialog.
6. Select the **Triggers** tab page and click **New**.
7. In the **New Trigger** dialog, specify the desired schedule settings.
8. Click **OK** to close all dialogs.

To import the settings from a saved file into a Parallels RAS farm:

* In the Parallels RAS Console, navigate to **Administration** \ **Backup** and click **Import**. Specify the ".dat2" file to import the farm settings from.
* Using Parallels RAS PowerShell, execute the `Invoke-RASImportSettings` cmdlet passing the path and filename of the backup file.

The complete Parallels RAS PowerShell documentation can be viewed and downloaded from <http://www.parallels.com/products/ras/resources/>
