Click here to Skip to main content
15,908,661 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Program A is saved in Computer A. Then user execute the program A at Computer B over the network to read the HDD serial number of computer A.

Anyone can share with me how to do this in VB.NET?? :doh: :doh:
Posted

http://www.codeproject.com/KB/cs/hard_disk_serialno.aspx

the above will show you how to use Windows Management Interface to read the serial Number of computer A from computer no need for a program on computer A to do that.

Substitute the "." for the computer name.
 
Share this answer
 
Hi Tiggerc,

Thank you.

I have checked http://www.codeproject.com/KB/cs/hard_disk_serialno.aspx and found that it's written in c# :((

Unfortunately I'm only use to VB.NET. I got no idea how to convert it to VB.NET. Anyone can help me for this with the use of VB.NET??
 
Share this answer
 
Comments
Christian Graus 8-Jul-10 20:18pm    
Why would you press 'answer' to ask a question ? Do you know what the word 'answer' means ? How about 'comment' ? In any case, converting between VB.NET and C# is both trivial, and easily automated.
There are numerous free online converting services available for this.
Just google 'convert C# to VB.NET' and you'll find them. One of them is:

http://www.developerfusion.com/tools/convert/csharp-to-vb/
 
Share this answer
 
Hi,

I have tried converted the code to VB.NET yes It's working now but it isn't what I want. It still only get the workstation's hard drive serial number not server's hard drive serial number.
 
Share this answer
 
Try setting the server after you create each of your ManagementObjectSearcher objects like so...

Dim searcher As New ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive")<br />
searcher.Scope.Path.Server = "servername"<br />
<br />
<br />
searcher = New ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia")<br />
       searcher.Scope.Path.Server = "servername"<br />



The account that runs the search needs to have Admin access to the server you are trying to search.
 
Share this answer
 
v3
Thank you so much for RLH68 :)

I have tested and it looks the same when I run it over the network (application is placed at server and execute application at my computer) then I got message "Invalid Parameter". Unless I run this application locally (place the application in my computer) and put my computer name then it works fine:

searcher.Scope.Path.Server = "my computer name"

Anyway thank you so much for tying to help me so much. :laugh:
 
Share this answer
 
Comments
idenizeni 9-Jul-10 12:11pm    
I don't think you really want to do it this way, run exe across systems, I could be wrong though. Just run the exe from your workstation and enter the servers name like I showed. Then from your one PC you could check every server on your network by just changing the server name.

Edit; I edited my comment after I read your question. My first response was based on your question title and not on the actual question. My mistake.
bibijojo 10-Jul-10 4:58am    
Is okay :)
At least you tried help and shared with me.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900