<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Backup Using Powershell in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/backup-using-powershell/m-p/135335#M1330</link>
    <description>&lt;P&gt;add-type @"&lt;BR /&gt;using System.Net;&lt;BR /&gt;using System.Security.Cryptography.X509Certificates;&lt;BR /&gt;public class TrustAllCertsPolicy : ICertificatePolicy {&lt;BR /&gt;public bool CheckValidationResult(&lt;BR /&gt;ServicePoint srvPoint, X509Certificate certificate,&lt;BR /&gt;WebRequest request, int certificateProblem) {&lt;BR /&gt;return true;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;"@&lt;BR /&gt;[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy&lt;/P&gt;&lt;P&gt;$ErrorActionPreference = "SilentlyContinue"&lt;BR /&gt;$BACKUP_DIR = "d:\work\temp\"&lt;/P&gt;&lt;P&gt;function getConfiguration () {&lt;/P&gt;&lt;P&gt;Param(&lt;BR /&gt;[string]$IP,&lt;BR /&gt;[string]$HOSTNAME,&lt;BR /&gt;[string]$KEY&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;$URL = "https://" + $IP + "/esp/restapi.esp?type=export&amp;amp;category=configuration&amp;amp;from=running-config.xml&amp;amp;key=" + $KEY&lt;BR /&gt;$TIMESTAMP = Get-Date -format dd-MM-yyyy&lt;BR /&gt;$PATH = $BACKUP_DIR + $TIMESTAMP + "_" + $HOSTNAME + "_" + $IP + ".xml"&lt;BR /&gt;Invoke-WebRequest -Uri $URL -OutFile $PATH&lt;BR /&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;getConfiguration "1.1.1.1" "Boston" "&amp;lt;API KEY&amp;gt;"&lt;BR /&gt;getConfiguration "2.2.2.2" "Florida" "&amp;lt;API KEY&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;lt;#&lt;BR /&gt;Generate the API Key Using&lt;BR /&gt;https://&amp;lt;PA IP&amp;gt;/esp/restapi.esp?type=keygen&amp;amp;user=&amp;lt;username case sensetive&amp;gt;&amp;amp;password=&amp;lt;url encoded password&amp;gt;&lt;BR /&gt;#&amp;lt;&lt;/P&gt;</description>
    <pubDate>Sun, 01 Jan 2017 10:32:29 GMT</pubDate>
    <dc:creator>minow</dc:creator>
    <dc:date>2017-01-01T10:32:29Z</dc:date>
    <item>
      <title>Backup Using Powershell</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/backup-using-powershell/m-p/135335#M1330</link>
      <description>&lt;P&gt;add-type @"&lt;BR /&gt;using System.Net;&lt;BR /&gt;using System.Security.Cryptography.X509Certificates;&lt;BR /&gt;public class TrustAllCertsPolicy : ICertificatePolicy {&lt;BR /&gt;public bool CheckValidationResult(&lt;BR /&gt;ServicePoint srvPoint, X509Certificate certificate,&lt;BR /&gt;WebRequest request, int certificateProblem) {&lt;BR /&gt;return true;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;"@&lt;BR /&gt;[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy&lt;/P&gt;&lt;P&gt;$ErrorActionPreference = "SilentlyContinue"&lt;BR /&gt;$BACKUP_DIR = "d:\work\temp\"&lt;/P&gt;&lt;P&gt;function getConfiguration () {&lt;/P&gt;&lt;P&gt;Param(&lt;BR /&gt;[string]$IP,&lt;BR /&gt;[string]$HOSTNAME,&lt;BR /&gt;[string]$KEY&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;$URL = "https://" + $IP + "/esp/restapi.esp?type=export&amp;amp;category=configuration&amp;amp;from=running-config.xml&amp;amp;key=" + $KEY&lt;BR /&gt;$TIMESTAMP = Get-Date -format dd-MM-yyyy&lt;BR /&gt;$PATH = $BACKUP_DIR + $TIMESTAMP + "_" + $HOSTNAME + "_" + $IP + ".xml"&lt;BR /&gt;Invoke-WebRequest -Uri $URL -OutFile $PATH&lt;BR /&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;getConfiguration "1.1.1.1" "Boston" "&amp;lt;API KEY&amp;gt;"&lt;BR /&gt;getConfiguration "2.2.2.2" "Florida" "&amp;lt;API KEY&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;lt;#&lt;BR /&gt;Generate the API Key Using&lt;BR /&gt;https://&amp;lt;PA IP&amp;gt;/esp/restapi.esp?type=keygen&amp;amp;user=&amp;lt;username case sensetive&amp;gt;&amp;amp;password=&amp;lt;url encoded password&amp;gt;&lt;BR /&gt;#&amp;lt;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Jan 2017 10:32:29 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/backup-using-powershell/m-p/135335#M1330</guid>
      <dc:creator>minow</dc:creator>
      <dc:date>2017-01-01T10:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: Backup Using Powershell</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/backup-using-powershell/m-p/191851#M1526</link>
      <description>&lt;P&gt;Awesome - I've also scripted this by myself yesterday - more or less the same code &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One addition: if you work with Panorama you should export the device state on the local boxes. If you only export the running-config it will only include the locally configured settings and not the settings pushed by Panorama. Just use following API query:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#8b0000" face="Lucida Console" size="1"&gt;/api/?type=export&amp;amp;category=device-state&amp;amp;key=... &lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2017 09:52:54 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/backup-using-powershell/m-p/191851#M1526</guid>
      <dc:creator>DenisHierholzer</dc:creator>
      <dc:date>2017-12-15T09:52:54Z</dc:date>
    </item>
  </channel>
</rss>

