Announcement

Collapse
No announcement yet.

Citrix Scripting

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Citrix Scripting

    Has anyone done any citrix scripting? I have a couple published apps on citrix, and every morning I check to see if I can connect to the apps by logging in through citrix. I'm trying to make a script that will do this for me, and return if the connection is successful or not. I have found some stuff online...and done what I can...I haven't tested this but I wanted to see if anyone else knew anything:

    Code:
    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("Server 1")
    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 3.0"
    	objICO.TransportDriver = "TCP/IP"
    
    	'Set credentials
    	objICO.Username = "it-test"
    	objICO.SetProp "Password","citrix"
    	objICO.Domain = "Domain Name"
    
    	'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
Working...
X