Regarding all networks, you should just execute your script on all active connections.
You can do this either with /scon -at1 alias (but your script may not like this, depending on how it's constructed) or you should cycle active connection, e.g.:
var %n = 1
while ($scon(%n)) {
if ($scon(%n).server) {
scon %n
your script
}
inc %n
}
$scon(%n).server will return $null if you are not connected, so not execute your script.