Computer Name or ID (1 Viewer)

Tsango

Registered User.
Local time
Today, 10:41
Joined
Mar 31, 2006
Messages
64
Anyone know how to get the computer ID or name unique to your computer?

I want to be able to use it in a database to keep logs for each computer on the network.

Any ideas?
 

Tsango

Registered User.
Local time
Today, 10:41
Joined
Mar 31, 2006
Messages
64
Rich said:
Use the search function here, I'm sure you'll find it

I did.

I spent about 20 minutes looking but found nothing of value.

Will have another dig about....
 

Tsango

Registered User.
Local time
Today, 10:41
Joined
Mar 31, 2006
Messages
64
Rich said:
Did you follow rak's link?

Yes, have had a look at it. Tried the harddrive serial number thing but it just returned "0000-0000" on all harddrives I tried it on.

Nevermind, if there is no easy way to do it, I can just produce my own unique ID for each current session

Thanks for ytour replies.
 

TanisAgain

David
Local time
Today, 10:41
Joined
Feb 21, 2006
Messages
69
Have you tried this.
Option Compare Database

'******************** Code Start **************************
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Private Declare Function apiGetComputerName Lib "kernel32" Alias _
"GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Function fOSMachineName() As String
'Returns the computername
Dim lngLen As Long, lngX As Long
Dim strCompName As String
lngLen = 16
strCompName = String$(lngLen, 0)
lngX = apiGetComputerName(strCompName, lngLen)
If lngX <> 0 Then
fOSMachineName = Left$(strCompName, lngLen)
Else
fOSMachineName = ""
End If
End Function
'******************** Code End **************************

Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If lngX <> 0 Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = ""
End If
End Function
 

garygdj

Registered User.
Local time
Today, 05:41
Joined
May 25, 2006
Messages
19
No. I did create a database that kept track of each computer and when it was logged onto. However, I sent an E-mail to all 300 employees and had them supply the number. then created a table........

In a smaller shop that may be an alternative.
 

ghudson

Registered User.
Local time
Today, 05:41
Joined
Jun 8, 2002
Messages
6,195
What if another user signs into another users computer? What if a user changes the computer name on their PC [if they have the rights to do so on thier PCs]? What if... Too many what ifs.

I work with thousands of possible users so I know you can not trust everybody to do it the right way [so we use code to get what we want, our way].
 

Users who are viewing this thread

Top Bottom