I have made a short script that will pull dns txt records down from a server and combine them into a single string. DNS txt records are:
1.website.com
2.website.com
3.website.com
each of these are iterated through using the single digit number. the double quotes at the beginning and the end of the strings are trimmed This works exactly as I would like it too I am simply interested in seeing how short I can get it assistance is appreciated please and thank you
$i = 1
1..2 | foreach {
$w="$i.website.com"
sv -N v -Va ((nslookup -q=txt $w )[-1]).Trim().Trim('"')
$p += "$v"
$i += 1
}
and ideally i'd like to return the $p variable, that being the concatenated string