VBS:ActiveX组件无法创建对象:64位上的“ Citrix.ICAClient”错误 [英] VBS: ActiveX component can't create object: 'Citrix.ICAClient' errror on 64-bit

查看:175
本文介绍了VBS:ActiveX组件无法创建对象:64位上的“ Citrix.ICAClient”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个脚本,用于查找所有打开的Citrix连接并断开与登录Windows的用户无关的任何Citrix连接(Citrix Web Interface连接)。它在32位计算机(XP或7)上工作得很好,但在64位计算机上却不能。我知道它确实依赖两个Citrix注册表项( AllowLiveMonitoring AllowSimulationAPI )和 WfIcaLib.dll ,它们分别位于不同的架构。我以为我的脚本和64位版本有点关系,但是当我从32位计算机上卸载Receiver时,我得到了完全相同的错误。当我重新安装时,错误消失了。无需特殊的安装开关或方法,只需常规安装3.4.300 Receiver。因此,尽管它必须与64位相关,但它与Citrix有关,而不是只是 VBScript代码。

I have a script that looks for all open Citrix connections and disconnects any of them that aren't associated with the user logged in to Windows (Citrix Web Interface connections). It works perfectly fine on 32-bit machines (XP or 7) but not on 64-bit. I know it does rely on two Citrix reg keys (AllowLiveMonitoring & AllowSimulationAPI) and the WfIcaLib.dll, which will be in different locations on different architecture. I thought it was something with my script and 64-bit, but when I uninstall the Receiver from a 32-bit machine, I get the same exact error. And when I reinstall, the error goes away. No special install switches or method, just a regular install of the 3.4.300 Receiver. So although it must be 64-bit related, it's with Citrix and not just the VBScript code.

这是我的脚本, Set icaClient = CreateObject( Citrix.ICAClient)行是错误所在。

Here is my script, the Set icaClient = CreateObject("Citrix.ICAClient") line is where it errors.

请先感谢。
Brian

Thanks in advance. Brian

Option Explicit
Dim strWindowsUser
Dim icaClient
Dim sessionHandle
Dim numSessions
Dim sessionID
Dim sessionInfo
Dim ct
Dim wshNetwork

' Get the name of the generic Windows user logged in

Set wshNetwork = WScript.CreateObject("WScript.Network")
strWindowsUser = wshNetwork.UserName

' As the next user is logging into the workstation, look for any
' Citrix sessions not tied to the generic Windows user and disconnect
' the session. 
' If you don't want to disconnect, use a Logoff command as follows:
' icaClient.Logoff()

Set icaClient = CreateObject("Citrix.ICAClient")
sessionHandle = icaClient.EnumerateCCMSessions()
numSessions = icaClient.GetEnumNameCount(sessionHandle)x

For ct = 0 To numSessions - 1

sessionID = icaClient.GetEnumNameByIndex(sessionHandle, ct)
icaClient.StartMonitoringCCMSession sessionID, True

'SessionServer = 0,
'SessionUsername = 1
'SessionDomain = 2
sessionInfo = icaClient.GetSessionString(1)
If lcase(sessionInfo) <> lcase(strWindowsUser) Then
    icaClient.Disconnect()
End If

icaClient.StopMonitoringCCMSession sessionID 

Next

icaClient.CloseEnumHandle sessionHandle


推荐答案

尝试手动指定64位cscript.exe

Try manually specifying the 64bit cscript.exe

C:>%windir%\syswow64\cscript.exe script.vbs

C:>%windir%\syswow64\cscript.exe script.vbs

我不

编辑:测试了您的代码,并且在对64位cscript进行硬编码时可以使用。我正在使用Windows 8.1(x64)和Receiver 4.2(ICA Client 14.2)

Tested your code and it works when hardcoding the 64bit cscript. I'm using Windows 8.1 (x64) and Receiver 4.2 (ICA Client 14.2)

c:\tools>cscript.exe text.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

c:\tools\text.vbs(22, 1) Microsoft VBScript runtime error: ActiveX component can't create object: 'Citrix.ICAClient'

c:\tools>%windir%\syswow64\cscript.exe text.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

c:\tools>

这篇关于VBS:ActiveX组件无法创建对象:64位上的“ Citrix.ICAClient”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