Tag:add exce start rgs is int output click lse
Sub nbtstat (ByVal IP as String)
Dim Strrst, StrRst1, StrRst2, strRst3 as String
Dim N1, N2, N3 as Integer
Try
Dim p as New process () ' can be used with process
p.StartInfo.FileName = "cmd.exe"
P.startinfo.useshellexecute = False
P.startinfo.redirectstandardinput = True
P.startinfo.redirectstandardoutput = True
P.startinfo.redirectstandarderror = True
P.startinfo.createnowindow = True
P.start ()
Application.doevents ()
P.standardinput.writeline ("cmd/c c:\\windows\\sysnative\\nbtstat.exe-a" & IP) ' This is the cmd command, 64-bit computer
P.standardinput.writeline ("Exit") ' This is the exit statement
Strrst = P.standardoutput.readtoend () ' Executes the statement and gets the display content.
P.close ()
Catch ex as Exception
End Try
' And then your own code ...
If InStrRev (Strrst, "host not Found") > 0 Then
StrRst1 = "Host not Found"
End If
If not strRst1 = "host not Found" then
N1 = InStrRev (Strrst, "0> unique")-22
StrRst1 = Mid (Strrst, N1, 20)
StrRst1 = Strrst1.replace ("", "") ' Host Name '
N2 = InStrRev (Strrst, "0> Group")-22
StrRst2 = Mid (Strrst, N2, 20)
StrRst2 = Strrst2.replace ("", "") ' WorkGroup Name
N3 = InStrRev (Strrst, "MAC") + 8
StrRst3 = Mid (Strrst, N3, 20)
StrRst3 = Strrst3.replace ("", "") ' MAC Address '
End If
End Sub
Private Sub button1_click (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles Button1.Click
Nbtstat ("10.0.2.1")
End Sub
VB.net using IP Enquiry (Host name) (WorkGroup name) (MAC Address)-cmd and nbtstat command