1. mahmoud mahmoud
  2. PowerBuilder
  3. Saturday, 14 January 2023 18:04 PM UTC

i need to get

-  pc serial number

- hard disk serial

 

by pb 12.6

Accepted Answer
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Sunday, 15 January 2023 15:06 PM UTC
  2. PowerBuilder
  3. # Permalink

Here's a small application that gets the Serial Number of a Hard disk.

See attached.

[EDIT]: I'm using Roland Smith's n_filesys object, with some modifications done by me.

 

I think I've found some information on how to get the Serial of a PC, but that's going to take me some time.

regards

 

Attachments (1)
Comment
  1. Brad Mettee
  2. Tuesday, 17 January 2023 16:17 PM UTC
Besides having more than one network adapter, if you don't have networking on the motherboard, a network card might be replaced at some point, so the MAC address could still change unexpectedly.
  1. Helpful
  1. Miguel Leeuwe
  2. Tuesday, 17 January 2023 16:19 PM UTC
You're absolutely right. Besides of all of our speculations, the OP still hasn't answered what his purpose of getting the information is.

regards.
  1. Helpful
  1. Miguel Leeuwe
  2. Tuesday, 17 January 2023 16:21 PM UTC
I remember when it was really painful to upgrade any hardware and windows would tell you that your license wasn't fit for that PC anymore. They were checking an amount of changes and if more than a few, you'd get that message.

:)

  1. Helpful
There are no comments made yet.
mahmoud mahmoud Accepted Answer Pending Moderation
  1. Tuesday, 17 January 2023 22:18 PM UTC
  2. PowerBuilder
  3. # 1

 thanks for you MR Miguel Leeuwe & John Fauss  

 

It's a great gift 

Thanks again for helping me 

with best regards

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 17 January 2023 20:05 PM UTC
  2. PowerBuilder
  3. # 2

Hi Miguel & John;

   Thank you so much for going "beyond" on this post to get Mahmoud an answer on his outdated PB 12.6 challenge!

    Also, for trying to educate the community on proper etiquette! ;-)

This ones for you guys ...

Regards ... Chris

 

Comment
  1. Miguel Leeuwe
  2. Tuesday, 17 January 2023 20:51 PM UTC
LOL!
  1. Helpful
  1. John Fauss
  2. Tuesday, 17 January 2023 23:49 PM UTC
I appreciate it, Chris! Now...THAT'S funny!
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Monday, 16 January 2023 20:48 PM UTC
  2. PowerBuilder
  3. # 3

Hi,

See attached: John's "simple" app in a PB 12.6 version.

Attachments (1)
Comment
  1. John Fauss
  2. Monday, 16 January 2023 21:01 PM UTC
I very much appreciate you doing this, Miguel! Thank you.
  1. Helpful 2
  1. Miguel Leeuwe
  2. Monday, 16 January 2023 21:04 PM UTC
Likewise John, your stuff is great!
  1. Helpful 1
There are no comments made yet.
mahmoud mahmoud Accepted Answer Pending Moderation
  1. Monday, 16 January 2023 07:31 AM UTC
  2. PowerBuilder
  3. # 4

thanks for you MR  Miguel Leeuwe  & John Fauss  

this tool and helpful give me much of my question

 

thanks for spending time to help me

with best regards

 

 

 

 

Comment
  1. Miguel Leeuwe
  2. Monday, 16 January 2023 08:09 AM UTC
You're welcome Mahmoud. This might be useful to anyone else too!
  1. Helpful 1
  1. John Fauss
  2. Monday, 16 January 2023 12:09 PM UTC
You're welcome!
  1. Helpful 1
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Monday, 16 January 2023 03:52 AM UTC
  2. PowerBuilder
  3. # 5

Attached are two zip files. One contains a PB 2017 app with a simplified window and WMI non-visual object that you can more easily adapt to your own application(s). The other zip file contains the exported source files for every object.

The app is named WMI Easy Query. Here is a screenshot:

There are several sample queries listed in the drop-down, or you can experiment and enter your own query. You'll note in the above screen shot that even though the query asked only for the SerialNumber property, WMI also supplied the Tag property. WMI does this for some WMI classes... I do not know why.

In WMI terminology, "BaseBoard" refers to the PC's motherboard, not the BIOS.

I've included four DataWindow data objects from the CodeXchange example program, even though they are not utilized in this app. One that might be of interest to you is dddw_wmi_class, which lists all of the WMI classes supported when the CodeXchange app was created. This may save you time and effort when researching other WMI classes.

Enjoy!

Attachments (2)
Comment
  1. Miguel Leeuwe
  2. Monday, 16 January 2023 13:23 PM UTC
This is great John, I'm going to convert it to 12.6 this evening and check the differences between the BIOS and the BaseBoard ! My guess is that you're probably right.

:)
  1. Helpful
  1. Miguel Leeuwe
  2. Monday, 16 January 2023 20:47 PM UTC
Please see my latest answer, where I've attached your "simple" app in a PB 12.6 version.
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Sunday, 15 January 2023 19:25 PM UTC
  2. PowerBuilder
  3. # 6

Hi again,

I've created another sample app, ripping out a lot of code from John. So now you have one sample app for the HardDisk serial number (posted before) and this attached one, to get the PC's serial number.

See attached.

It does not work for a lot of custom build PCs, since the BIOS information is not always set.

