By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,534 Members | 950 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,534 IT Pros & Developers. It's quick & easy.

NetServerGetInfo

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Imports System

Class Sample
Public Shared Sub Main()
Console.WriteLine()
Console.WriteLine("OSVersion: {0}", Environment.OSVersion.ToString())
End Sub 'Main
End Class 'Sample
Nov 21 '05 #2

P: n/a
Thank you for help, but this code reply with information about the local
system.

I look for OS version of Remote machine

"Richard Myers" <ri*********************@basd.co.nz> wrote in message
news:ew***************@tk2msftngp13.phx.gbl...
Imports System

Class Sample
Public Shared Sub Main()
Console.WriteLine()
Console.WriteLine("OSVersion: {0}", Environment.OSVersion.ToString()) End Sub 'Main
End Class 'Sample

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.