Home All Groups Group Topic Archive Search About

Need to pull HARD DRIVE serial number in DOS!!!!!

Author
19 Feb 2007 5:40 PM
Marcelo
Hi,
    Who would of thunk but yes DOS is still needed!

I have a need to pull Hard drive info and Bios Info from a dos prompt.  This
PC(s) will not have a OS.  So I need the EXE to running in native Dos mode.

CAn any one help!! please.........

Request: Pull PC Serial number from Bios
              Pull HD Serial number and Vendor

Save it to a Text file.

Thank you in advance.
Regards,
Marcelo

Author
19 Feb 2007 11:33 PM
Lynn McGuire
> I have a need to pull Hard drive info and Bios Info from a dos prompt.  This
> PC(s) will not have a OS.  So I need the EXE to running in native Dos mode.

For hard drive info, see DUGIDE.  You can download it
from  http://www.winsim.com/diskid32/diskid32.html .

Lynn
Author
21 Feb 2007 3:59 PM
Marcelo
Lynn,
   Thank you, I was able to d/l the exe and source and wrote a VBS file
around it.

Thank you again every one.
Marcelo

Code Snip---- code is not clean yet


' DOD_TEST.vbs
'SCRIPT TO POLL INFORMATION FROM THE PC / HD BEFORE THE DRIVE GETS D.O.D
'
' Created by Marcelo 2-20-2007 Version 3.10
' ' -------------------------------------------------------'
'==========================================================
'Revision(s)
'
'1.00 - Get WMI Info
'    Unable to pull HD SN from WMI
'2.00 - Added C++ Exe that is able to poll HD and Pull SN and Model
'       
'3.00 - Display info to screen and write the info to a File
'
'3.10 - Fix Time issue on XXXX PCs
'        Removed WMI Date call and using NOW command

'==========================================================
Dim oShell, sfile, sFile2, strComputer

sfile = "%comspec% /C GetHDSN.exe"
sfile2 ="MADInfo.Log"
strComputer = "."

'Get Hard Drive Info
Set oShell = WScript.CreateObject ("WSCript.shell")
oShell.run sfile & " > " & sfile2, 1, False
Set oShell = Nothing


'Wait for the above program to write to the disk!
WScript.Sleep(3000)
'-----------------------------------------------------------
'Read the Log file into array to PARSE
Const ForReading = 1

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(sFile2, ForReading)

Do Until objTextFile.AtEndOfStream
    strNextLine = objTextFile.Readline
    strNew = Left(strNextLine, 35)
    If strNew = "Hard Drive Serial Number__________:" Then
        iStrLen = Len(strNextLine)
        strHDSerial = Right(strNextLine,Len(strNextLine)-35)
    End If

    If strNew = "Hard Drive Model Number___________:" Then
        iStrLen = Len(strNextLine)
        strHDModel = Right(strNextLine,Len(strNextLine)-35)
    End If 

Loop

'-----------------------------------------------------------------

'Get Todays Date!
    strDate =  Now()

