Retrieve AutoCAD Build Data using AutoLISP19 Oct 2017
I noticed earlier today a post on Facebook asking for a programmatic method to query the service pack, update, hotfix, etc. of multiple seats of AutoCAD Civil 3D. I’m not certain this bit of code satisfies all of this request, but it may help.
The AutoCAD vlax-machine-product-key provides a string containing a portion of the Windows registry for the current running AutoCAD. In the post above, a registry path name to the Release key provided a value that may be different from the current version of AutoCAD. This is caused by patches and updates to the program.
With some testing it turns out the current patched version number is located in the Windows Registry. However, it is not on the same registry branch (ACAD-0000:409) as mentioned in the Facebook post. The branch containing the current version does not include the LocaleID (409). Therefore, removing the LocaleID from the product key registry path, a ProductInfo registry branch can be found.
This ProductInfo registry branch contains the name of each installed version of the current product key in addition to the BuildVer and SPNum. My assumption is these last two items are the Build Version and the Service Pack number, but that is pure speculation.
The ProductInfo registry branch is found in AutoCAD version ranging from 2016 to 2018. Earlier versions did not include this registry branch.
The code below returns a list of information from the ProductInfo registry branch. It also includes the computer name, because it wouldn’t make much sense to provide a list of information
(defun OP:GetBuildData (/ lBuildData sProdKey lData) ;| OP_GetACADBuildData_1_0.lsp Version History 1.0 October 19, 2017 Initial Release Dependencies: none Usage: (op:getbuilddata) Arguments: none Returns: list containing current computer name and ProductInfo registry key of currently running AutoCAD product Copyright © 2017 by Richard Lawrence Written permission must be obtained to copy, modify, and distribute this software. Permission to use this software for any purpose and without fee is hereby granted, provided that the above copyright notice appears in all copies and that both the copyright notice and the limited warranty and restricted rights notice below appear in all supporting documentation. THIS PROGRAM IS PROVIDED "AS IS" AND WITH ALL FAULTS. ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE ARE HEREIN DISCLAIMED. THERE IS NO WARRANTY THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED OR ERROR FREE. USAGE OF THIS PROGRAM IS AT YOUR OWN RISK. |; (setq lBuildData (list (getenv "COMPUTERNAME")) sProdKey (strcat "HKEY_LOCAL_MACHINE\\" (substr (vlax-machine-product-key) 1 (vl-string-search ":" (vlax-machine-product-key)) ) "\\ProductInfo" ) ) (foreach n (vl-registry-descendents sProdKey) (setq lData (list (cons n (list (vl-registry-read (strcat sProdKey "\\" n) "BuildVer" ) (vl-registry-read (strcat sProdKey "\\" n) "SPNum" ) ) ) ) lBuildData (append lBuildData lData) ) ) )Select allDownload
How you may document this information is up to the user.
Remember, modifying the Windows Registry is a dangerous task. The code posted with this post is designed to only read from the Windows Registry.
If you have suggestions to improve this code, leave a comment below.