I
im281088
I want to create a file which is locked to host id of computer. can anyone tell me how to detect host id of a computer in excel.
I want to create a file which is locked to host id of computer. can anyone tell me how to detect host id of a computer in excel.
try...
Private Function Get_BIOSserialNum() As String
' Gets the serial number of a PC's BIOS
Dim oWMI As Variant, vSettings As Variant, vBIOS As Variant
Const sComputer$ = _
"winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2"
Set oWMI = CreateObject(sComputer)
Set vSettings = oWMI.ExecQuery("Select * from Win32_BIOS")
For Each vBIOS In vSettings
Get_BIOSserialNum = Trim(vBIOS.SerialNumber): Next
End Function '//Get_BIOSserialNum
..note, though, that some clones won't have a serial number and so
you'll need to handle what to do in this case.
I agree with what you have written in terms of identification of a specific
machine. However, the OP requested a method for obtaining the "Host ID".
The various definitions I have seen for Host ID have been satisfied by the
MAC address (or IP address) in Windows machines. I believe that is also the
case for Unix machines (see hostid command).
Oh, and my machine is built by myself; your routine returns
"To Be Filled By O.E.M." (Which is what is in all the Chassis
Information slots except for Type: Desktop)
Oh, and my machine is built by myself; your routine returns "To Be Filled By
O.E.M." (Which is what is in all the Chassis Information slots except for
Type: Desktop)
Is there not a way to acquire the CPU ID (in Intel cases where it is
not turned off in the BIOS)?
Ron Rosenfeld used his keyboard to write :
No argument! The MAC address can be edited/changed and so if this
occurs it will break the methodology the OP is trying to implement.
How do I call this: (remember to paste it all back together right)
[[[[[[dotnet.loadAssembly @"System.Management.dll"
mc = dotNetObject "System.Management.ManagementClass" "Win64_Processor"
moc = dotNetClass "System.Management.ManagementObjectCollection"
moc = mc.GetInstances()
enumerator = moc.GetEnumerator()
while enumerator.MoveNext() do
(
mo = enumerator.current
append CPUID ( mo.Properties.Item["ProcessorId"].value )
)]]]]]]
It happens that CellShocked formulated :
For all intents and purposes, the BIOS serial number IS the cpu's ID.
The only way to change it is to swap out the motherboard, which creates
a new cpu with a new ID.<g>
CellShocked explained :How do I call this: (remember to paste it all back together right)
[[[[[[dotnet.loadAssembly @"System.Management.dll"
mc = dotNetObject "System.Management.ManagementClass" "Win64_Processor"
moc = dotNetClass "System.Management.ManagementObjectCollection"
moc = mc.GetInstances()
enumerator = moc.GetEnumerator()
while enumerator.MoveNext() do
(
mo = enumerator.current
append CPUID ( mo.Properties.Item["ProcessorId"].value )
)]]]]]]
This is dotnet code and so won't work with VBA. Use the code I posted
here earlier...
Intel CPUs have a unique identifier number which can be accessed though
their API. The motherboard serial number is an entirely different
animal, and BOTH numbers can be changed by way of changing either the CPU
itself, or the BIOS chip itself. some motherboards have a separate,
fixed chip which the real BIOS chip 'reads' to assign certain variables
in its operation. So, on those MOBOs, you will not change that ID
easily.
Hmmm. I doubt that UUID represents a machine specific value, because
the identical UUID appears in an example here:
CellShocked explained :How do I call this: (remember to paste it all back together right)
[[[[[[dotnet.loadAssembly @"System.Management.dll"
mc = dotNetObject "System.Management.ManagementClass" "Win64_Processor"
moc = dotNetClass "System.Management.ManagementObjectCollection"
moc = mc.GetInstances()
enumerator = moc.GetEnumerator()
while enumerator.MoveNext() do
(
mo = enumerator.current
append CPUID ( mo.Properties.Item["ProcessorId"].value )
)]]]]]]
This is dotnet code and so won't work with VBA. Use the code I posted
here earlier...
Your code? On a 64 bit system?
Yes!
And what about answering the question
where I asked just how to store that code in the excel VB editor (where)
and how to call it?