legend Posted October 5, 2012 Share Posted October 5, 2012 HI is there a way I can get the serial from cmd to a variable? if you go to cmd and type: vol you get the serial number for (c:\) C:\Users\mac>vol Volume in drive C has no label. Volume Serial Number is E497-2EDC I want to make a hwid authentication system, however I am not sure that this number is changed, if you reinstall. meoit 1 Link to comment Share on other sites More sharing options...
water Posted October 5, 2012 Share Posted October 5, 2012 I suggest to use function DriveGetSerial. That's much easier. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Danyfirex Posted October 5, 2012 Share Posted October 5, 2012 (edited) something like this: #include <Constants.au3> Vol() Func Vol() $output_read = Run(@ComSpec & " /c vol", @SystemDir, @SW_HIDE, $STDOUT_CHILD) $output = "" While 1 $line = StdoutRead($output_read) If @error Then ExitLoop If StringLen($line) > 2 Then $output &= $line EndIf WEnd Local $aREResult = StringSplit($output,":") msgbox(0,"Volume Serial Number is:",$aREResult[2]) EndFunc regards Edited October 5, 2012 by Danyfirex Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
kylomas Posted October 5, 2012 Share Posted October 5, 2012 legend,You may also be interested in this thread which discusses various HD signatures, what they affect and how they are generated.kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
W4RD14L3R Posted October 5, 2012 Share Posted October 5, 2012 Got to agree with Water on this one.. DriveGetSerial seems much simpler $Serial = DriveGetSerial( 'C:' ) Link to comment Share on other sites More sharing options...
Kerros Posted October 5, 2012 Share Posted October 5, 2012 (edited) There is a problem with DriveGetSerial, always has been that this function will return the Windows serial number, not a drive hardware serial number. from the Help doc. Remarks The value returned is not the hardware serial number as found on the label of the drive, it is the Windows Volume ID for the drive. The way to get the hardware serial number from Windows Vista on is through the WMI. (This does not work with windows XP) $objWMIService = ObjGet("winmgmts:LocalHostrootCIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems Serial = $objItem.SerialNumber&@CRLF next EndIf ConsoleWrite('Serial: '&$Serial&@CRLF) Edited October 5, 2012 by Kerros Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance. Link to comment Share on other sites More sharing options...
W4RD14L3R Posted October 5, 2012 Share Posted October 5, 2012 You could always do it the long yet effective way of "Vol" works in the cmd for you then try outputting the display text for cmd.exe C:Usersmac> vol > C:vol.txt This would output the drive id and serial number to C:vol.txt afterwards use the following code. #Include <File.au3> Local $File = 'C:Vol.txt' For $n = 1 To _FileCountLines( $File ) Step + 1 $Line = FileReadLine( $File, $n ) If StringinStr( $Line, 'Volume Serial Number is' ) Then $Line = StringReplace( $Line, 'Volume Serial Number is', '' ) $Line = StringReplace( $Line, ' ', '' ) $DriveID = $Line EndIf Next The code checks the lines in the file for Volume Serial.... Removes it and all blank whitespaces and leaves the code in the variable $DriveID meoit 1 Link to comment Share on other sites More sharing options...
water Posted October 5, 2012 Share Posted October 5, 2012 (edited) Kerros, that's correct but the OP uses the VOL command. And VOL returns the volume serial number like DriveGetSerial does. So DriveGetSerial seems to solve his problem. To get the hardware serial number please search the forum. There was a discussion about this subject today. Edited October 5, 2012 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
W4RD14L3R Posted October 5, 2012 Share Posted October 5, 2012 You can also try the Unique Disk ID # To get this you still need to go through cmd calls. C:UsersGh0st> diskpart diskpart> List Disk Disk 0 Online diskpart> Select Disk 0 Disk 0 selected diskpart> UniqueID Disk Disk ID: xxxxxxx Link to comment Share on other sites More sharing options...
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