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
}

}