Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Motherboard Serial Number
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00660435
Message ID:
00660724
Views:
10
>I thought motherboards did not have serial numbers, only cpus (PIII and up), but I found this. Here is code to do this in VB, maybe someone out there can modify it to work with VFP? (George and Ed know alot about scripting)
>
>YOU MUST HAVE WMI INSTALLED AND A REFERENCE TO
>Microsoft WMI Scripting Library IS REQUIRED IN VB FOR THIS TO WORK
>
>
>Public Function MBSerialNumber() As String
>
>Dim objs As Object
>
>Dim obj As Object
>Dim WMI As Object
>Dim sAns As String
>
>
>Set WMI = GetObject("WinMgmts:")
>Set objs = WMI.InstancesOf("Win32_BaseBoard")
>For Each obj In objs
>  sAns = sAns & obj.SerialNumber
> If sAns < objs.Count Then sAns = sAns & ","
>Next
>MBSerialNumber = sAns
>End Function
>
>
>
>
>
>>I have already sent a message for everybody, but I think you didn't see it...
>>
>>Thanks anyway...
>>
>>Silvio

Tracy,

I haven't played around with this much. However, I believe, that in order for GETOBJECT() in VFP to work, you'll have to first create one of the WMI object. Like so
oWMI = CREATEOBJECT("WbemScripting.SWbemNamedValueSet")
oObj = GETOBJECT("WINMGMTS:")
GETOBJECT() will fail otherwise. Now whether or not that's the ProgID you need in CREATEOBJECT(), is another question entirely. I haven't been able to duplicate your code in VBScript in VFP (yet), but the documentation shows a lot of useful information. I think (but don't know for sure) that WMI may install on Win2K Pro by default. That's a guess, however.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform