Dim objICO, fso, strApp
Set objICO = WScript.CreateObject("Citrix.ICAClient")
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists("C:\Results.txt") Then
Set ofile = fso.OpenTextfile("C:\Results.txt", 8)
Else
Set ofile = fso.CreateTextFile("C:\Results.txt", true)
End If
strApp = "VCI"
Call Test("server1")
strApp = Nothing
strApp = "Mas200"
Call Test("server2")
strApp = Nothing
Sub Test(Server)
'Set Browser Protocol
objICO.BrowserProtocol = "UDP"
'Set Server locator
objICO.TCPBrowserAddress = Server
'Disable IPCLaunch
objICO.IPCLaunch = FALSE
'Set to launch, rather than embed session
objICO.Launch = TRUE
'Enable seamless
objICO.TWIMode = TRUE
objICO.ConnectionEntry = "Notepad"
objICO.WinstationDriver = "ICA 4.0"
objICO.TransportDriver = "TCP/IP"
'Set credentials
objICO.Username = "test"
objICO.SetProp "Password","citrix"
objICO.Domain = "domain"
'Specify application to launch
objICO.Application = strApp
'Connect!!
objICO.Connect()
WScript.Sleep 1000
n = 1
c = 0
d = 0
Do While n < 21
If objICO.IsConnected = "True" Then
c = 1
End If
If c = 1 Then
objICO.Disconnect
WScript.Sleep 1000
End If
If objICO.IsConnected = "False" And C = 1 Then
ofile.writeline Server & " " & "Test Succeeded" & " " & Date & " " & Time
d = 1
n = 21
End If
WScript.Sleep 1000
n = n+1
Loop
If c = 0 Then
ofile.writeline Server & " " & "Test Failed: Connection Attempt Timed Out" & " " & Date & " " & Time
End If
If c = 1 And d = 0 Then
ofile.writeline Server & " " & "Test Failed: Disconnect Attempt Failed" & " " & Date & " " & Time
End If
End Sub
Wscript.Echo "Test Complete! Results in C:\Results.txt"
WScript.Quit