Serial number

Serial number

Anonymous
Not applicable
6,538 Views
17 Replies
Message 1 of 18

Serial number

Anonymous
Not applicable

Hi,

 

I'm wondering if there is a command in autolisp that allows you to get a serial number (eg hard disk serial number or similar)?

0 Likes
Accepted solutions (2)
6,539 Views
17 Replies
Replies (17)
Message 2 of 18

hak_vz
Advisor
Advisor

https://www.cadtutor.net/forum/topic/9848-how-to-get-serial-number-of-hard-drive-by-lisp/ 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 3 of 18

Kent1Cooper
Consultant
Consultant

Also, put something like "drive serial number" into the Search window in this Forum, and you'll find several threads on the subject.

Kent Cooper, AIA
0 Likes
Message 4 of 18

Anonymous
Not applicable

I searched a lot of examples on this topic, but I did not find any correct examples.  Can you write me one example that works? Need only one variable to store some stable serial number in?

0 Likes
Message 5 of 18

Sea-Haven
Mentor
Mentor
; drive type 1 is a usb 2 hard disk
(defun UsbDriveSerialNumber ( / fso dr)
  (setq fso (vlax-create-object "Scripting.FileSystemObject"))
  (vlax-for d (vlax-get fso 'Drives)
    (if
	  (= (Vlax-get  d 'DriveType) 2)
      (setq dr (cons (list (vla-get-path d) (vla-get-SerialNumber d)) dr)
      )
    )
  )
  (vlax-release-object fso)
  (reverse dr)
)
(UsbDriveSerialNumber)

Apologise to original author not sure where I got this from

0 Likes
Message 6 of 18

hak_vz
Advisor
Advisor
Accepted solution

@Anonymous wrote:

I searched a lot of examples on this topic, but I did not find any correct examples.  Can you write me one example that works? Need only one variable to store some stable serial number in?


Try this

(defun DiskDriveSerial (/ WMI Serv DiskD item prop ser)
 (vl-load-com)
 ;; Lee Mac  ~  13.05.10
 
 (setq WMI    (vlax-create-object "WbemScripting.SWbemLocator")
       Serv   (vlax-invoke WMI  'ConnectServer nil nil nil nil nil nil nil nil)
       DiskD  (vlax-invoke Serv 'ExecQuery "Select SerialNumber from Win32_DiskDrive"))
       
 (vlax-for item DiskD
   (vlax-for prop (vlax-get item 'Properties_)
     (if (eq "SerialNumber" (vlax-get prop 'Name))
       (setq ser (vlax-get prop 'Value))
     )
   )
 )

 (mapcar 'vlax-release-object (list DiskD Serv wmi))
 
 ser)

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Message 7 of 18

Anonymous
Not applicable

Neither works for me. I don't understand why.

0 Likes
Message 8 of 18

hak_vz
Advisor
Advisor

@Anonymous  Which version of autocad  and operating system you use?

 

 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 9 of 18

Anonymous
Not applicable

Autocad 2014 and Windows 10

0 Likes
Message 10 of 18

hak_vz
Advisor
Advisor

What you receive when you run  in system console after you load lisp?

 

 

(DiskDriveSerial)

 

or separately

 

(setq WMI(vlax-create-object "WbemScripting.SWbemLocator")))
(setq Serv   (vlax-invoke WMI  'ConnectServer nil nil nil nil nil nil nil nil))
(setq DiskD  (vlax-invoke Serv 'ExecQuery "Select SerialNumber from Win32_DiskDrive"))

 

 

 

This should work fine with your software

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 11 of 18

Anonymous
Not applicable

Great, it works. I'm wondering how to use that serial number as a license key now? How to make every time you start AutoCAD a request to enter a license key?

0 Likes
Message 12 of 18

hak_vz
Advisor
Advisor

Check this link

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 13 of 18

Anonymous
Not applicable

I was thinking of some code inside .lsp that would ask for a serial key. Also is there anything free?

0 Likes
Message 14 of 18

Sea-Haven
Mentor
Mentor
Accepted solution

Ok make a fas when happy with lisp,

 

 

run get setserial id as suggested.
(if (= "1233456" serialnum)(princ "ok")
(progn (alert "Ok I know you have pirated the software you !@#$%\n pay your money to use it")(exit))
)

 

Ok now for the lesson how do I put in 25 modules its super easy if your old like me and take advantage of a DOS function, you write the lisp serial.lsp which has the get disk id and the disk number. 

 

Then its simple DOS from CMD 

Copy serial.lsp+lisp1.lsp c:\serialisp\lisp1

repeat use a batch file.

 

The tricky bit is how do you get the end users serial number ? Send him a Fas and they email the number to you. 

 

You can multi lisp to individual fas via a lisp program or batch into a vlx.

 

Message 15 of 18

hak_vz
Advisor
Advisor

@AnonymousIt is as simple as @Sea-Haven stated. Proposed code works under same principles, with probably some aditional security options. Its help actually shows how to do as a software developer you should be able to write it down. 

If someone is so desperate, he can change disk serial number (google it), so you have to think about way to do it. What if user reinstalls payed software to new computer....?

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Message 16 of 18

Sea-Haven
Mentor
Mentor

I work on the 99% rule that people have no idea of how to break the security code. 

 

There are other ways like pinging a web site server and comparing a disk id etc.

 

Re installs to new pc has to know about using disk ID. When asking for ID number scramble etc or convert to hex. Even use characters in excess of assci code 127 in a emailed string so will not appear visible at 1st. Can auto email from lisp.

 

I have been contacted "the software is not working" it turns out the guy was trying to install on buddy's computer and abrupt "No" pay please.

 

Message 17 of 18

Anonymous
Not applicable

i am re activate auotocad2020.but the licence expire and i don't  no serail number and product key .so please inform me any one where is it and how is it find out.

0 Likes
Message 18 of 18

Anonymous
Not applicable
serial number for product key 001I1 in autocad 2017
0 Likes