Advertisement
compu_85

Untitled

Jun 24th, 2014
552
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #set the COM port number here
  2. $portno = 4
  3. $command_string="Test`n"
  4. $result1 = "NoRun"
  5. $result2 = "NoRun"
  6. $invalid = "Invalid system password"
  7. $count = 1
  8.  
  9. Write-Host $command_string
  10.  
  11. $port= new-Object System.IO.Ports.SerialPort COM$portno,9600,None,8,one
  12.  
  13. do {
  14. $port.open()
  15. $port.WriteLine("$command_string")
  16. $result1 = $port.ReadLine()
  17. $result2 = $port.ReadLine()
  18. $port.Close()
  19.  
  20. Write-Host $count
  21. Write-Host $result1
  22. Write-Host $result2
  23.  
  24. $count++
  25. Start-Sleep -Milliseconds 10
  26. }
  27. while ($result2 -eq $invalid)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement