Frm_Escaneo_POS.visible=true ' aqui muestro una ventanita que indica que el programa esta escaneando las cajas
'Dim MAC As String
Do While dr.Read
'TIPO(contador) = dr.GetString(2)
'MODELO(contador) = dr.GetString(3)
'SERIE(contador) = dr.GetString(4)
IP_Caja = dr.GetString(1)
IP_POS(contador) = IP_Caja
POS = dr.GetString(0)
lbl_caja.text=POS ' Esta es la parte en donde le asigno el número de la caja para que la muestre en el frm_Escaneo_POS
'Dim results() As String = Scanner.ResolveMac(Int(dr.GetString(1)))
Estado = ping.Send(IP_Caja, 1000).Status.ToString
Estados_P(contador) = Estado
' MAC = ping.(dr.GetString(1),200)
If Estado = "Success" Then
Imagen = 0
Else
Imagen = 1
End If
ListView1.Items.Add(New ListViewItem(New String() {dr.GetString(0) & " ", dr.GetString(1), Estado, dr.GetString(2), dr.GetString(3), dr.GetString(4), dr.GetString(5), dr.GetString(6), dr.GetString(7)}, Imagen))
contador = contador + 1
Loop
dr.Close()
For z = 0 To contador - 1
If Estados_P(z) = "Success" Then
Shell("cmd /c c:\cscript\psexec.exe \\" & IP_POS(z) & " -u administrador -p unimarc -c " & Chr(34) & "c:\cscript\comm.bat" & Chr(34) & "> c:\cscript\log.log", AppWinStyle.Hide, True, 11000)
Dim objReader As New StreamReader("c:\cscript\log.log")
Dim sLine As String = ""
Dim arrText As New ArrayList()
Do
sLine = objReader.ReadLine()
If Not sLine Is Nothing Then
arrText.Add(sLine)
End If
Loop Until sLine Is Nothing
objReader.Close()
For Each sLine In arrText
If Mid(sLine, 1, 6) = "Model:" Then
Tipo_POS(z) = Mid(sLine, 7, 5)
Mod_POS(z) = Mid(sLine, 12, 3)
End If
If Mid(sLine, 1, 15) = "Serial Number2:" Then
Serie_POS(z) = Mid(sLine, 16, 9)
End If
Next
End If
Next
For Each item As ListViewItem In ListView1.Items
item.UseItemStyleForSubItems = False
If Estados_P(contador2) = "Success" Then
If item.SubItems(3).Text = Replace(Tipo_POS(contador2), " ", "") Then
item.SubItems(3).ForeColor = Color.Blue
Else
item.SubItems(3).ForeColor = Color.Red
End If
If item.SubItems(4).Text = Mod_POS(contador2) Then
item.SubItems(4).ForeColor = Color.Blue
Else
item.SubItems(4).ForeColor = Color.Red
End If
If item.SubItems(5).Text = Replace(Serie_POS(contador2), " ", "") Then
item.SubItems(5).ForeColor = Color.Blue
Else
item.SubItems(5).ForeColor = Color.Red
End If
Else
item.SubItems(3).ForeColor = Color.Gray
item.SubItems(4).ForeColor = Color.Gray
item.SubItems(5).ForeColor = Color.Gray
End If
contador2 = contador2 + 1
Next
Frm_Escaneo_POS.Close()