taz5176 Posted April 22, 2008 Posted April 22, 2008 hi all $var = DriveGetSerial( "c:\" ) MsgBox(4096, "Serial Number: ", $var) My hdd serial is 4MQ08LX3 the above script return 2004997699 Is DriveGetSerial returning the correct value?
d4rk Posted April 22, 2008 Posted April 22, 2008 (edited) My hdd serial is 4MQ08LX3 go to command prompt at C:\ and type "vol" Edited April 22, 2008 by d4rk [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys
GEOSoft Posted April 22, 2008 Posted April 22, 2008 (edited) hi all$var = DriveGetSerial( "c:\" )MsgBox(4096, "Serial Number: ", $var)My hdd serial is 4MQ08LX3the above script return 2004997699Is DriveGetSerial returning the correct value?as d4rk points out, it returns the serial number of a volume, not the serial of a physical drive.Edit: I thought that maybe using WMI Win32_DiskDrive would get it but that doesn't do it either. It will return the model but not the serial. Edited April 22, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
Kerros Posted April 22, 2008 Posted April 22, 2008 Under Vista WMI will return the HDD SN#. Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.
Kerros Posted April 22, 2008 Posted April 22, 2008 (edited) Dup post... bah Edited April 22, 2008 by Kerros Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.
GEOSoft Posted April 22, 2008 Posted April 22, 2008 Under Vista WMI will return the HDD SN#.Must be the difference in the WMI version. I just updated my WMI a couple of weeks ago and It still doesnt return it. That's on XP George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
weaponx Posted April 22, 2008 Posted April 22, 2008 (edited) This should show the serial numbers for all drives: expandcollapse popup; Generated by AutoIt Scriptomatic $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMedia", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output = $Output & "Capacity: " & $objItem.Capacity & @CRLF $Output = $Output & "Caption: " & $objItem.Caption & @CRLF $Output = $Output & "CleanerMedia: " & $objItem.CleanerMedia & @CRLF $Output = $Output & "CreationClassName: " & $objItem.CreationClassName & @CRLF $Output = $Output & "Description: " & $objItem.Description & @CRLF $Output = $Output & "HotSwappable: " & $objItem.HotSwappable & @CRLF $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF $Output = $Output & "Manufacturer: " & $objItem.Manufacturer & @CRLF $Output = $Output & "MediaDescription: " & $objItem.MediaDescription & @CRLF $Output = $Output & "MediaType: " & $objItem.MediaType & @CRLF $Output = $Output & "Model: " & $objItem.Model & @CRLF $Output = $Output & "Name: " & $objItem.Name & @CRLF $Output = $Output & "OtherIdentifyingInfo: " & $objItem.OtherIdentifyingInfo & @CRLF $Output = $Output & "PartNumber: " & $objItem.PartNumber & @CRLF $Output = $Output & "PoweredOn: " & $objItem.PoweredOn & @CRLF $Output = $Output & "Removable: " & $objItem.Removable & @CRLF $Output = $Output & "Replaceable: " & $objItem.Replaceable & @CRLF $Output = $Output & "SerialNumber: " & $objItem.SerialNumber & @CRLF $Output = $Output & "SKU: " & $objItem.SKU & @CRLF $Output = $Output & "Status: " & $objItem.Status & @CRLF $Output = $Output & "Tag: " & $objItem.Tag & @CRLF $Output = $Output & "Version: " & $objItem.Version & @CRLF $Output = $Output & "WriteProtectOn: " & $objItem.WriteProtectOn & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_PhysicalMedia" ) Endif Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc EDIT: Wrong WMI location Edited April 22, 2008 by weaponx
Kerros Posted April 22, 2008 Posted April 22, 2008 @weaponxThat script will not return the actual Disk Drive SN#. That may return the Volume information, but to get to the physical drive we would need to use Win32_DiskDrive.This is what was created by scriptomatic under Vista and XP on the same machine.Vista.expandcollapse popup; Generated by AutoIt Scriptomatic $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output = $Output & "Availability: " & $objItem.Availability & @CRLF $Output = $Output & "BytesPerSector: " & $objItem.BytesPerSector & @CRLF $strCapabilities = $objItem.Capabilities(0) $Output = $Output & "Capabilities: " & $strCapabilities & @CRLF $strCapabilityDescriptions = $objItem.CapabilityDescriptions(0) $Output = $Output & "CapabilityDescriptions: " & $strCapabilityDescriptions & @CRLF $Output = $Output & "Caption: " & $objItem.Caption & @CRLF $Output = $Output & "CompressionMethod: " & $objItem.CompressionMethod & @CRLF $Output = $Output & "ConfigManagerErrorCode: " & $objItem.ConfigManagerErrorCode & @CRLF $Output = $Output & "ConfigManagerUserConfig: " & $objItem.ConfigManagerUserConfig & @CRLF $Output = $Output & "CreationClassName: " & $objItem.CreationClassName & @CRLF $Output = $Output & "DefaultBlockSize: " & $objItem.DefaultBlockSize & @CRLF $Output = $Output & "Description: " & $objItem.Description & @CRLF $Output = $Output & "DeviceID: " & $objItem.DeviceID & @CRLF $Output = $Output & "ErrorCleared: " & $objItem.ErrorCleared & @CRLF $Output = $Output & "ErrorDescription: " & $objItem.ErrorDescription & @CRLF $Output = $Output & "ErrorMethodology: " & $objItem.ErrorMethodology & @CRLF $Output = $Output & "FirmwareRevision: " & $objItem.FirmwareRevision & @CRLF $Output = $Output & "Index: " & $objItem.Index & @CRLF $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF $Output = $Output & "InterfaceType: " & $objItem.InterfaceType & @CRLF $Output = $Output & "LastErrorCode: " & $objItem.LastErrorCode & @CRLF $Output = $Output & "Manufacturer: " & $objItem.Manufacturer & @CRLF $Output = $Output & "MaxBlockSize: " & $objItem.MaxBlockSize & @CRLF $Output = $Output & "MaxMediaSize: " & $objItem.MaxMediaSize & @CRLF $Output = $Output & "MediaLoaded: " & $objItem.MediaLoaded & @CRLF $Output = $Output & "MediaType: " & $objItem.MediaType & @CRLF $Output = $Output & "MinBlockSize: " & $objItem.MinBlockSize & @CRLF $Output = $Output & "Model: " & $objItem.Model & @CRLF $Output = $Output & "Name: " & $objItem.Name & @CRLF $Output = $Output & "NeedsCleaning: " & $objItem.NeedsCleaning & @CRLF $Output = $Output & "NumberOfMediaSupported: " & $objItem.NumberOfMediaSupported & @CRLF $Output = $Output & "Partitions: " & $objItem.Partitions & @CRLF $Output = $Output & "PNPDeviceID: " & $objItem.PNPDeviceID & @CRLF $strPowerManagementCapabilities = $objItem.PowerManagementCapabilities(0) $Output = $Output & "PowerManagementCapabilities: " & $strPowerManagementCapabilities & @CRLF $Output = $Output & "PowerManagementSupported: " & $objItem.PowerManagementSupported & @CRLF $Output = $Output & "SCSIBus: " & $objItem.SCSIBus & @CRLF $Output = $Output & "SCSILogicalUnit: " & $objItem.SCSILogicalUnit & @CRLF $Output = $Output & "SCSIPort: " & $objItem.SCSIPort & @CRLF $Output = $Output & "SCSITargetId: " & $objItem.SCSITargetId & @CRLF $Output = $Output & "SectorsPerTrack: " & $objItem.SectorsPerTrack & @CRLF $Output = $Output & "SerialNumber: " & $objItem.SerialNumber & @CRLF $Output = $Output & "Signature: " & $objItem.Signature & @CRLF $Output = $Output & "Size: " & $objItem.Size & @CRLF $Output = $Output & "Status: " & $objItem.Status & @CRLF $Output = $Output & "StatusInfo: " & $objItem.StatusInfo & @CRLF $Output = $Output & "SystemCreationClassName: " & $objItem.SystemCreationClassName & @CRLF $Output = $Output & "SystemName: " & $objItem.SystemName & @CRLF $Output = $Output & "TotalCylinders: " & $objItem.TotalCylinders & @CRLF $Output = $Output & "TotalHeads: " & $objItem.TotalHeads & @CRLF $Output = $Output & "TotalSectors: " & $objItem.TotalSectors & @CRLF $Output = $Output & "TotalTracks: " & $objItem.TotalTracks & @CRLF $Output = $Output & "TracksPerCylinder: " & $objItem.TracksPerCylinder & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_DiskDrive" ) Endif Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFuncI am also attaching screenshots of the output information for those that can not try it themselves.VistaXP Service Pack 2 Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.
weaponx Posted April 22, 2008 Posted April 22, 2008 (edited) The code I posted shows the same serial number as reported by Everest Ultimate Edition (WD-WMANS2159481). Edited April 22, 2008 by weaponx
spudw2k Posted April 22, 2008 Posted April 22, 2008 The code I posted shows the same serial number as reported by Everest Ultimate Edition (WD-WMANS2159481).Win32_LogicalDisk only gives the Volume Serial. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
Kerros Posted April 22, 2008 Posted April 22, 2008 Which value is returning the SN#? When I run Win32_LogicalDisk from Scriptomatic "VolumeSerialNumber: " is blank except when viewing my network drives, which would not return a drive SN# as they are part of a RAID array. Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.
weaponx Posted April 22, 2008 Posted April 22, 2008 I posted the wrong script. It was supposed to be from Win32_PhysicalMedia.
spudw2k Posted April 22, 2008 Posted April 22, 2008 Weird, I can't get any results from Win32_PhysicalMedia except Tag. Also, DriveGetSerial() returns a number that is not my Vol Serial, and not physically printed on my HD. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
Kerros Posted April 22, 2008 Posted April 22, 2008 I only get tag from Win32_PhysicalMedia as well. DriveGetSerial() is returning VolumeSerialNumber I believe. Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.
GEOSoft Posted April 22, 2008 Posted April 22, 2008 I posted the wrong script. It was supposed to be from Win32_PhysicalMedia.Right you are. Physical Media returns it for me. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now