Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how to detect host id of a computer using 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 587
Default how to detect host id of a computer using excel

hi,

sHostName = Application.UserName

isabelle


Le 2013-01-05 11:33, a écrit :
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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 587
Default how to detect host id of a computer using excel

also,

sHostName2 = Environ$("computername")

isabelle

Le 2013-01-05 11:55, isabelle a écrit :
hi,

sHostName = Application.UserName

isabelle


Le 2013-01-05 11:33, a écrit :
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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default how to detect host id of a computer using 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}!\\.\roo t\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.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 277
Default how to detect host id of a computer using excel

On Sat, 05 Jan 2013 14:05:33 -0500, GS wrote:

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}!\\.\roo t\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.



Where do I place a private function? I have not previously ever
defined one.

So far, the macro area of my worksheet does not do it.

And how do I call it? no arguments, right? Just =call() in the
cell and it resolves?

So far I get a name error. I have yet to place it in the right
location so that it shows up in the function list.


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default how to detect host id of a computer using excel

The function is scoped Private because it belongs to my licensing
component. You can delete that keyword.

The function is not designed to be called/use on a worksheet. It should
be called from another Sub in a standard module. Also, the function
should reside in a standard module. To use it...

Range("A1").Text = Get_BIOSserialNum

HTH

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 147
Default how to detect host id of a computer using excel

wrote:
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.


what is host id?
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,045
Default how to detect host id of a computer using excel

On Sat, 5 Jan 2013 08:33:39 -0800 (PST), wrote:

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.


Here's a routine to obtain the MACAddress, from
http://www.ehow.com/how_6920281_use-...c-address.html

============================
Option Explicit
Function GetMACAddress()
Dim objVMI As Object
Dim vAdptr As Variant
Dim objAdptr As Object
Dim adptrCnt As Long
Dim GetNetworkConnectionMACAddress As String
Set objVMI = GetObject("winmgmts:\\" & "." & "\root\cimv2")
Set vAdptr = objVMI.execquery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")

For Each objAdptr In vAdptr
If Not IsNull(objAdptr.MACAddress) And IsArray(objAdptr.IPAddress) Then
For adptrCnt = 0 To UBound(objAdptr.IPAddress)
If Not objAdptr.IPAddress(adptrCnt) = "0.0.0.0" Then
GetNetworkConnectionMACAddress = objAdptr.MACAddress
Exit For
End If
Next adptrCnt
MsgBox "Your MAC Address is: " & GetNetworkConnectionMACAddress
End If
Next objAdptr

End Function
======================================
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default how to detect host id of a computer using excel

I recommend using WMI to obtain the BIOS serial number because all the
values recommended by you and Isabelle (thus far) can be
edited/changed. The only way to change the BSN is to replace the
motherboard. In the case of a clone machine returning an empty BSN, I
substitute with a hash value of that empty string via SHA256. When this
is combined with make & model it serves well enough for my purposes.<g

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,045
Default how to detect host id of a computer using excel

On Sat, 05 Jan 2013 18:34:51 -0500, GS wrote:

I recommend using WMI to obtain the BIOS serial number because all the
values recommended by you and Isabelle (thus far) can be
edited/changed. The only way to change the BSN is to replace the
motherboard. In the case of a clone machine returning an empty BSN, I
substitute with a hash value of that empty string via SHA256. When this
is combined with make & model it serves well enough for my purposes.<g


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).


  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default how to detect host id of a computer using excel

Ron Rosenfeld used his keyboard to write :
On Sat, 05 Jan 2013 18:34:51 -0500, GS wrote:

I recommend using WMI to obtain the BIOS serial number because all the
values recommended by you and Isabelle (thus far) can be
edited/changed. The only way to change the BSN is to replace the
motherboard. In the case of a clone machine returning an empty BSN, I
substitute with a hash value of that empty string via SHA256. When this
is combined with make & model it serves well enough for my purposes.<g


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).


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.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 277
Default how to detect host id of a computer using excel

On Sat, 05 Jan 2013 20:30:03 -0500, GS wrote:

Ron Rosenfeld used his keyboard to write :
On Sat, 05 Jan 2013 18:34:51 -0500, GS wrote:

I recommend using WMI to obtain the BIOS serial number because all the
values recommended by you and Isabelle (thus far) can be
edited/changed. The only way to change the BSN is to replace the
motherboard. In the case of a clone machine returning an empty BSN, I
substitute with a hash value of that empty string via SHA256. When this
is combined with make & model it serves well enough for my purposes.<g


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).


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 )
)]]]]]]
  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,045
Default how to detect host id of a computer using excel

On Sat, 05 Jan 2013 18:34:51 -0500, GS wrote:

I recommend using WMI to obtain the BIOS serial number because all the
values recommended by you and Isabelle (thus far) can be
edited/changed. The only way to change the BSN is to replace the
motherboard. In the case of a clone machine returning an empty BSN, I
substitute with a hash value of that empty string via SHA256. When this
is combined with make & model it serves well enough for my purposes.<g


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)

  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 277
Default how to detect host id of a computer using excel

On Sat, 05 Jan 2013 20:03:28 -0500, Ron Rosenfeld wrote:

On Sat, 05 Jan 2013 18:34:51 -0500, GS wrote:

I recommend using WMI to obtain the BIOS serial number because all the
values recommended by you and Isabelle (thus far) can be
edited/changed. The only way to change the BSN is to replace the
motherboard. In the case of a clone machine returning an empty BSN, I
substitute with a hash value of that empty string via SHA256. When this
is combined with make & model it serves well enough for my purposes.<g


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)?
  #15   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default how to detect host id of a computer using excel

