Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Mike Gagnon
  Where is Mike Gagnon?
 Pointe Claire
 Canada
 Mike Gagnon
 To: Yousfi Benameur
  Where is Yousfi Benameur?
 El Bayadh
 Algeria
 Yousfi Benameur
 Tags
Subject: RE: Hard Disk Serial No.
Thread ID: 268084 Message ID: 268686 # Views: 59 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Security and Application Protection
Date: Wednesday, July 14, 2010 2:17:28 AM         
   


> > hi Experts,
> > How can i get Harddisk Serial No.?
> > Thanks
>
> The best and optimum way to return all parameters of physical materials is to use WMI classes documented in MSDN:
> http://msdn.microsoft.com/en-us/library/aa394346%28VS.85%29.aspx
>
>
> *!*--Author Yousfi Benameur El Bayadh Algeria
> *!*--Time stamp mardi 13 juillet 2010; 14:24:42
> *!*--Subject :Win32_PhysicalMedia Class
> *!*--Version VFP9SP2
> 
> strComputer = "."
> objWMIService = GetObject("winmgmts:"+ "{impersonationLevel=impersonate}!\\" + strComputer + "\root\cimv2")
> colDiskDrives = objWMIService.ExecQuery ("Select * from Win32_DiskDrive")
> cr=chr(13)
> x="Enumerating Physical Disk Properties"+cr+cr
> 
> For each objDiskDrive in colDiskDrives
>    x=x+("Bytes Per Sector: " +  trans( objDiskDrive.BytesPerSector )       )+cr    
>      
>    x=x+("Caption: " +  objDiskDrive.Caption)+cr
>    x=x+("Device ID: " +   objDiskDrive.DeviceID)+cr
>    x=x+("Index: " +   trans(objDiskDrive.Index))+cr
>    x=x+("Interface Type: " +  objDiskDrive.InterfaceType)+cr
>    x=x+("Manufacturer: " +  objDiskDrive.Manufacturer)+cr
>    x=x+("Media Loaded: "   + trans(objDiskDrive.MediaLoaded))+cr
>    x=x+("Media Type: " +   objDiskDrive.MediaType)+cr
>    x=x+("Model: " +   objDiskDrive.Model)+cr
>    x=x+("Name: " +   objDiskDrive.Name)+cr
>    x=x+("Partitions: " +  trans(objDiskDrive.Partitions))+cr
>    x=x+("PNP DeviceID: " +   objDiskDrive.PNPDeviceID)+cr
>    x=x+("SCSI Bus: " +   trans(objDiskDrive.SCSIBus))+cr
>    x=x+("SCSI Logical Unit: " +    trans( objDiskDrive.SCSILogicalUnit))+cr
>    x=x+("SCSI Port: " +   trans(objDiskDrive.SCSIPort))+cr
>    x=x+("SCSI TargetId: " +   trans(objDiskDrive.SCSITargetId)    )+cr
>    x=x+("Sectors Per Track: " +       trans(objDiskDrive.SectorsPerTrack) )+cr       
>    x=x+("Signature: " +  trans( objDiskDrive.Signature)          )+cr
>    x=x+("Size: " +   trans(objDiskDrive.Size )    )+cr
>    x=x+("Status: " +   objDiskDrive.Status         )+cr
>    x=x+("Total Cylinders: " +     trans(objDiskDrive.TotalCylinders)   )+cr      
>    x=x+("Total Heads: " +  trans( objDiskDrive.TotalHeads)    )+cr
>    x=x+("Total Sectors: " +   trans(objDiskDrive.TotalSectors))+cr
>    x=x+("Total Tracks: " +  trans( objDiskDrive.TotalTracks))+cr
>    x=x+("Tracks Per Cylinder: " +  trans(objDiskDrive.TracksPerCylinder)  )+cr
> Next
> messagebox(x,0+32+4096)
> _cliptext=x    &&text in the clipboard
> 

>
>
> Regards
> Yousfi Benameur

But no serial number, just model? I think you are using the wrong class, it should be Win32_PhysicalMedia Class as in your subect.

Mike Gagnon
Refox XI +(English version)

ENTIRE THREAD

Hard Disk Serial No. Posted by gaurav sharma @ 7/8/2010 1:58:07 PM
RE: Hard Disk Serial No. Posted by Glen Villar @ 7/8/2010 2:02:39 PM
RE: Hard Disk Serial No. Posted by loo peng @ 7/10/2010 11:37:39 AM
RE: Hard Disk Serial No. Posted by Mike Gagnon @ 7/10/2010 12:28:37 PM
RE: Hard Disk Serial No. Posted by khubaib khalid @ 7/11/2010 8:01:36 AM
RE: Hard Disk Serial No. Posted by Mike Gagnon @ 7/11/2010 12:29:41 PM
RE: Hard Disk Serial No. Posted by khubaib khalid @ 7/11/2010 12:45:18 PM
RE: Hard Disk Serial No. Posted by tushar @ 7/8/2010 2:06:02 PM
RE: Hard Disk Serial No. Posted by gaurav sharma @ 7/8/2010 2:12:05 PM
RE: Hard Disk Serial No. Posted by tushar @ 7/8/2010 3:49:59 PM
RE: Hard Disk Serial No. Posted by gaurav sharma @ 7/9/2010 7:55:49 AM
RE: Hard Disk Serial No. Posted by tushar @ 7/9/2010 8:20:11 AM
RE: Hard Disk Serial No. Posted by Leonid Lepin @ 7/8/2010 3:12:58 PM
RE: Hard Disk Serial No. Posted by tom knauf @ 7/9/2010 5:07:52 PM
RE: Hard Disk Serial No. Posted by loo peng @ 7/10/2010 11:35:57 AM
RE: Hard Disk Serial No. Posted by tom knauf @ 8/20/2010 4:41:05 PM
RE: Hard Disk Serial No. Posted by Yousfi Benameur @ 7/13/2010 3:23:31 PM
RE: Hard Disk Serial No. Posted by Mike Gagnon @ 7/14/2010 2:17:28 AM
RE: Hard Disk Serial No. Posted by Yousfi Benameur @ 7/14/2010 12:27:02 PM
RE: Hard Disk Serial No. Posted by Mike Gagnon @ 7/15/2010 3:09:38 AM
RE: Hard Disk Serial No. Posted by Yousfi Benameur @ 7/15/2010 8:28:43 AM
RE: Hard Disk Serial No. Posted by Leonid Lepin @ 7/15/2010 10:34:12 AM
RE: Hard Disk Serial No. Posted by Yousfi Benameur @ 7/15/2010 1:01:31 PM
RE: Hard Disk Serial No. Posted by Adam Walan @ 7/13/2010 7:40:36 PM
RE: Hard Disk Serial No. Posted by Mike Gagnon @ 7/14/2010 2:19:09 AM
RE: Hard Disk Serial No. Posted by marcelo ferrone @ 10/17/2010 5:44:32 PM