SQLCommand Insert Netstat results
Page 1 of 14 Replies - 339 Views - Last Post: 08 February 2012 - 04:13 PM
Topic Sponsor:
#1
SQLCommand Insert Netstat results
Posted 08 February 2012 - 09:04 AM
I have a VB.net script that runs a simulation on several machines within the domain. During this simulation, a login is initiated to an application via a web portal. After the login, the connection to a specific Citrix server(whichever is least busy) is established. At this point, I want to run a Netstat -r | find (IP Range of server farm) in command line. From what I have deduced, I probably won't be able to do what I want from the command line and everything will have to be with in the VB.net module using System.Net.NetworkInformation. I am a Citrix Administrator with a decent level of .net experience but I am having trouble with this. Any advice would be greatly appreciated.
Replies To: SQLCommand Insert Netstat results
#2
Re: SQLCommand Insert Netstat results
Posted 08 February 2012 - 02:49 PM
How do I write this code to a text file?
Dim properties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties()
Dim connections As TcpConnectionInformation() = properties.GetActiveTcpConnections()
Dim t As TcpConnectionInformation
For Each t In connections
Console.Write("Local endpoint: {0} ", t.LocalEndPoint.Address)
Console.Write("Remote endpoint: {0} ", t.RemoteEndPoint.Address)
Console.WriteLine("{0}", t.State)
Next t
#3
Re: SQLCommand Insert Netstat results
Posted 08 February 2012 - 03:02 PM
Instead of Console.Write you could use the System.IO.StreamWriter to write your data to a file.
I would build a Formatted String and just pass that into the writer.
I would build a Formatted String and just pass that into the writer.
#4
Re: SQLCommand Insert Netstat results
Posted 08 February 2012 - 04:09 PM
CharlieMay, on 08 February 2012 - 03:02 PM, said:
Instead of Console.Write you could use the System.IO.StreamWriter to write your data to a file.
I would build a Formatted String and just pass that into the writer.
I would build a Formatted String and just pass that into the writer.
Ok. Once I accomplish that, how do I insert the data in the text file into a SQL table?
#5
Re: SQLCommand Insert Netstat results
Posted 08 February 2012 - 04:13 PM
Well, you would need to decide on a database type, and then I suggest reading the tutorial from the tutorials section here on D.I.C. Oledb for access, SQL for MS Sql. This will give you a good start.
But... The information is there, it's just a matter of sending it to where you want to store it. Once you establish that, a quick INSERT into your database is only 5 or six lines of code.
But... The information is there, it's just a matter of sending it to where you want to store it. Once you establish that, a quick INSERT into your database is only 5 or six lines of code.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|