[Powershell]Concatenate XML blocks base on a list

So on previous post i have posted an entire code to build standard firewalls for new servers. So basically there is a small function that does the trick.

function GatherNewServers($new_server){
$src_addr = @" 
<source type="IP">
return $src_addr + "`r"
$src_ip = @()

$src_addr = Get-Content "$env:HOMEDRIVE\Powershell\test_ip.txt"
for($i=0; $i -lt $src_addr.Count; $i++) {
    $src = $src_addr.item($i)
    $src_ip += GatherNewServers($src)


The idea is that I do not want the orchestrator to send request on every servers built, this will generate a lot of access requests in tufin securechange. so I was trying out a code snippet to see if i can replicate the same xml blocks with different addresses from a list of ip addresses.


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