Quantcast
Channel: Visual Basic Tips and Tricks
Viewing all articles
Browse latest Browse all 2212

Product Key HDD e Motherboard

$
0
0

Buongiorno, 

spero di non aprire discussioni già aperte, ma ho avuto qualche difficoltà fin'ora...

 

Avrei necessità di trovare il codice seriale della scheda madre e dell'Hard disk.

Ho già fatto delle ricerche ed ho anche ottenuto dei risultati, che però non so se siano giusti.

 

Il mio dubbio deriva dal fatto che non sono sicuro di aver trovato i dati corretti proprio perchè non so come testare se sono corretti.

Mi spiego meglio...

Con queste due funzioni in teoria ho trovato i codici.

 


'MOTHERBOARD
    Private Function SystemSerialNumber() As String
        ' Get the Windows Management Instrumentation object.
        Dim wmi As Object = GetObject("WinMgmts:")

        ' Get the "base boards" (mother boards).
        Dim serial_numbers As String = ""
        Dim mother_boards As Object = _
            wmi.InstancesOf("Win32_BaseBoard")
        For Each board As Object In mother_boards
            serial_numbers &= ", "& board.SerialNumber
        Next board
        If serial_numbers.Length > 0 Then serial_numbers = _
            serial_numbers.Substring(2)

        Return serial_numbers
    End Function

    'HDD
    Public Function GetDriveSerialNumber() As String
        Dim DriveSerial As Integer
        'Create a FileSystemObject object
        Dim fso As Object = CreateObject("Scripting.FileSystemObject")
        Dim Drv As Object = fso.GetDrive(fso.GetDriveName(Application.StartupPath))
        With Drv
            If .IsReady Then
                DriveSerial = .SerialNumber
            Else    '"Drive Not Ready!"
                DriveSerial = -1
            End If
        End With
        Return DriveSerial.ToString("X2")
    End Function

Però non so come confermarli perchè ho provato a cercare gli stessi codici dal prompt, però in internet trovo varie versioni.

Per l'hard disk ho trovato questi due comandi:

1.   "dir/p/w" ( o anche "vol c:") che da come risultato una stringa di 9 cifre (compresa la barretta) 48B9-FE95

2.   "wmic diskdrive get serialnumber" che mi da come risultato W -DMW2C6E733127

Ora, quale dei due è quello corretto?

Perchè se vado a vedere nell'HDD, nell'etichetta c'è scritto S/N: WMC2E6371372

Con la funzione che ho messo prima, ottengo la stringa che ho mostrato nel primo caso.

 

Per la scheda madre ho trovato due comandi che danno lo stesso risultato:

wmic baseboard get product,Manufacturer,version,serialnumber ed ottengo 131118104106869, però se vado a guardare nell'etichetta della scheda, c'è scritto DBM0AB361419.

Con la funzione postata prima, ottengo il numero letto da cmd, quindi 13111....

 

Tutto questo mi serve per creare la chiave di licenza.

Detto questo, mi sapreste dire se i numeri che ho trovato sono corretti? E quindi anche le funzioni.

E in caso fossero sbagliati, mi sapreste dire come (o linkare) trovare i numeri da windows e poi da vb?

 

Grazie mille!


Viewing all articles
Browse latest Browse all 2212