Hi,
How can i get the unique computer id?
My program makes extensive use of userforms, so a
user cannot utilise it without enabling macros.
I have searched but cannot seem to find code
to get compid. There are lots of cautionary
notes around this.
Thanking you
Mohamed
The inevitable question: Get Computer ID
-
- 3StarLounger
- Posts: 366
- Joined: 12 May 2010, 06:49
-
- Administrator
- Posts: 78475
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: The inevitable question: Get Computer ID
What exactly do you mean by "unique computer ID" and what would you use it for - I don't see the connection to enabling macros.
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 366
- Joined: 12 May 2010, 06:49
Re: The inevitable question: Get Computer ID
Hi Hans,
Sorry for the late reply...
I attempting to safeguard .xlsm from piracy, workbook open event would verify computer id against the id obtained from the end-user before distribution (perhaps that's the incorrect term, maybe pc serial number) whichever is unique to each pc.
This unique number to be stored & compared each time .xlsm is opened, if it doesn't match, then give msg & close workbook.
Becoz workbook can only be used with userforms macros has to be enabled.
I should have described such in first post.
Thanks
Mohamed
Sorry for the late reply...
I attempting to safeguard .xlsm from piracy, workbook open event would verify computer id against the id obtained from the end-user before distribution (perhaps that's the incorrect term, maybe pc serial number) whichever is unique to each pc.
This unique number to be stored & compared each time .xlsm is opened, if it doesn't match, then give msg & close workbook.
Becoz workbook can only be used with userforms macros has to be enabled.
I should have described such in first post.
Thanks
Mohamed
-
- Administrator
- Posts: 78475
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: The inevitable question: Get Computer ID
You can use the following code to get the computer's serial number:
The user can get the serial number from the service tag on the PC, or you could give them the .vbs file in the attached zip file; when opened from Windows Explorer it will display the serial number.
Code: Select all
Function GetSerial() As String
Dim strComputer As String
Dim objWMIService As Object
Dim colSMBIOS As Object
Dim objSMBIOS As Object
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colSMBIOS = objWMIService.ExecQuery _
("Select * from Win32_SystemEnclosure")
For Each objSMBIOS In colSMBIOS
GetSerial = objSMBIOS.SerialNumber
Next objSMBIOS
End Function
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 366
- Joined: 12 May 2010, 06:49
Re: The inevitable question: Get Computer ID
Thanks Hans,
Thats awesome. I only accessed the post now & see 35 downloads already.
You should start charging for this service!
Kindest regards
Mohamed
Thats awesome. I only accessed the post now & see 35 downloads already.
You should start charging for this service!
Kindest regards
Mohamed
-
- Administrator
- Posts: 78475
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: The inevitable question: Get Computer ID
Hi Mohamed,MSingh wrote:You should start charging for this service!
The idea behind Eileen's Lounge is a free exchange of information, we're not trying to make money.
Best wishes,
Hans
Hans
-
- StarLounger
- Posts: 61
- Joined: 29 Jul 2010, 14:52
Re: The inevitable question: Get Computer ID
That's the best part of it all lol, joking :PHansV wrote:Hi Mohamed,MSingh wrote:You should start charging for this service!
The idea behind Eileen's Lounge is a free exchange of information, we're not trying to make money.
I'm really amazed by your range of knowledge in computers O_o
I don't have one