Here is how to get the C: drive serial number:
Set fso = CreateObject("Scripting.FileSystemObject")
Set d = fso.GetDrive("C:")
s = Hex(d.SerialNumber)
MsgBox "SN of C: is " & Left(s, 4) & "-" & Right(s, 4)
Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
You can return the Computer name on the network with the following code (courtesy of Dev Ashish)
Option Compare Database
Option Explicit
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
Regards
Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now -
If the issue is to get the netbios computer name (not the same as machine number) and provided you're not with a win9x kernel (ie you're on NT,2000,XP or 2003) then simply try this:
MsgBox Environ("USERNAME") & " on " & Environ("COMPUTERNAME")
Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
PHV, when I tried your code I got this number:
44B9-10E5
Is this the Hard Disk number?
Is this number Unique?
When I did ipconfig /all I got the physical addresses:
Ethernet Physical Address:
00-07-E9-BD-E2-12 and
PPP Adapter:
00-53-45-00-00-00
Which one is the MAC address?
Can I use the hard disk number as means for security? I save the number in a veriable then match it when the form loads, if it does not match then the owner of the application gave a copy to someone esle.
1) It is the partition serial number assigned during the formatting. If you reformat your partition, this number change. AFAIK nobody can force this number to a predefined one.
2) The MAC address of the NIC is it's Ethernet Physical Address, but I know some NICs accept aliases, so someone may cheat.
Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.