regards.

Attachments (1)
Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Sunday, 15 January 2023 18:30 PM UTC
  2. PowerBuilder
  3. # 7

here's a pb 12.6 version of Jonh's CodeXchange project: https://community.appeon.com/index.php/codeexchange/powerbuilder/281-wmi-windows-management-instrumentation-class-properties-inspector#338 

See attached

Funny: on my work computer I get "To be filled by O.E.M." The reason for this is that manufacturers of custom build PC's might not set this value in the BIOS.

Maybe a better way to uniquely identify your PC, is to use the MAC address. But of course, network cards can be changed. (as well as hardware drives) !!!

Mahmoud, what do you really need this information for?

regards.

 

Attachments (1)
Comment
  1. John Fauss
  2. Sunday, 15 January 2023 21:48 PM UTC
Thank you VERY MUCH for providing a PB 12.6 version of the WMI sample application, Miguel. That's extremely nice of you to do that, so I hope Mahmoud appreciates it (hint, hint).

Instead of the BIOS Serial Number, I suggest you look at the Win32_BaseBoard class for the motherboard's serial number. For physical disk serial numbers, examine the Win32_PhysicalMedia class.

See my other response made a few minutes ago. I'll post a simpler app. It will not be the general-purpose class/property inspector that the CodeXchange app it, so it will be easier to integrate into an existing app. The CodeXchange app is a nice way to find out what classes and properties are available, however.
  1. Helpful 2
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Sunday, 15 January 2023 17:34 PM UTC
  2. PowerBuilder
  3. # 8

@John, I just found your code on CodeXchange: Awesome !

Any idea which Class Category that is?

I'll rip it and try to create a 12.6 version of it.

regards,

MiguelL

 

Comment
  1. Miguel Leeuwe
  2. Sunday, 15 January 2023 18:18 PM UTC
Okay, found the answer: it's in category "Motherboard, Controller and Port".
  1. Helpful 1
  1. John Fauss
  2. Sunday, 15 January 2023 21:55 PM UTC
Yes, the dddw_wmi_class DataWindow Data Object contains all of the data used in the right-hand-side drop-down, the classes along with their class category. I'm glad you were able to find it!
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Sunday, 15 January 2023 16:18 PM UTC
  2. PowerBuilder
  3. # 9

Hi,

You're welcome.

You've accepted the answer, but you still don't know how to get the Serial of the PC itself.

You can run a powershell and run this command:

Get-WmiObject win32_bios | select Serialnumber

 

Or you can run a vbs script with this contents:

On Error Resume Next
Dim strComputer
strComputer = InputBox("Enter the name of the computer:")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSMBIOS = objWMIService.ExecQuery ("Select * from Win32_SystemEnclosure")
For Each objSMBIOS in colSMBIOS
	MsgBox strComputer & ": " & objSMBIOS.SerialNumber
Next

Once I've figured out how to run a powershell command from Powerbuilder I'll post it here. (I know I have that somewhere ...).

regards

Comment
  1. mahmoud mahmoud
  2. Sunday, 15 January 2023 17:28 PM UTC
i used code in power shell and get serial right but i'm waiting code to get it from powerbuilder
  1. Helpful
  1. Miguel Leeuwe
  2. Sunday, 15 January 2023 19:31 PM UTC
See another answer in where I use John's project to get the BIOS serial number (which does not work for every PC).
  1. Helpful
There are no comments made yet.
mahmoud mahmoud Accepted Answer Pending Moderation
  1. Sunday, 15 January 2023 15:47 PM UTC
  2. PowerBuilder
  3. # 10

thanks for your helpful  MR Miguel Leeuwe

 

Comment
There are no comments made yet.
mahmoud mahmoud Accepted Answer Pending Moderation
  1. Sunday, 15 January 2023 05:25 AM UTC
  2. PowerBuilder
  3. # 11

Mr Miguel and Mr john

I'm very sorry I didn't mean that your words

And you are right 

I'm very sorry for all people 

And I thank you for your advice ? ? ? 

Comment
  1. Miguel Leeuwe
  2. Sunday, 15 January 2023 14:47 PM UTC
Thank you Mahmoud, I like you better now!



I've made a small app that gets the Serial no. I'll upload it soon for you. (have to convert it to pb 12.6).

regards
  1. Helpful 1
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Sunday, 15 January 2023 00:36 AM UTC
  2. PowerBuilder
  3. # 12

Just a tip:

I don't want to make this personal, but learn how to say "Hi", "Please" and now an then a "Thank you" when people help you.

I understand that there's language barriers and that everyone has a different education. In a lot of your posts, you can also be a bit more descriptive. Many times we keep guessing.

In my humble opinion, it's annoying and sorry to be frank with you, but you might get better / more help if you take this in account. (at least if you appreciate any help from me).

Best regards,

MiguelL

Comment
  1. John Fauss
  2. Sunday, 15 January 2023 01:37 AM UTC
I agree completely, Miguel. A little courtesy goes a long way, no matter where in the world you reside. Thank you for posting this.
  1. Helpful 2
  1. Miguel Leeuwe
  2. Sunday, 15 January 2023 02:34 AM UTC
Thanks for the support John,

I'm not saying that it is Mahmoud's intention, but personally, it gives me the feeling that people think we work for them and getting paid for it.
  1. Helpful 1
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.