jmtrevaskis

Thinkiosk wireless launch script

Nov 11th, 2013
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. 'thinkiosk launch on network script
  2. 'james trevaskis for st doms
  3. '11/11/2013
  4.  
  5.  
  6. wscript.echo "Please wait while a network connection is established..."
  7. wscript.echo ""
  8.  
  9. 'vars
  10. Set objShell = WScript.CreateObject("WScript.Shell")
  11. i=0
  12.  
  13.  
  14. 're-import OPEN profile
  15. objShell.exec("Netsh wlan add profile filename=c:\windows\stdoms\wireless-open.xml user=all")
  16.  
  17.  
  18. '6 seconds each loop
  19. for i=1 to 10
  20.  
  21. 'recheck port
  22. processStream
  23.  
  24. Next
  25.  
  26.  
  27. 'launching thinkiosk even though no network found
  28. objShell.exec("c:\program files\thinkiosk\thinkiosk.exe")
  29. 'objShell.Popup "No network found, you need to establish a network connection then hit the home button"
  30.  
  31.  
  32. Sub processStream
  33.  
  34. Set objExecObject = objShell.Exec("c:\windows\stdoms\PortQry.exe -n www.google.com -e 443")
  35.  
  36. 'capture stdout
  37. Do
  38. line = objExecObject.StdOut.ReadLine()
  39. s = s & line '& vbcrlf
  40. Loop While Not objExecObject.Stdout.atEndOfStream
  41.  
  42. objString = s
  43.  
  44. 'check for failed to resolve (no network)
  45. compare0 = instr(objString, "Failed to resolve")
  46. if (compare0 > 0) then
  47. wscript.echo "Waiting for network connection..."
  48. if (i = 4) then
  49. objShell.Exec("explorer.exe shell:::{1fa9085f-25a2-489b-85d4-86326eedcd87}")
  50. end if
  51. wscript.sleep 6000
  52. end if
  53.  
  54. 'check for listening string
  55. compare1 = instr(objString, "LISTENING")
  56. if (compare1 > 0) then
  57. 'wscript.echo objString
  58.  
  59. 'check for not listening
  60. compare2 = instr(objString, "NOT LISTENING")
  61. if (compare2 > 0) then
  62. wscript.echo "Failed to connect to Citrix..."
  63. wscript.sleep 6000
  64. else
  65. wscript.echo "Connecting to Citrix..."
  66. strConnected = "1"
  67. startThinkiosk
  68. end if
  69.  
  70. end if
  71. End Sub
  72.  
  73. sub startThinkiosk
  74. 'launch thinkiosk
  75. objShell.exec("c:\program files\thinkiosk\thinkiosk.exe")
  76.  
  77. 'exit script
  78. wscript.quit
  79. End Sub
Add Comment
Please, Sign In to add comment