Hi borelli,
Also, i Have attach my code below to you
Dim dTaskID As Double
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Private Sub Form_Load()
'Open the Database
If con.State = 1 Then con.Close
con.Open "PROVIDER=SQLOLEDB;DATA SOURCE=webserver;UID=sa;PWD=sa;DATABASE=Intranet"
DateConfirm = Date 'Get the Date Value
'DateConfirm = DateConfirm - 1 'Set the dat value to onday before
'Select Record set from the table System History (tbladminhis)
If rs.State = 1 Then rs.Close
rs.Open "select * from tbladminhis", con, 3, 3
'Select all IP address or system name to find the Down time and uptime of each system
While Not rs.EOF
'Get the IP address and Sys Name for evry time
SystemIP = Trim(rs("ip"))
SystemName = Trim(rs("sname"))
'MsgBox "command.com /c c:\ansari\uptime.exe " & CompName & " /s /d:" & DateConfirm & " > c:\ansari\" & SystemName & ".txt"
'The below line is to run the uptime.exe to generate the system information as a text file
dTaskID = Shell("command.com /c c:\ansari\uptime.exe " & SystemIP & " /s /d:" & DateConfirm & " > c:\ansari\" & SystemName & ".txt", vbHide)
rs.MoveNext
Wend
If rs.State = 1 Then rs.Close
If con.State = 1 Then con.Close
Set con = Nothing
Set rs = Nothing
End Sub