It's probably the blank space padding in the ipaddress macro that is getting you. Try this...

 Code:
If InStr(Join(Split(@IPAddress0," "),""),"192.168.1.") OR InStr(Join(Split(@IPAddress0," "),""),"192.168.2.")
   AddPrinterConnection("\\server\printer")
Endif