How to Import and Export Address and Address Objects (CLI) (Creating objects from a file of IPs)

How to import export address and address objects

Power Shell Script (Run it straight from powershell prompt/file must be in the same directory):

Palo Script (object group is log4j) :
foreach($ip in Get-Content ip1.txt)
{
Write-output “set address Log4j_BadIP_$ip ip-netmask $ip” | Tee-Object -FilePath ‘C:\Users\fali\output_palo.txt’ -append
Write-output “set address-group log4j static Log4j_BadIP_$ip” | Tee-Object -FilePath ‘C:\Users\fali\output_palo.txt’ -append
}

Panorama Script (object group is log4j):
foreach($ip in Get-Content ip1.txt)
{
Write-output “set shared address Log4j_BadIP_$ip ip-netmask $ip” | Tee-Object -FilePath ‘C:\Users\fali\outputpano.txt’ -append
Write-output “set shared address-group log4j static Log4j_BadIP_$ip” | Tee-Object -FilePath ‘C:\Users\fali\outputpano.txt’ -append
}

}

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: