cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Who Me Too'd this topic

Backup Using Powershell

L4 Transporter

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

$ErrorActionPreference = "SilentlyContinue"
$BACKUP_DIR = "d:\work\temp\"

function getConfiguration () {

Param(
[string]$IP,
[string]$HOSTNAME,
[string]$KEY
)

$URL = "https://" + $IP + "/esp/restapi.esp?type=export&category=configuration&from=running-config.xml&key=" + $KEY
$TIMESTAMP = Get-Date -format dd-MM-yyyy
$PATH = $BACKUP_DIR + $TIMESTAMP + "_" + $HOSTNAME + "_" + $IP + ".xml"
Invoke-WebRequest -Uri $URL -OutFile $PATH

}

getConfiguration "1.1.1.1" "Boston" "<API KEY>"
getConfiguration "2.2.2.2" "Florida" "<API KEY>"

<#
Generate the API Key Using
https://<PA IP>/esp/restapi.esp?type=keygen&user=<username case sensetive>&password=<url encoded password>
#<

Who Me Too'd this topic