(旧版)MFCOM VBScript获取无效的过程调用

时间:2017-10-04 15:29:21

标签: vbscript citrix

我可以很好地列出所有已发布的应用程序,但是在尝试获取根应用程序文件夹时,我会收到无效的过程调用。有谁知道我在这里做错了什么?

Dim theFarm,rootAppFolder
Set oWSHShell = CreateObject("Wscript.Shell")
Set oWSHNetwork = CreateObject("WScript.Network")
Set oWSHProcEnv = oWSHSHELL.Environment("PROCESS")

            'Create MetaFrameFarm object
            Set theFarm = CreateObject("MetaFrameCOM.MetaFrameFarm")
              if Err.Number <> 0 Then
                WScript.Echo "Can't create MetaFrameFarm object"
                WScript.Echo "(" & Err.Number & ") " & Err.Description
                WScript.Echo ""
                WScript.Quit Err.Number
              End if


            'Initialize the farm object.
            theFarm.Initialize 1

          If Err.Number <> 0 Then
                WScript.Echo "Can't  Initialize MetaFrameFarm object"
                WScript.Echo "(" & Err.Number & ") " & Err.Description
                WScript.Echo ""
                WScript.Quit Err.Number
              End if

Set rootAppFolder = theFarm.GetRootFolder(MetaFrameAppFolder) 'error on this line here
Set appFolder = rootAppFolder.GetSubFolder("A_USA")
Set folder = appFolder.AppFolder

For each app in folder.Applications

    app.LoadData(0)
    WScript.Echo app.AppName

Next

1 个答案:

答案 0 :(得分:1)

使用Option Explicit来避免像未初始化MetaFrameAppFolder这样的错误。