'Get Model of the PC
Set objWMIService = GetObject("winmgmts:"  &
"{impersonationLevel=impersonate}!\\"  & strComputer & "\root\cimv2")
Set colCompSys = objWMIService.ExecQuery ("Select * from
Win32_Computersystem")

For Each objCompSys in colCompSys
    strPCModel = objCompSys.Model
Next

'Get Serial number of the PC
Set objWMIService = GetObject("winmgmts:"  &
"{impersonationLevel=impersonate}!\\"  & strComputer & "\root\cimv2")
Set colSMBIOS = objWMIService.ExecQuery ("Select * from
Win32_SystemEnclosure")

i=0
For Each objSMBIOS in colSMBIOS
    If i = 0 then
        strManfact = objsmBIOS.Manufacturer
        strSerialNum = objSMBIOS.SerialNumber
        i = 1
    End if
Next

'Get Installed Processor

Set wshNetwork = WScript.CreateObject( "WScript.Network" )
    strCompName = Trim(wshNetwork.ComputerName)

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
For Each objItem In colItems
    strProcessor = Trim(objItem.Name)
Next

'Output Screen
'--------------------------------------------------------------
    WScript.Echo "Date                   :" & Trim(strDate)
    WScript.Echo "Processor Speed        :" & strProcessor
    WScript.Echo "Computer Name          :" & strCompName
    WScript.Echo "Computer Manufacture   :" & strManfact
    WScript.Echo "Computer Model         :" & strPCModel
    WScript.Echo "Computer Serial Number :" & strSerialNum
    WScript.Echo "Hard Drive Model       :" & Trim(strHDModel)
    WScript.Echo "Hard Drive Serial #   :" & Trim(strHDSerial)

'Output to a File
'---------------------------------------------------------------------

Const ForAppending = 8
Dim filesys, filetxt, getname, path
Set filesys = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(strSerialNum & ".txt", ForAppending,
True)
path = filesys.GetAbsolutePathName(strSerialNum & ".txt")
getname = filesys.GetFileName(path)
    objTextFile.WriteLine(
"--------------------M-A-D--BUNY--------------------------------")
    objTextFile.WriteLine( "Date                   :" & Trim(strDate))
    objTextFile.WriteLine( "Processor Speed        :" & strProcessor )
    objTextFile.WriteLine( "Computer Name          :" & strCompName  )
    objTextFile.WriteLine( "Computer Manufacture   :" & strManfact)
    objTextFile.WriteLine( "Computer Model         :" & strPCModel)
    objTextFile.WriteLine( "Computer Serial Number :" & strSerialNum)
    objTextFile.WriteLine( "Hard Drive Model       :" & Trim(strHDModel))
    objTextFile.WriteLine( "Hard Drive Serial #    :" & Trim(strHDSerial))
    objTextFile.WriteLine(
"--------------------M-A-D--2007-------------------------------")
objTextFile.Close

If filesys.FileExists(path) Then
WScript.Echo ("Your file, " & getname & " ,has been created.")
End If


Show quoteHide quote
"Lynn McGuire" wrote:

> > I have a need to pull Hard drive info and Bios Info from a dos prompt.  This
> > PC(s) will not have a OS.  So I need the EXE to running in native Dos mode.
>
> For hard drive info, see DUGIDE.  You can download it
> from  http://www.winsim.com/diskid32/diskid32.html .
>
> Lynn
>
>
>
>
>
Author
21 Feb 2007 7:02 PM
Karl E. Peterson
Marcelo <Marc***@discussions.microsoft.com> wrote:
> "Lynn McGuire" wrote:
>>> I have a need to pull Hard drive info and Bios Info from a dos prompt.  This
>>> PC(s) will not have a OS.  So I need the EXE to running in native Dos mode.
>>
>> For hard drive info, see DUGIDE.  You can download it
>> from  http://www.winsim.com/diskid32/diskid32.html .
>
> Lynn,
>   Thank you, I was able to d/l the exe and source and wrote a VBS file
> around it.

Hmmm, clearly, the PC *does* have an OS...
--
..NET: It's About Trust!
http://vfred.mvps.org
Author
22 Feb 2007 9:57 PM
Marcelo
Karl,
   My primary objective was to get a program that could pull the HD info
along with Compute Serial number.  I was not able to due this with my back
ground and with the C++ code and VBS WMI calls I was able to push the
prieject forward but not the way I would have like to have seen it.....

Now I have a issue with NT 4 since it does not use the same WMI lib.

So if you have a solution I would greatly appricate it or even if you can
give me some NT info on getting Bios info..

but none the less....

thanks everyone.


Show quoteHide quote
"Karl E. Peterson" wrote:

> Marcelo <Marc***@discussions.microsoft.com> wrote:
> > "Lynn McGuire" wrote:
> >>> I have a need to pull Hard drive info and Bios Info from a dos prompt.  This
> >>> PC(s) will not have a OS.  So I need the EXE to running in native Dos mode.
> >>
> >> For hard drive info, see DUGIDE.  You can download it
> >> from  http://www.winsim.com/diskid32/diskid32.html .
> >
> > Lynn,
> >   Thank you, I was able to d/l the exe and source and wrote a VBS file
> > around it.
>
> Hmmm, clearly, the PC *does* have an OS...
> --
> ..NET: It's About Trust!
http://vfred.mvps.org
>
>
>
Author
22 Feb 2007 10:21 PM
Karl E. Peterson
Marcelo <Marc***@discussions.microsoft.com> wrote:
> Karl,
>   My primary objective was to get a program that could pull the HD info
> along with Compute Serial number.  I was not able to due this with my back
> ground and with the C++ code and VBS WMI calls I was able to push the
> prieject forward but not the way I would have like to have seen it.....
>
> Now I have a issue with NT 4 since it does not use the same WMI lib.
>
> So if you have a solution I would greatly appricate it or even if you can
> give me some NT info on getting Bios info..

No, I don't have anything just ready to hand you.  It'd take some research.  But
you're seeming to have some difficulty describing the actual problem to us.  First,
it's a machine with no OS, then it's Windows, then NT4, then...?

There were lots of DOS methods for getting at this, through interrupts.  Have you
looked at those?  That *is* what was first suggested here.  Or, are you *really*
intending to run this on a Windows (NT or otherwise) box?  Yeah, it makes a
difference.
--
..NET: It's About Trust!
http://vfred.mvps.org
Author
22 Feb 2007 10:41 PM
Marcelo
Karl,
    Correct the progresion of this has changed from booting to DOS and pull
the info to doing it from windows as I read the posts and I was not able to
get any where with them....

Unfortunately I have limited time (this project is over due) and I could not
grasp how to do it in DOS…. So I defaulted to taking the C++ file and doing
the rest with WMI calls.

My plan was to do it all in DOS and not be dependent on a Windows platform.

This is perfect example for doing it in DOS but how do I do this???  What
did I miss that was so simple????
http://www.faqs.org/faqs/msdos-programmer-faq/part3/section-14.html

Then how could I put that towards the BIOS to pull Model/ SN / Manufacture
and processor????

If you can lead me in a path I can understand….  (Perhaps the language of a
2 year old... LOL) then I can do it….. 



Thanks,
M


Show quoteHide quote
"Karl E. Peterson" wrote:

> Marcelo <Marc***@discussions.microsoft.com> wrote:
> > Karl,
> >   My primary objective was to get a program that could pull the HD info
> > along with Compute Serial number.  I was not able to due this with my back
> > ground and with the C++ code and VBS WMI calls I was able to push the
> > prieject forward but not the way I would have like to have seen it.....
> >
> > Now I have a issue with NT 4 since it does not use the same WMI lib.
> >
> > So if you have a solution I would greatly appricate it or even if you can
> > give me some NT info on getting Bios info..
>
> No, I don't have anything just ready to hand you.  It'd take some research.  But
> you're seeming to have some difficulty describing the actual problem to us.  First,
> it's a machine with no OS, then it's Windows, then NT4, then...?
>
> There were lots of DOS methods for getting at this, through interrupts.  Have you
> looked at those?  That *is* what was first suggested here.  Or, are you *really*
> intending to run this on a Windows (NT or otherwise) box?  Yeah, it makes a
> difference.
> --
> ..NET: It's About Trust!
http://vfred.mvps.org
>
>
>
Author
22 Feb 2007 10:51 PM
Ken Halter
"Marcelo" <Marc***@discussions.microsoft.com> wrote in message
news:4A3B5BCB-4EE4-487D-A420-5E241B8DA638@microsoft.com...
> Karl,
>
> This is perfect example for doing it in DOS but how do I do this???  What
> did I miss that was so simple????
> http://www.faqs.org/faqs/msdos-programmer-faq/part3/section-14.html
>

Well.. here's some code to get to the hard drive... if you already have the
WMI code to do everything else, you're set.

Retrive Low-Level Hard Drive Information
http://www.freevbcode.com/ShowCode.Asp?ID=3380

ADSI/WMI stuff
http://www.mvps.org/st-software/ADSI_WMI.htm

This code shows a way to compare all kinds of things on 2 networked
computers. You can probably modify it to just grab the info from one.

Comparing Computer Information With VB and WMI
http://www.mvps.org/st-software/Ask_NT_Pro.htm

--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm
Author
23 Feb 2007 2:37 AM
Jim Carlock
Hello Marcelo,

Are you running into some problems with the newsgroups?

Maybe you can try the newsgroup by clicking on the following...

news://news.microsoft.com/microsoft.public.vb.general.discussion

It should launch Outlook Express (unless you're using one of
those new Microsoft operating systems that uses Microsoft Mail).

Not sure what your situation is, but perhaps downloading the
threads into Outlook Express (or whatever your default news-
reading software is) will help.

--
Jim Carlock
Post replies to the group.
Author
23 Feb 2007 8:36 AM
J French
On Thu, 22 Feb 2007 14:41:31 -0800, =?Utf-8?B?TWFyY2Vsbw==?=
<Marc***@discussions.microsoft.com> wrote:

>Karl,
>    Correct the progresion of this has changed from booting to DOS and pull
>the info to doing it from windows as I read the posts and I was not able to
>get any where with them....
>
>Unfortunately I have limited time (this project is over due) and I could not
>grasp how to do it in DOS…. So I defaulted to taking the C++ file and doing
>the rest with WMI calls.

>My plan was to do it all in DOS and not be dependent on a Windows platform.

Are you writing some sort of computer pre-installation audit system ?

This is looking similar to something I was slightly involved in years
ago where hundreds of computers were being configured on a production
line.
Author
24 Feb 2007 3:41 AM
Marcelo
J,
  This is for production but the program will be used for a audit trail.

Show quoteHide quote
"J French" wrote:

> On Thu, 22 Feb 2007 14:41:31 -0800, =?Utf-8?B?TWFyY2Vsbw==?=
> <Marc***@discussions.microsoft.com> wrote:
>
> >Karl,
> >    Correct the progresion of this has changed from booting to DOS and pull
> >the info to doing it from windows as I read the posts and I was not able to
> >get any where with them....
> >
> >Unfortunately I have limited time (this project is over due) and I could not
> >grasp how to do it in DOS…. So I defaulted to taking the C++ file and doing
> >the rest with WMI calls.
>
> >My plan was to do it all in DOS and not be dependent on a Windows platform.
>
> Are you writing some sort of computer pre-installation audit system ?
>
> This is looking similar to something I was slightly involved in years
> ago where hundreds of computers were being configured on a production
> line.
>
>
>
Author
23 Feb 2007 12:53 PM
David Kerber
In article <4A3B5BCB-4EE4-487D-A420-5E241B8DA***@microsoft.com>,
Marc***@discussions.microsoft.com says...
Show quoteHide quote
> Karl,
>     Correct the progresion of this has changed from booting to DOS and pull
> the info to doing it from windows as I read the posts and I was not able to
> get any where with them....
>
> Unfortunately I have limited time (this project is over due) and I could not
> grasp how to do it in DOS?. So I defaulted to taking the C++ file and doing
> the rest with WMI calls.
>
> My plan was to do it all in DOS and not be dependent on a Windows platform.
>
> This is perfect example for doing it in DOS but how do I do this???  What
> did I miss that was so simple????
> http://www.faqs.org/faqs/msdos-programmer-faq/part3/section-14.html

First question is: Do you really have DOS on these machines?  Or is it a
windows command prompt?  They are not at all the same when it comes to
low-level stuff like this.  If it's really DOS, then there should be a
DOS folder somewhere, and DOS' various startup files in the root.

.....

--
Remove the ns_ from if replying by e-mail (but keep posts in the
newsgroups if possible).
Author
24 Feb 2007 3:40 AM
Marcelo
Dave,
   I can load dos 6.22 or I can load a 9x/xp command prompt which ever gets
me the info...  Above I showed a wmi script I got working but tha needs
windows.  The PCs I am going to touch may not have that so I need to build a
solution that is self contained.  ie.  boot to dos and pull mainboard SN and
HD sn and so on.

Thanks
M

Show quoteHide quote
"David Kerber" wrote:

> In article <4A3B5BCB-4EE4-487D-A420-5E241B8DA***@microsoft.com>,
> Marc***@discussions.microsoft.com says...
> > Karl,
> >     Correct the progresion of this has changed from booting to DOS and pull
> > the info to doing it from windows as I read the posts and I was not able to
> > get any where with them....
> >
> > Unfortunately I have limited time (this project is over due) and I could not
> > grasp how to do it in DOS?. So I defaulted to taking the C++ file and doing
> > the rest with WMI calls.
> >
> > My plan was to do it all in DOS and not be dependent on a Windows platform.
> >
> > This is perfect example for doing it in DOS but how do I do this???  What
> > did I miss that was so simple????
> > http://www.faqs.org/faqs/msdos-programmer-faq/part3/section-14.html
>
> First question is: Do you really have DOS on these machines?  Or is it a
> windows command prompt?  They are not at all the same when it comes to
> low-level stuff like this.  If it's really DOS, then there should be a
> DOS folder somewhere, and DOS' various startup files in the root.
>
> .....
>
> --
> Remove the ns_ from if replying by e-mail (but keep posts in the
> newsgroups if possible).
>
Author
24 Feb 2007 7:55 AM
J French
On Fri, 23 Feb 2007 19:40:05 -0800, =?Utf-8?B?TWFyY2Vsbw==?=
<Marc***@discussions.microsoft.com> wrote:

>Dave,
>   I can load dos 6.22 or I can load a 9x/xp command prompt which ever gets
>me the info...  Above I showed a wmi script I got working but tha needs
>windows.  The PCs I am going to touch may not have that so I need to build a
>solution that is self contained.  ie.  boot to dos and pull mainboard SN and
>HD sn and so on.

Ok, now I know what you are up to.

Some years ago my brother worked for a company that bulk configured
machines, which involved getting their details and then putting drive
images on them.

I know that he found some MSDOS software that reported a heck of a lot
of hardware information.

While I don't have a copy, and don't know where he got it, knowing
that it exists could be useful to you.
Author
27 Feb 2007 4:00 PM
Phil
The DOS command 'VOL' at the command line will retrieve the disk volume
label and serial number:

C:\>vol
Volume in drive C has no label.
Volume Serial Number is 1430-BAB4

C:\>

Any responses can be easily output to a text file using '>'.

C:\>vol > output.txt

C:\>

Hope it helps.





*** Sent via Developersdex http://www.developersdex.com ***
Author
27 Feb 2007 4:10 PM
Ken Halter
"Phil" <anonym***@devdex.com> wrote in message
news:ezjrXhoWHHA.4180@TK2MSFTNGP06.phx.gbl...
> The DOS command 'VOL' at the command line will retrieve the disk volume
> label and serial number:
>
> C:\>vol
> Volume in drive C has no label.
> Volume Serial Number is 1430-BAB4
>

That's the "Volume Serial Number", which can easily change. You can get the
hardware/firmware serial number here....

Retrive Low-Level Hard Drive Information
http://www.freevbcode.com/ShowCode.Asp?ID=3380


--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm