Read Serial Number of a USB or Harddrive

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
olllllliii
Pro Scripter
Posts: 60
Joined: Tue Dec 22, 2009 9:51 am
Location: Mannheim ( Germany )
Contact:

Read Serial Number of a USB or Harddrive

Post by olllllliii » Mon Dec 28, 2009 12:26 pm

Do someone know how i can get the Serial number of a specific Drive ?
I need that to make my EXE files Copy Save ... so that only if the Stick
is in the computer with the right Serial Number ...the programm starts

THX for Help :-)
Oliver Hilger Mannheim
alias Olllllliii

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Re: Read Serial Number of a USB or Harddrive

Post by Rain » Mon Dec 28, 2009 7:46 pm

olllllliii wrote:Do someone know how i can get the Serial number of a specific Drive ?
I need that to make my EXE files Copy Save ... so that only if the Stick
is in the computer with the right Serial Number ...the programm starts

THX for Help :-)
I was looking for the same thing a year or so ago. This is the best I could come up with. I don't think there is a way to get the real serial number with Macro Scheduler.

Code: Select all

let>RP_DISPLAYERROR=1
Let>RP_WAIT=1
Let>RP_WINDOWMODE=0
Run Program>cmd /c DIR *.ap > %TEMP_DIR%~HDSerial.txt
ReadFile>%TEMP_DIR%~HDSerial.txt,result
ReadLn>%TEMP_DIR%~HDSerial.txt,2,result
StringReplace>result, Volume Serial Number is ,,result
StringReplace>result,-,,result
DeleteFile>%TEMP_DIR%~HDSerial.txt
mdl>C Drive Serial #: %result%
Tested on Windows XP Pro.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue Dec 29, 2009 2:21 am

Instead of the serial number, I just use a small text file on the root of the drive, and check to see if it exists. Each dirve can have a different name. I do this for nightly backups to hard drives. Each of the five hard drives has a file named Monday.txt ....Friday.txt. First part of the macro checks to see if Weekday.txt exists, if not, macro skips planned routine.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts