MAC Address via @station in OI 9.2.1 (OpenInsight 32-Bit)
At 19 MAY 2011 11:56:01AM Matthew Watson wrote:
I am running XP sp3 and Windows 7 pcs with OI 9.2.1
The problem I am having is that @station will no longer show the MAC address like it did when we used AREV 3.12. Did something change that will no longer allow @station to display the MAC? Or is it so configuration issue. When we had AREV we used (Novell 6.0) IPX (NLM 1.5) and with OI we are using (Windows 2008 R2)
Thanks
We were using MAC address for audit trails.
At 20 MAY 2011 09:25AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:
There's a few ways you can get back the MAC from the windows API, but you might be better getting the machine name, which is easier to obtain.
The MAC isn't required, is it? You just want to uniquely identify the workstation, right?
World leaders in all things RevSoft
At 20 MAY 2011 02:07PM Jared Bratu wrote:
If you need to change @STATION you can change it using this KB article
Computers joined to a windows domain will be guaranteed unique station names.
One reason not to use the MAC address is to prevent name collisions if you scale the application to a terminal server environment.
At 31 MAY 2011 08:59AM Matthew Watson wrote:
The previous programmers used MAC addresses in the code to uniquely identify the workstations/users. Since it was the easiest to get from @STATION when using AREV 3.12
How hard is it to use the API to get the MAC? otherwise i need see how hard it is to convert from MAC to computer name in existing code.
At 31 MAY 2011 02:19PM Jared Bratu wrote:
It's not hard but the trick is getting the right mac address since there can be multiple addresses on a workstation (one for each NIC). The script below is an adaption of a snippet Robert Carten posted to get the IP address. This snippet gets the MAC address. Using the VBScript and WMI technique you could combine the two methods and only return the MAC address of the IP that corresponds to the network scope of the server.
This is the original snippet:
My adaptation to get the MAX address is:
0001 Equ crlf$ To \0D0A\ 0002 0003 script = 'function GetMACAddresses()' 0004 script<-1> = 'set oList = CreateObject("Scripting.Dictionary")' 0005 script<-1> = 'strComputer = "."' 0006 script<-1> = 'Set objWMIService = GetObject( _ ' 0007 script<-1> = ' "winmgmts:\\" & strComputer & "\root\cimv2")' 0008 script<-1> = 'Set IPConfigSet = objWMIService.ExecQuery _' 0009 script<-1> = ' ("Select * from Win32_NetworkAdapterConfiguration ")' 0010 script<-1> = '' 0011 script<-1> = 'For Each IPConfig in IPConfigSet' 0012 script<-1> = ' If Not IsNull(IPConfig.MACAddress) And oList.Exists(IPConfig.MACAddress) = False Then' 0013 script<-1> = ' oList.Add IPConfig.MACAddress, "" ' 0014 script<-1> = ' End If' 0015 script<-1> = 'Next' 0016 script<-1> = 'addresses = oList.Keys()' 0017 script<-1> = 'GetMACAddresses = join(addresses, ",")' 0018 script<-1> = 'End Function' 0019 0020 Swap @fm With crlf$ In script 0021 0022 wsh = OLECreateInstance("MSScriptControl.ScriptControl") 0023 wsh->Language = "vbScript" 0024 x = wsh->AddCode(script) 0025 0026 expression = 'GetMACAddresses()' 0027 ans = wsh->Eval(expression) 0028 Convert ',' To @vm In ans 0029 0030 Return ans
At 31 MAY 2011 05:48PM Matthew Watson wrote:
Thank you I will try out in coming week.