Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Pete Sass
  Where is Pete Sass?
 Marathon, Ontario
 Canada
 Pete Sass
 To: Mike Gagnon
  Where is Mike Gagnon?
 Pointe Claire
 Canada
 Mike Gagnon
 Tags
Subject: RE: Server Hdd Sl.no
Thread ID: 331511 Message ID: 331574 # Views: 64 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Projects and Design
Date: Saturday, December 31, 2011 6:05:08 PM         
   


> > Hi
> > My application check the hdd serial number while login the user. It gets correct C Drive slno of the system from where the short cut is running in client pc. I would like to get the serial number of the Server pc, for all users who are running the application. Coding is as follows. Can any one correct the same to get the above out put.
> >
> >
> > PROCEDURE hddslno
> > PARAMETERS mhddslno
> > tcdrive=' ' 
> > local lnSerial, lcSerial, lcDrive
> > IF EMPTY(tcDrive)
> > 	lcDrive = "C:\"
> > ELSE
> > 	lcDrive = ADDBS(tcDrive)
> > ENDIF 
> > 
> > declare integer GetVolumeInformation in Win32API ;
> > 	string  lpRootPathName, ;
> > 	string  @lpVolumeNameBuffer, ;
> > 	integer nVolumeNameSize, ;
> > 	integer @lpVolumeSerialNumber, ;
> > 	integer @lpMaximumComponentLength, ;
> > 	integer @lpFileSystemFlags, ;
> > 	string  @lpFileSystemNameBuffer, ;
> > 	integer nFileSystemNameSize
> > 	
> > lnSerial = 0
> > GetVolumeInformation(lcDrive,.null.,0,@lnSerial,0,0,.null.,0)
> > 
> > If lnSerial < 0
> > 	lnSerial = lnSerial + 2^32
> > Endif
> > 

> >
> > Regards
> > Sajan Jacob
>
> This will get you the serial number of either the local hard disk or the server hard disk serial number (just change the variable strComputer to the IP address of the server):
>
Local objWMI,colClass,objClass,strComputer
> Create Cursor PhysicalMedia (serialnumber c(100))
> strComputer = "." && Or IP address
> objWMI = Getobject("winmgmts:\\" +strComputer + "\root\cimv2")
> colClass = objWMI.ExecQuery("Select * from Win32_PhysicalMedia",,48)
> 
> For Each objClass In colClass
> 	If !Isnull(objClass.serialnumber)
> 		Insert Into PhysicalMedia (serialnumber) Values (objClass.serialnumber)
> 	Endif
> Next
> Browse Normal

>
>
>
> Mike Gagnon
> Refox XI +(English version)


Hi,
Seems to work fine on local computer, but when I try for my server using IP address I get the following error message....


Pete "the IceMan", from the Great White North of Canada.
www.marathongriffincomputers.com

ENTIRE THREAD

Server Hdd Sl.no Posted by Sajan Jacob @ 12/30/2011 4:25:08 PM
RE: Server Hdd Sl.no Posted by Jun Tangunan @ 12/30/2011 11:10:20 PM
RE: Server Hdd Sl.no Posted by Sajan Jacob @ 1/2/2012 1:45:27 PM
RE: Server Hdd Sl.no Posted by Mike Gagnon @ 12/31/2011 12:44:47 PM
RE: Server Hdd Sl.no Posted by Pete Sass @ 12/31/2011 6:05:08 PM
RE: Server Hdd Sl.no Posted by Mike Gagnon @ 1/1/2012 5:04:52 AM
RE: Server Hdd Sl.no Posted by Pete Sass @ 1/1/2012 4:43:24 PM
RE: Server Hdd Sl.no Posted by Mike Gagnon @ 1/2/2012 2:11:32 AM
RE: Server Hdd Sl.no Posted by Sajan Jacob @ 1/2/2012 1:27:03 PM
RE: Server Hdd Sl.no Posted by Mike Gagnon @ 1/2/2012 5:20:30 PM
RE: Server Hdd Sl.no Posted by Pete Sass @ 1/2/2012 5:52:07 PM
RE: Server Hdd Sl.no Posted by Jun Tangunan @ 1/2/2012 11:38:03 PM
RE: Server Hdd Sl.no Posted by Sajan Jacob @ 1/3/2012 10:42:34 AM
RE: Server Hdd Sl.no Posted by Mike Gagnon @ 1/3/2012 11:38:56 AM
RE: Server Hdd Sl.no Posted by Sajan Jacob @ 1/3/2012 1:14:55 PM
RE: Server Hdd Sl.no Posted by Mike Gagnon @ 1/3/2012 1:23:09 PM
RE: Server Hdd Sl.no Posted by Mike Gagnon @ 1/3/2012 11:34:20 AM
RE: Server Hdd Sl.no Posted by Pete Sass @ 1/4/2012 12:51:12 AM
RE: Server Hdd Sl.no Posted by Jun Tangunan @ 1/4/2012 3:06:12 AM
RE: Server Hdd Sl.no Posted by Sajan Jacob @ 1/4/2012 2:05:06 PM
RE: Server Hdd Sl.no Posted by Mike Gagnon @ 1/4/2012 2:51:44 PM
RE: Server Hdd Sl.no Posted by Sajan Jacob @ 1/4/2012 3:31:19 PM
RE: Server Hdd Sl.no Posted by Mike Gagnon @ 1/4/2012 5:39:19 PM
RE: Server Hdd Sl.no Posted by Jun Tangunan @ 1/5/2012 1:55:24 AM
RE: Server Hdd Sl.no Posted by Mike Gagnon @ 1/4/2012 2:53:21 PM