Mac address of local machine in a virtual machine environment

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ricardo de Mila
    New Member
    • Jan 2011
    • 41

    Mac address of local machine in a virtual machine environment

    Dear Bytes...

    Was wondering to know if is it possible to know the MAC ADDRESS of a local machine if ACCESS (and VBA) is running in a Virtual Machine.

    Is it possible to identify if Access is running in a Virtual Machine or in a local machine?

    Best regards
    Ricardo de Milano
    Last edited by zmbd; Dec 31 '15, 01:57 PM. Reason: [z{moved thread to the correct forum}]
  • Ricardo de Mila
    New Member
    • Jan 2011
    • 41

    #2
    Hi zmbd...
    I'm not sure if I'm doing something wrong, but can't find the answer for my reply. could you please help me to understand where do I have to go to reach the correct forum if the answer is there?

    Comment

    • Oralloy
      Recognized Expert Contributor
      • Jun 2010
      • 988

      #3
      Look-Up On Google

      Recardo de Mila,

      Give a query to google: VBA read MAC address; there are some interesting answers.

      This looks promising (a rewrite of several examples):
      Code:
      ''--local computer is "."
      Let Computer = "."
      
      ''--get queryable system object (win management service?)
      Set WinMgmts = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & Computer & "\root\cimv2")
      
      ''--ask for the network adapters
      Set Adapters = WinMgmts.ExecQuery("Select * from Win32_NetworkAdapterConfiguration")
      
      ''--spin through to get the one you want
      For Each Adapter In Adapters
        If IsNull(Adapter.MACAddress) Then
          ''noOp - no address to look at here
        Else
          Debug.Print Adapter.MACAddress
        End If
      Next
      Regards,
      Oralloy

      Comment

      Working...