cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2627
Views
15
Helpful
7
Replies

[VCS] Automatic backup config

Hello,

I'm wondering if there is any solution to make an automatic back-up config file for the VCS C&E.

Please share your knowledge.

Regards,

Firdaush

7 Replies 7

Patrick Sparkman
VIP Alumni
VIP Alumni

This has been asked a few times here in the forums:

vcs-automated-backup

scheduled-vcs-config-backups

automated-backup-vcs-configuration

The VCS/Expressway Series doesn't include an type of automatic backup function themselves, currently the only methods of backing up a VCS is manually by one of the these options:

  • VCS using Maintenance > Backup and Restore.
  • TMS using Systems > Configuration Backup 

With that said, someone has managed to do automated backups with the use of scripting, see Automate Cisco Video Communication Server configuration backups.

Doesn't work.  It's not a valid backup, so you can't restore.  Avoid this - fool's gold.

Only really way to full backup a VCS is using it's built-in backup methods available in web interface, which will backup everything.

I have found a script on the box available as root which allows the tar file to be generated programmatically.  It's under /sbin.  However, you need to ssh using the root account to do this.

Hello Jonathan, 

You means that you access to the expressway with for example winscp ( root) and you find a file under /sbin that generate an automatic backup ?

Which is the name of this file please ?

 

Kind regards,

Asma

No fools gold here, this powershell works just fine for us, it will download the files to the directory that the script is run from. 

 

 

# Start Script

 

$header = "computer","user","pass"
# modify the computer and password fields below
$data = @'
expy-c-1,admin,<password>
expy-c-2,admin,<password>
expy-e-1,admin,<password>
expy-e-2,admin,<password>
'@


$CSV = ConvertFrom-CSV -header $header $data


# Trust all certificates, regardless of error types
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
# use TLS to connect
[System.Net.ServicePointManager]::SecurityProtocol = ([enum]::GetNames([System.Net.SecurityProtocolType]) | ? {$_ -match "Tls"})


function Backup-Expressway {
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true, Position=0)]
$computer,
[Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true, Position=1)]
$user,
[Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true, Position=2)]
$pass
)

$LoginParams = @{submitbutton='Login';username=$user;password=$pass;formbutton='Login'}
$Login = Invoke-WebRequest "https://$computer/login" -UseBasicParsing -SessionVariable access -Body $LoginParams -Method Post

$BkUp = invoke-webrequest "https://$computer/backuprestore" -websession $access -UseBasicParsing

$BkParams = @{sessionid=$bkup.InputFields.FindById('sessionid').value;submitbutton='Create system backup file';backup_password=''}
$BkupFile = invoke-webrequest "https://$computer/backuprestore" -websession $access -Body $BkParams -Method Post -TimeOutSec 0 -UseBasicParsing

$FileName = [regex]::match($bkupfile.Headers['content-disposition'],'filename=(.*)').groups[1].value
$path = "$pwd\$filename"
[System.IO.File]::WriteAllBytes($path, $BkupFile.content)

}

$CSV | %{Backup-Expressway $_.computer $_.user $_.pass}

 

# End Script

a-navratil
Level 1
Level 1

Some time ago expressway started requiring a backup password to encrypt contents, I've modified the script to use the login password to protect the backup, and email notification if the backup fails. Update below:

 

$header = "computer","user","pass"
$data = @'
expressway1,admin,password
expressway2,admin,password
expressway3,admin,password
expressway4,admin,password
'@

$CSV = ConvertFrom-CSV -header $header $data

$MailDefaults = @{
    From = "ExpresswayBackups@$($env:computername)"
    To = "youremail@here.com" # Address to send alerts to
    Subject = "Expressway Backup Failed"
    SMTPServer = "X.X.X.X" # IP or hostname of SMTP Server 
}


# Trust all certificates, regardless of error types
add-type @"
    using System.Net;
    using System.Security.Cryptography.X509Certificates;
    public class TrustAllCertsPolicy : ICertificatePolicy {
        public bool CheckValidationResult(
            ServicePoint srvPoint, X509Certificate certificate,
            WebRequest request, int certificateProblem) {
            return true;
        }
    }
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
[System.Net.ServicePointManager]::SecurityProtocol = ([enum]::GetNames([System.Net.SecurityProtocolType]) | Where-Object {$_ -match "Tls"})


function Backup-Expressway {
    [CmdletBinding()]
    Param
    (
        [Parameter(Mandatory=$trueValueFromPipelineByPropertyName=$truePosition=0)]
        $computer,
        [Parameter(Mandatory=$trueValueFromPipelineByPropertyName=$truePosition=1)]
        $user,
        [Parameter(Mandatory=$trueValueFromPipelineByPropertyName=$truePosition=2)]
        $pass
    )

    $LoginParams = @{submitbutton='Login';username=$user;password=$pass;formbutton='Login'}
    $Login = Invoke-WebRequest "https://$computer/login" -UseBasicParsing -SessionVariable access -Body $LoginParams -Method Post

    $BkUp = invoke-webrequest "https://$computer/backuprestore" -websession $access -UseBasicParsing
    $BkParams = @{sessionid=$bkup.InputFields.FindById('sessionid').value;submitbutton='Create system backup file';backup_password=$pass;backup_password_confirm=$pass}
    $BkupFile = invoke-webrequest "https://$computer/backuprestore" -websession $access -Body $BkParams -Method Post -TimeOutSec 0 -UseBasicParsing 

    $FileName = [regex]::match($bkupfile.Headers['content-disposition'],'filename=(.*)').groups[1].value
    if ($FileName){
        $path = "$pwd\Expressway\$filename"
        [System.IO.File]::WriteAllBytes($path$BkupFile.content)
    }
    else {
        Send-MailMessage @MailDefaults -Body "Backup failed to generate a file for $computer"
    }

}

$CSV | ForEach-Object {Backup-Expressway $_.computer $_.user $_.pass}