If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Rate Thread | Display Modes |
#46
|
|||
|
|||
SSDs serial No in BIOS.
"GS" wrote
| i suppose by browsing the HTMLs, one could streamline the content of a CHM to | exclude some of the extraneous info they might not be interested to have in | their WMI.chm. IOW, build their own custom wmi-quick-n-dirty manual that also | includes personal script/code examples/samples. | There are 2,855 HTML files for WMI. Which ones would you expect you don't want? I don't get the logic. It sounds to me like trying to achieve a more portable dictionary. Will you leave out Ac to An because you don't think you'll need those words? It's also not a small job to create a help file. All of the code samples you might add would need to be formatted into HTML and you'd need to write the index/contents in the Help Workshop. To what purpose? I don't have any trouble finding relevant code samples in my own collection. But I *do* have trouble remembering the kinds of things that help files are especially good for: function parameters, constants, flags, object methods, etc. For instance, it took me only a moment to look up ExecQuery to see what you were doing with 48 in the 3rd parameter. I still don't know why that's useful, but at least I know what it means. |
Ads |
#47
|
|||
|
|||
SSDs serial No in BIOS.
"GS" wrote
| Thanks, I did copied this into Notebook, saved it as | "DiskDriveInfo.vbs" but it did not list my 8 HDDs (some Bitlockered), | but rather gave a series of texts. | | You need to runWMI scripts 'As Administrator' to get all its info returned. | I don't think that's the problem. He seems to have copied your first sample and run it successfully. Your first sample does, indeed, offer only "a series of texts", showing a separate msgbox for each bit of data and only dealing with one partition, which could be confusing. It sounds like he was expecting to click something and see a message saying, "Your serial number is such-and-such." Meanwhile he didn't bother to read the other posts in the thread, or didn't understand them. If he had then he'd have the serial numbers now. I suspect this whole approach is more than Peter Jason is prepared to dive into. And it was never clear that he actually *needed* the serial numbers. All he wants is to clone a hard disk, which he apparently already did. |
#48
|
|||
|
|||
SSDs serial No in BIOS.
I can't get it started. How do I get it into the CMD screen? Can it
be started with a RH mouse click? Either double-click the vbs file OR right-click and choose Open. I've posted updated scripts since this thread. Here's the final versions: 'GetDriveSerialNumberFromPath.vbs Dim oWMI, Path, vData, vInfo, sInfo, i, iNdx, bSelectedPath Set oWMI = GetObject("WinMgmts:") Path = UCase(InputBox("Enter the Drive Letter")) Set vData = oWMI.ExecQuery("Select * from Win32_LogicalDisk _ Where DriveType = 3") i = 0: Path = Left(Path, 1) & ":" For Each vInfo In vData 'Assign an index only if the USB DeviceID matches Path. If vInfo.DeviceID = Path Then iNdx = i: bSelectedPath = True: Exit For i = i + 1 Next If bSelectedPath Then 'Iterate the WMI.Win32_DiskDrive class to verify Path is a valid USB device, 'and determine an index for identifying our target USB device. Set vData = oWMI.ExecQuery("Select * from Win32_DiskDrive") i = 0 For Each vInfo In vData If UCase(vInfo.InterfaceType) = "IDE" Then If i = iNdx Then sInfo = Path & " SerialNumber: " _ & vInfo.SerialNumber: Exit For i = i + 1 End If Next End If MsgBox sInfo, vbInformation 'GetLogicalDiskInfo.vbs Dim sInfo Set objWMIService = GetObject("winmgmts:") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_LogicalDisk",,48) For Each objItem in colItems sInfo = sInfo & "Caption: " & objItem.Caption & vblf _ & "Description: " & objItem.Description & vblf _ & "VolumeSerialNumber: " & objItem.VolumeSerialNumber & vblf & vblf Next MsgBox sInfo, vbInformation 'GetDriveInfo.vbs Set objWMIService = GetObject("winmgmts:") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive",,48) For Each objItem in colItems sInfo = sInfo & "Caption: " & objItem.Caption & vblf _ & "Description: " & objItem.Description & vblf _ & "SerialNumber: " & objItem.SerialNumber & vblf _ & "Size: " & objItem.Size & vblf _ & "---------------------------------------" & vblf Next MsgBox sInfo, vbInformation -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
#49
|
|||
|
|||
SSDs serial No in BIOS.
"GS" wrote
i suppose by browsing the HTMLs, one could streamline the content of a CHM to exclude some of the extraneous info they might not be interested to have in their WMI.chm. IOW, build their own custom wmi-quick-n-dirty manual that also includes personal script/code examples/samples. There are 2,855 HTML files for WMI. Which ones would you expect you don't want? Ah, that explains why my wmi.chm is 6294kb! I don't get the logic. It sounds to me like trying to achieve a more portable dictionary. Will you leave out Ac to An because you don't think you'll need those words? Well, the logic is to trim out the useless-to-me stuff! There's way more information in there on using WMI for stuff I'll never use it for, so why carry it around? It's also not a small job to create a help file. All of the code samples you might add would need to be formatted into HTML and you'd need to write the index/contents in the Help Workshop. To what purpose? I don't have any trouble finding relevant code samples in my own collection. For me this is a much simpler task than you'd think; -I'd just import the wmi.chm into RoboHelp and do whatever with it! Adding code samples is a copy/paste into the editor deal. But I *do* have trouble remembering the kinds of things that help files are especially good for: function parameters, constants, flags, object methods, etc. For instance, it took me only a moment to look up ExecQuery to see what you were doing with 48 in the 3rd parameter. I still don't know why that's useful, but at least I know what it means. That code was not my original authoring and so the usual extraneous sample stuff got trimmed out after posting; -I missed trimming those lines. Thanks for pointing that out! -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
#50
|
|||
|
|||
SSDs serial No in BIOS.
For instance, it took me only a moment to look
up ExecQuery to see what you were doing with 48 in the 3rd parameter. I still don't know why that's useful, but at least I know what it means. The DiskDriveInfo and LogicalDiskInfo examples were generated in 'WMI Code Creator' to reply to this thread. I normally trim out all the unnecessary 'junk' code when adapting for my own use. My final versions missed that line using the 3rd param, otherwise it wouldn't be there. My sample lib has been revised accordingly, but I don't see any point to repost here. -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
#51
|
|||
|
|||
SSDs serial No in BIOS.
On Mon, 19 Mar 2018 09:10:58 -0400, "Mayayana"
wrote: "GS" wrote | Thanks, I did copied this into Notebook, saved it as | "DiskDriveInfo.vbs" but it did not list my 8 HDDs (some Bitlockered), | but rather gave a series of texts. | | You need to runWMI scripts 'As Administrator' to get all its info returned. | I don't think that's the problem. He seems to have copied your first sample and run it successfully. Your first sample does, indeed, offer only "a series of texts", showing a separate msgbox for each bit of data and only dealing with one partition, which could be confusing. It sounds like he was expecting to click something and see a message saying, "Your serial number is such-and-such." No, I wanted just some way to tell them apart. Computers are very stressful. Meanwhile he didn't bother to read the other posts in the thread, or didn't understand them. If he had then he'd have the serial numbers now. Sometimes I don't understand them. I suspect this whole approach is more than Peter Jason is prepared to dive into. And it was never clear that he actually *needed* the serial numbers. All he wants is to clone a hard disk, which he apparently already did. |
#52
|
|||
|
|||
SSDs serial No in BIOS.
On Mon, 19 Mar 2018 15:03:52 -0400, GS wrote:
I can't get it started. How do I get it into the CMD screen? Can it be started with a RH mouse click? Either double-click the vbs file OR right-click and choose Open. I've posted updated scripts since this thread. Here's the final versions: 'GetDriveSerialNumberFromPath.vbs Dim oWMI, Path, vData, vInfo, sInfo, i, iNdx, bSelectedPath Set oWMI = GetObject("WinMgmts:") Path = UCase(InputBox("Enter the Drive Letter")) Set vData = oWMI.ExecQuery("Select * from Win32_LogicalDisk _ Where DriveType = 3") i = 0: Path = Left(Path, 1) & ":" For Each vInfo In vData 'Assign an index only if the USB DeviceID matches Path. If vInfo.DeviceID = Path Then iNdx = i: bSelectedPath = True: Exit For i = i + 1 Next If bSelectedPath Then 'Iterate the WMI.Win32_DiskDrive class to verify Path is a valid USB device, 'and determine an index for identifying our target USB device. Set vData = oWMI.ExecQuery("Select * from Win32_DiskDrive") i = 0 For Each vInfo In vData If UCase(vInfo.InterfaceType) = "IDE" Then If i = iNdx Then sInfo = Path & " SerialNumber: " _ & vInfo.SerialNumber: Exit For i = i + 1 End If Next End If MsgBox sInfo, vbInformation 'GetLogicalDiskInfo.vbs Dim sInfo Set objWMIService = GetObject("winmgmts:") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_LogicalDisk",,48) For Each objItem in colItems sInfo = sInfo & "Caption: " & objItem.Caption & vblf _ & "Description: " & objItem.Description & vblf _ & "VolumeSerialNumber: " & objItem.VolumeSerialNumber & vblf & vblf Next MsgBox sInfo, vbInformation 'GetDriveInfo.vbs Set objWMIService = GetObject("winmgmts:") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive",,48) For Each objItem in colItems sInfo = sInfo & "Caption: " & objItem.Caption & vblf _ & "Description: " & objItem.Description & vblf _ & "SerialNumber: " & objItem.SerialNumber & vblf _ & "Size: " & objItem.Size & vblf _ & "---------------------------------------" & vblf Next MsgBox sInfo, vbInformation Thanks, on my machine it gave an error message... https://postimg.org/image/lt45rd6g5/ |
#53
|
|||
|
|||
SSDs serial No in BIOS.
"GS" wrote
| It's also not a small job to create a help file. | All of the code samples you might add would | need to be formatted into HTML and you'd | need to write the index/contents in the Help | Workshop. To what purpose? I don't have | any trouble finding relevant code samples | in my own collection. | | For me this is a much simpler task than you'd think; -I'd just import the | wmi.chm into RoboHelp and do whatever with it! Adding code samples is a | copy/paste into the editor deal. Wow. $400?! I know Adobe prices are outrageous, but that's crazy. MS Help Workshop is free. I'm guessing the difference is that RoboHelp gives you some kind of WYSIWYG HTML editor so that you don't actually have to write the HTML pages. |
#54
|
|||
|
|||
SSDs serial No in BIOS.
Peter Jason wrote:
On Mon, 19 Mar 2018 15:03:52 -0400, GS wrote: I can't get it started. How do I get it into the CMD screen? Can it be started with a RH mouse click? Either double-click the vbs file OR right-click and choose Open. I've posted updated scripts since this thread. Here's the final versions: 'GetDriveSerialNumberFromPath.vbs Dim oWMI, Path, vData, vInfo, sInfo, i, iNdx, bSelectedPath Set oWMI = GetObject("WinMgmts:") Path = UCase(InputBox("Enter the Drive Letter")) Set vData = oWMI.ExecQuery("Select * from Win32_LogicalDisk _ Where DriveType = 3") i = 0: Path = Left(Path, 1) & ":" For Each vInfo In vData 'Assign an index only if the USB DeviceID matches Path. If vInfo.DeviceID = Path Then iNdx = i: bSelectedPath = True: Exit For i = i + 1 Next If bSelectedPath Then 'Iterate the WMI.Win32_DiskDrive class to verify Path is a valid USB device, 'and determine an index for identifying our target USB device. Set vData = oWMI.ExecQuery("Select * from Win32_DiskDrive") i = 0 For Each vInfo In vData If UCase(vInfo.InterfaceType) = "IDE" Then If i = iNdx Then sInfo = Path & " SerialNumber: " _ & vInfo.SerialNumber: Exit For i = i + 1 End If Next End If MsgBox sInfo, vbInformation 'GetLogicalDiskInfo.vbs Dim sInfo Set objWMIService = GetObject("winmgmts:") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_LogicalDisk",,48) For Each objItem in colItems sInfo = sInfo & "Caption: " & objItem.Caption & vblf _ & "Description: " & objItem.Description & vblf _ & "VolumeSerialNumber: " & objItem.VolumeSerialNumber & vblf & vblf Next MsgBox sInfo, vbInformation 'GetDriveInfo.vbs Set objWMIService = GetObject("winmgmts:") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive",,48) For Each objItem in colItems sInfo = sInfo & "Caption: " & objItem.Caption & vblf _ & "Description: " & objItem.Description & vblf _ & "SerialNumber: " & objItem.SerialNumber & vblf _ & "Size: " & objItem.Size & vblf _ & "---------------------------------------" & vblf Next MsgBox sInfo, vbInformation Thanks, on my machine it gave an error message... https://postimg.org/image/lt45rd6g5/ Change the fifth line so it isn't extended with the underscore ? Set vData = oWMI.ExecQuery("Select * from Win32_LogicalDisk Where DriveType = 3") That got me a result on Win10. Paul |
#55
|
|||
|
|||
SSDs serial No in BIOS.
"Peter Jason" wrote
| | Thanks, on my machine it gave an error message... | https://postimg.org/image/lt45rd6g5/ Try combining the lines, so that it reads: ("Select * from Win32_LogicalDisk Where DriveType = 3") Garry made the mistake of breaking a string across lines. |
#56
|
|||
|
|||
SSDs serial No in BIOS.
"Peter Jason" wrote
| Meanwhile he didn't bother to read the | other posts in the thread, or didn't understand | them. If he had then he'd have the serial | numbers now. | | Sometimes I don't understand them. That's what I figured. You kind of jumped in at the deep end, with several people offering several different possible solutions. It was hard to follow the discussion even being familiar with the code. I assume you're not going to leave both drives hooked up, so why not just put tape, paint, or marker on them to tell them apart? |
#57
|
|||
|
|||
SSDs serial No in BIOS.
Sorry about that! Paul and Mayayana caught it right while I was away. Thanks to
both! -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
#58
|
|||
|
|||
SSDs serial No in BIOS.
"GS" wrote
It's also not a small job to create a help file. All of the code samples you might add would need to be formatted into HTML and you'd need to write the index/contents in the Help Workshop. To what purpose? I don't have any trouble finding relevant code samples in my own collection. For me this is a much simpler task than you'd think; -I'd just import the wmi.chm into RoboHelp and do whatever with it! Adding code samples is a copy/paste into the editor deal. Wow. $400?! I know Adobe prices are outrageous, but that's crazy. MS Help Workshop is free. I'm guessing the difference is that RoboHelp gives you some kind of WYSIWYG HTML editor so that you don't actually have to write the HTML pages. What's $400? When I bought RH it was $900+! (I was publishing ebooks for my daughter; -she wanted them to be multi-platform from single source.) -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
#59
|
|||
|
|||
SSDs serial No in BIOS.
"GS" wrote
| Wow. $400?! I know Adobe prices are outrageous, | but that's crazy. MS Help Workshop is free. I'm | guessing the difference is that RoboHelp gives you | some kind of WYSIWYG HTML editor so that you | don't actually have to write the HTML pages. | | What's $400? When I bought RH it was $900+! (I was publishing ebooks for my | daughter; -she wanted them to be multi-platform from single source.) | Ah. It gets crazier by the minute. It may be $1,100 now. I couldn't quite figure it out from their webpage. They had 2 sets of prices and it wasn't clear what each was for. Maybe $400 is the update. |
#60
|
|||
|
|||
SSDs serial No in BIOS.
"GS" wrote
Wow. $400?! I know Adobe prices are outrageous, but that's crazy. MS Help Workshop is free. I'm guessing the difference is that RoboHelp gives you some kind of WYSIWYG HTML editor so that you don't actually have to write the HTML pages. What's $400? When I bought RH it was $900+! (I was publishing ebooks for my daughter; -she wanted them to be multi-platform from single source.) Ah. It gets crazier by the minute. It may be $1,100 now. I couldn't quite figure it out from their webpage. They had 2 sets of prices and it wasn't clear what each was for. Maybe $400 is the update. Yeah, that might be $499 today for upgrade, but I'm not interested. I'm done doing my daughter's ebook stuff and so only use it for my stuff now. (What the heck.., it's there and paid for!) Everything Adobe is way overpriced, IMO, but their products are very top shelf nevertheless. (I tried Acrobat for assembling her ebooks and creating bookmarks. Nuance's Power PDF Pro is a better deal for $100s less!) That app went to my daughter... -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
Thread Tools | |
Display Modes | Rate This Thread |
|
|