<?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 Powershell to run CLI Command in Integration Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/integration-discussions/powershell-to-run-cli-command/m-p/1207559#M193</link>
    <description>&lt;P&gt;Hi All!&lt;/P&gt;&lt;P&gt;I am putting together a PowerShell script to see what IPs are listed in the DoS Block Table. The command (debug dataplane show dos block-table) keeps timing out with the error&lt;/P&gt;&lt;P&gt;"Error executing command 'show config running'. Error: Exception calling "EndExecute" with "1" argument(s): "Command 'show config ru&lt;BR /&gt;nning' has timed out."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the script. Any help would be much appreciated&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# Import the Posh-SSH module&lt;BR /&gt;Import-Module Posh-SSH&lt;BR /&gt;clear&lt;BR /&gt;# Define connection details&lt;BR /&gt;$PaloAltoIP = "&amp;lt;ip address&amp;gt;" # Replace with your Palo Alto's IP address&lt;BR /&gt;$Username = "&amp;lt;userid&amp;gt;" # Replace with your username&lt;BR /&gt;$Password = "&amp;lt;password&amp;gt;" # Replace with your password&lt;/P&gt;&lt;P&gt;# Commands to execute&lt;BR /&gt;$Commands = @(&lt;BR /&gt;#"show config running&lt;BR /&gt;"debug dataplane show dos block-table" # Example command to show system information&lt;BR /&gt;&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# Establish an SSH session&lt;BR /&gt;try {&lt;BR /&gt;Write-Host "Establishing SSH connection to $PaloAltoIP..." -ForegroundColor Green&lt;BR /&gt;$SSHSession = New-SSHSession -ComputerName $PaloAltoIP -Credential (New-Object System.Management.Automation.PSCredential($Username, (ConvertTo-SecureString $Password -AsPlainText -Force))) -AcceptKey&lt;BR /&gt;Write-Host "Connection established." -ForegroundColor Green&lt;BR /&gt;} catch {&lt;BR /&gt;Write-Host "Failed to connect to $PaloAltoIP. Error: $_" -ForegroundColor Red&lt;BR /&gt;exit&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;# Execute commands&lt;BR /&gt;foreach ($Command in $Commands) {&lt;BR /&gt;Write-Host "Executing command: $Command" -ForegroundColor Yellow&lt;BR /&gt;try {&lt;BR /&gt;$Result = Invoke-SSHCommand -SSHSession $SSHSession -Command $Command -TimeOut 20&lt;BR /&gt;Write-Host "Command output:" -ForegroundColor Cyan&lt;BR /&gt;Write-Output $Result.Output&lt;BR /&gt;} catch {&lt;BR /&gt;Write-Host "Error executing command '$Command'. Error: $_" -ForegroundColor Red&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;# Close the SSH session&lt;BR /&gt;Write-Host "Closing SSH session..." -ForegroundColor Green&lt;BR /&gt;Remove-SSHSession -SSHSession $SSHSession&lt;BR /&gt;Write-Host "SSH session closed." -ForegroundColor Green&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jan 2025 17:21:16 GMT</pubDate>
    <dc:creator>edroche3rd</dc:creator>
    <dc:date>2025-01-28T17:21:16Z</dc:date>
    <item>
      <title>Powershell to run CLI Command</title>
      <link>https://live.paloaltonetworks.com/t5/integration-discussions/powershell-to-run-cli-command/m-p/1207559#M193</link>
      <description>&lt;P&gt;Hi All!&lt;/P&gt;&lt;P&gt;I am putting together a PowerShell script to see what IPs are listed in the DoS Block Table. The command (debug dataplane show dos block-table) keeps timing out with the error&lt;/P&gt;&lt;P&gt;"Error executing command 'show config running'. Error: Exception calling "EndExecute" with "1" argument(s): "Command 'show config ru&lt;BR /&gt;nning' has timed out."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the script. Any help would be much appreciated&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# Import the Posh-SSH module&lt;BR /&gt;Import-Module Posh-SSH&lt;BR /&gt;clear&lt;BR /&gt;# Define connection details&lt;BR /&gt;$PaloAltoIP = "&amp;lt;ip address&amp;gt;" # Replace with your Palo Alto's IP address&lt;BR /&gt;$Username = "&amp;lt;userid&amp;gt;" # Replace with your username&lt;BR /&gt;$Password = "&amp;lt;password&amp;gt;" # Replace with your password&lt;/P&gt;&lt;P&gt;# Commands to execute&lt;BR /&gt;$Commands = @(&lt;BR /&gt;#"show config running&lt;BR /&gt;"debug dataplane show dos block-table" # Example command to show system information&lt;BR /&gt;&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# Establish an SSH session&lt;BR /&gt;try {&lt;BR /&gt;Write-Host "Establishing SSH connection to $PaloAltoIP..." -ForegroundColor Green&lt;BR /&gt;$SSHSession = New-SSHSession -ComputerName $PaloAltoIP -Credential (New-Object System.Management.Automation.PSCredential($Username, (ConvertTo-SecureString $Password -AsPlainText -Force))) -AcceptKey&lt;BR /&gt;Write-Host "Connection established." -ForegroundColor Green&lt;BR /&gt;} catch {&lt;BR /&gt;Write-Host "Failed to connect to $PaloAltoIP. Error: $_" -ForegroundColor Red&lt;BR /&gt;exit&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;# Execute commands&lt;BR /&gt;foreach ($Command in $Commands) {&lt;BR /&gt;Write-Host "Executing command: $Command" -ForegroundColor Yellow&lt;BR /&gt;try {&lt;BR /&gt;$Result = Invoke-SSHCommand -SSHSession $SSHSession -Command $Command -TimeOut 20&lt;BR /&gt;Write-Host "Command output:" -ForegroundColor Cyan&lt;BR /&gt;Write-Output $Result.Output&lt;BR /&gt;} catch {&lt;BR /&gt;Write-Host "Error executing command '$Command'. Error: $_" -ForegroundColor Red&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;# Close the SSH session&lt;BR /&gt;Write-Host "Closing SSH session..." -ForegroundColor Green&lt;BR /&gt;Remove-SSHSession -SSHSession $SSHSession&lt;BR /&gt;Write-Host "SSH session closed." -ForegroundColor Green&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2025 17:21:16 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/integration-discussions/powershell-to-run-cli-command/m-p/1207559#M193</guid>
      <dc:creator>edroche3rd</dc:creator>
      <dc:date>2025-01-28T17:21:16Z</dc:date>
    </item>
  </channel>
</rss>

