You can replace $_.DNSServerSearchOrder by the required value ( $_.IPAddress, $_.DefaultIPGateway,…..etc)

In on of the rel life examples, I wanted to make a script to modify the DNS settings of Network connections with a specific DNS servers value regardless the name of the connection, so I can run the script on multiple servers. The final script looked something like this: