System.Net [this weeks journey into WB CLR]

Started by stanl, March 03, 2019, 11:38:38 AM

Previous topic - Next topic

stanl

Code (WINBATCH) Select


;Winbatch 2018B - Using CLR to To Obtain IP Address with System.Net
;Stan Littlefield 3/3/2019
;==================================================================
ObjectClrOption("useany","System.Net")
oDNS = ObjectClrNew("System.Net.Dns")
oAddress = oDNS.GetHostByName("")
ipaddress = ""


ForEach a in oAddress.AddressList
   ipaddress = ipaddress:a.ToString:@LF
Next


Message("Ip Addresses - home",ipaddress)


oAddress = oDNS.GetHostByName("microsoft.com")
ipaddress = ""


ForEach a in oAddress.AddressList
   ipaddress = ipaddress:a.ToString:@LF
Next


Message("Ip Addresses - Microsoft",ipaddress)


oAddress=0
oDNS=0


Exit
;==================================================================