Jump to content
Eduardo Celiz

INQUIRY ABOUT FUNCTION MAC Addresses  -  Lee Mac

Recommended Posts

Eduardo Celiz
Posted (edited)
Hello, I am reviewing the following function of lee mac where it returns all the mac addresses of the machine, 
my query is the following which of these codes does not change by formatting the machine or otherwise, that is, 
whatever is done to the machine It will continue throwing the same one, which of all it would be and how can I modify 
the code so that I do not throw away the entire list but rather identify it and that it throw me that code independently.
 I appreciate your help

 

;; MAC Addresses  -  Lee Mac
;; Returns a list of MAC Addresses for all installed network adaptors

(defun LM:macaddresses ( / err qry srv wmi )
    (if (setq wmi (vlax-create-object "wbemscripting.swbemlocator"))
        (progn
            (setq err
                (vl-catch-all-apply
                    (function
                        (lambda ( / rtn )
                            (setq srv (vlax-invoke wmi 'connectserver)
                                  qry (vlax-invoke srv 'execquery "select macaddress from win32_networkadapter where macaddress is not null")
                            )
                            (vlax-for itm qry (setq rtn (cons (vlax-get itm 'macaddress) rtn)))
                        )
                    )
                )
            )
            (foreach obj (list qry srv wmi)
                (if (= 'vla-object (type obj))
                    (vlax-release-object obj)
                )
            )
            (if (vl-catch-all-error-p err)
                (prompt (vl-catch-all-error-message err))
                err
            )
        )
    )
)

Edited by Eduardo Celiz

Share this post


Link to post
Share on other sites
lido

The Internet is full of information about MAC addresses: why, when, how to change this address etc. Just google it! To get answer to your question, the AutoLISP Forum is not the best choice!

Share this post


Link to post
Share on other sites
ronjonp

Is your question about why the MAC address does not change after a format? Maybe read this and see if it sheds any light.

Share this post


Link to post
Share on other sites
pkenewell

I think the OP is asking for an address on the computer he can reference that will not change regardless of what is done to the machine i.e. Format Hard Drives, change OS, etc.

Share this post


Link to post
Share on other sites
ronjonp

Physical mac addresses will not change. Maybe they just need to change this:

"select macaddress from win32_networkadapter where macaddress is not null"

to this:

"Select macaddress from Win32_NetworkAdapter where PhysicalAdapter=TRUE and macaddress is not null"

 

  • Like 2

Share this post


Link to post
Share on other sites
Eduardo Celiz
On 6/1/2021 at 14:58, pkenewell said:

Creo que el OP está solicitando una dirección en la computadora a la que pueda hacer referencia que no cambiará independientemente de lo que se haga en la máquina, es decir, formatear discos duros, cambiar el sistema operativo, etc.

 

It is just I look for it, but my doubt is how it does so that it only shows me the mac that is never modified there is a formatting

Share this post


Link to post
Share on other sites
pkenewell
21 hours ago, Eduardo Celiz said:

It is just I look for it, but my doubt is how it does so that it only shows me the mac that is never modified there is a formatting

 

@Eduardo Celiz Sorry but I cannot understand what you are saying. Please try to restate, or just write it in your own language and we will use google translate.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...