It happens that CellShocked formulated :
On Sat, 05 Jan 2013 20:03:28 -0500, Ron Rosenfeld wrote:

On Sat, 05 Jan 2013 18:34:51 -0500, GS wrote:

I recommend using WMI to obtain the BIOS serial number because all the
values recommended by you and Isabelle (thus far) can be
edited/changed. The only way to change the BSN is to replace the
motherboard. In the case of a clone machine returning an empty BSN, I
substitute with a hash value of that empty string via SHA256. When this
is combined with make & model it serves well enough for my purposes.<g


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)?


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

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion




  #16   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default how to detect host id of a computer using excel

After serious thinking Ron Rosenfeld wrote :
On Sat, 05 Jan 2013 18:34:51 -0500, GS wrote:

I recommend using WMI to obtain the BIOS serial number because all the
values recommended by you and Isabelle (thus far) can be
edited/changed. The only way to change the BSN is to replace the
motherboard. In the case of a clone machine returning an empty BSN, I
substitute with a hash value of that empty string via SHA256. When this
is combined with make & model it serves well enough for my purposes.<g


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)


Interesting that this is the stored value. Obviously this is different
than what's returned in a commercial unit. For example, I find it
typical of clone machines released by Gateway to return an empty
string. Your case is a new one for me!<g

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #17   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,045
Default how to detect host id of a computer using excel

On Sat, 05 Jan 2013 20:33:38 -0500, GS wrote:

After serious thinking Ron Rosenfeld wrote :
On Sat, 05 Jan 2013 18:34:51 -0500, GS wrote:

I recommend using WMI to obtain the BIOS serial number because all the
values recommended by you and Isabelle (thus far) can be
edited/changed. The only way to change the BSN is to replace the
motherboard. In the case of a clone machine returning an empty BSN, I
substitute with a hash value of that empty string via SHA256. When this
is combined with make & model it serves well enough for my purposes.<g


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)


Interesting that this is the stored value. Obviously this is different
than what's returned in a commercial unit. For example, I find it
typical of clone machines released by Gateway to return an empty
string. Your case is a new one for me!<g


Doing a little more digging, using CPUID PC Wizard 2012, I note that my BIOS information does, indeed, contain an entry termed "Motherboard ID". However, as I wrote before, that is NOT what is returned by your code. It is obviously accessible, since PC Wizard accesses it, but I don't know how to approach this in VBA.
  #18   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,045
Default how to detect host id of a computer using excel

On Sat, 05 Jan 2013 20:33:38 -0500, GS wrote:

After serious thinking Ron Rosenfeld wrote :
On Sat, 05 Jan 2013 18:34:51 -0500, GS wrote:

I recommend using WMI to obtain the BIOS serial number because all the
values recommended by you and Isabelle (thus far) can be
edited/changed. The only way to change the BSN is to replace the
motherboard. In the case of a clone machine returning an empty BSN, I
substitute with a hash value of that empty string via SHA256. When this
is combined with make & model it serves well enough for my purposes.<g


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)


Interesting that this is the stored value. Obviously this is different
than what's returned in a commercial unit. For example, I find it
typical of clone machines released by Gateway to return an empty
string. Your case is a new one for me!<g


Some interesting further investigation, the significance of which I have no idea.
PCWizard returns the following in the "Mainboard" section:

----------------------------------------------
<<< Mainboard

Manufacturer : To Be Filled By O.E.M.


General Information

Product : To Be Filled By O.E.M.
Version : To Be Filled By O.E.M.
Serial Number : To Be Filled By O.E.M.
Unique ID : 00020003-00040005-00060007-00080009
SKU : To Be Filled By O.E.M.
Family : To Be Filled By O.E.M.
Start mode : Power Switch

OEM Information

OEM #1 : To Be Filled By O.E.M.

Chassis Information

Intrusion detected : Unspecified

Mainboard : ASRock Z77 Extreme6


General Information

Manufacturer : ASRock
Product : Z77 Extreme6
Version : Unspecified
Serial Number : Unspecified
Support MP : Yes, 4 CPU(s)
Version MPS : 1.4

Chassis Information

Manufacturer : To Be Filled By O.E.M.
Type : Desktop
Version : To Be Filled By O.E.M.
Serial Number : To Be Filled By O.E.M.
Asset : To Be Filled By O.E.M.
--------------------------------------------
So there does seem to be a UUID associated with this system.

In the original version of your Get_BIOSserialNum function, if I examine vBIOS in the Watch window and look at Qualifiers_ Item 4, I see, (in part):
: Name : "UUID"
: Value : "{8502C4E1-5FBB-11D2-AAC1-006008C78BC7}"
I don't really know what this represents.

If I modify your Get_BIOSserialNum function to look at Win32_ComputerSystemProduct, then the UUID returned is similar but not identical to that returned by PC Wizard:
vbios.UUID -- 03000200-0400-0500-0006-000700080009

Thoughts?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Script Host in Excel VBA jasontferrell Excel Programming 10 November 4th 09 09:27 PM
Update the excel file on my computer, once a new version excel fileis add on other computer within same network. satish Excel Programming 1 September 29th 09 09:41 AM
Online sharing Host for working Excel file? CBRR Excel Discussion (Misc queries) 1 January 8th 08 08:17 PM
How do I copy all Excel files from old computer to new computer? Rfarsh Excel Discussion (Misc queries) 2 December 20th 05 03:23 AM
Can a workbook be opened w/out Excel on the host machine?? MIchelleDuquette Excel Discussion (Misc queries) 2 May 5th 05 08:18 PM


All times are GMT +1. The time now is 10:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"