Private Function getAllServers() As DataTable
Dim dt As New DataTable
'' dt = SmoApplication.EnumAvailableSqlServers
Dim info As ProcessStartInfo = New ProcessStartInfo("cmd", "/c sqlcmd -L")
info.RedirectStandardOutput = True
info.UseShellExecute = False
info.CreateNoWindow = True
Dim p As Process = New Process()
p.StartInfo = info
p.Start()
Dim res As String = p.StandardOutput.ReadToEnd
Dim sqlSrvList() As String = res.Trim.Split(CChar(vbNewLine))
Dim sqlSrvrs As New List(Of String)
For i As Int32 = 1 To sqlSrvList.Length - 1
sqlSrvrs.Add(sqlSrvList(i).Replace(Chr(13), "").Trim)
Next
Dim ServerName As String = ""
Dim DatabaseName As String = ""
Dim Instance As String = ""
Dim drow As DataRow
Nosirrah NaheehsPosted Dec 18, 2012, 7:18 PM
Also, lovely code! <3
Nosirrah NaheehsPosted Dec 18, 2012, 7:18 PM
ur sxc. were shod we meat?