More than likely there is more than 1 network adapter, resulting in the last one's settings being returned, which are probably blank. Have you tried the built in EnumIPInfo()? Give the below code a shot and see if it works on your environment.

 Code:
Do
   $Subnet = EnumIPInfo($x,3,1)
   $x = 1+$x
Until Len($Subnet)

$SubnetArray = Split($Subnet, ".")

for $i = 0 to UBound($SubnetArray)
  $SubnetArray[$i] = Val($SubnetArray[$i])
next
$DBA = "\\" + $SubnetArray[0] + "." + $SubnetArray[1] + "." + $SubnetArray[2] + "." + "27"
$APP = "" + $SubnetArray[0] + "." + $SubnetArray[1] + "." + $SubnetArray[2] + "." + "2"

? $DBA
? $APP
? "DONE"

get $