NetServerGetInfo

  • Thread starter Thread starter Yerk
  • Start date Start date
Y

Yerk

Hi,

I try to obtain th OS version of a workstation on the network.

The code below don't work, an error occurs on the "nresult=" line :
"An unhandled exception of type 'System.NullReferenceException' occurred "

Any idea?

Thanx in advance


Public Declare Function NetServerGetInfo Lib "netapi32" ( _

ByVal ServerName As Byte, _

ByVal Level As Long, _

ByVal buffer As Long) As Long



im 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
 
Imports System

Class Sample
Public Shared Sub Main()
Console.WriteLine()
Console.WriteLine("OSVersion: {0}", Environment.OSVersion.ToString())
End Sub 'Main
End Class 'Sample
 
Thank you for help, but this code reply with information about the local
system.

I look for OS version of Remote machine
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top