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