Question
· Jul 23, 2019

how to use M language get local Computer MAC Address

hi,ererybody!

help,

how to use M language get local Computer MAC Address?

 

I know get local ip use : w $ZU(67,15,$j),but i don't know this.

Discussion (14)1
Log in or sign up to continue

I checked for versions 2009.1/2010.1: unfortunately, the $zu(114,0) returns nothing, therefore, remains variant with the command line.

Example for Windows, provided that the system has a single network card:

#include %syConfig
 result
 w $zu(144,1,$$$DEFETHADDR),!,"------",!
 
 d $system.OBJ.DisplayError(##class(%Net.Remote.Utility).RunCommandViaCPIPE("getmac /NH /fo table",,.result))
 w $p(result," ",1)

PS: for other OS command line may be different.

Hello,

This isn't the question you asked, but since you mentioned $ZU functions, please bear in mind that:

  • $ZU functions are deprecated
  • $ZU functions are no longer documented
  • Users are encouraged to replace $ZU functions with methods and properties in InterSystems class libraries that perform the equivalent actions

Your specific example, $ZU(67,15,$j), is replaced by ##class(%SYSTEM.Process).ClientIPAddress($j).

Best,

Aaron