Link to home
Start Free TrialLog in
Avatar of Yerk
Yerk

asked on

Get remote OS version info with VB.NET

Hi,

I try to obtain the OS version of a specified computer on the network

I have an error on line "nresult = NetServerGetInfo(srv(0), 102, hbuffer)" with the code below :

Public Declare Function NetServerGetInfo Lib "netapi32" ( _
ByVal ServerName As Byte, _
ByVal Level As Long, _
ByVal buffer As Long) As Long

Dim server As String
Dim srv() As Byte
Dim nresult As Long
Dim hbuffer As Long
Dim txtEncoder As New UTF8Encoding
server = "GLOBO"
hbuffer = 0
server = server & vbNullChar
srv = txtEncoder.GetBytes(server)
nresult = NetServerGetInfo(srv(0), 102, hbuffer)
Label1.Text = nresult


Thanks for your help!
ASKER CERTIFIED SOLUTION
Avatar of imu79
imu79

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Yerk
Yerk

ASKER

Hi Imran,

Your solution works perfectly, Thanks a lot for this great job.

Have a nice day,

Didier
happy to help :)

have a great day !

Imran.