获取身份Windows Com +应用程序?

时间:2017-10-10 22:07:05

标签: windows powershell vbscript com+

我已经找到了可以为Com +应用程序设置标识的位置,但是找不到如何为现有的Com +应用程序获取标识。

组: How to modify COM+ applications from powershell

获取COM +应用程序名称,ID以及它是否正在运行: https://social.technet.microsoft.com/Forums/projectserver/en-US/7b035318-fc4c-41bb-ad9a-33fa51485c57/check-whether-aplication-in-comadmincomadmincatalog-is-running-or-not?forum=ITCG

r[input[0]]

所以我想如果我将项目'AppItem.Value(“ID”)'更改为'AppItem.Value(“Identity”)',那就是给我我想要的东西,但我得到错误---

Dim Catalog, AppCollection, AppList, AppItem
Set Catalog = CreateObject("COMAdmin.COMAdminCatalog")
Set AppCollection = Catalog.GetCollection("Applications")
AppCollection.Populate
Set AppList = CreateObject("Scripting.Dictionary")
For Each AppItem In AppCollection
  AppList.Add AppItem.Value("ID"), AppItem.Name
Next

Dim AppInstances, AppInstance, AppInstanceList, Value
Set AppInstances = Catalog.GetCollection("ApplicationInstances")
AppInstances.Populate
Set AppInstanceList = CreateObject("Scripting.Dictionary")
For Each AppInstance In AppInstances
  Value = AppInstance.Value("Application")
  AppInstanceList.Add Value, AppList(Value)
Next

For Each AppItem In AppList
  WScript.Echo vbNewLine _
    & "App Name: " & vbTab & AppList(AppItem) & vbNewLine _
    & "App ID: " & vbTab & AppItem & vbNewLine _
    & "Running? " & vbTab & CStr(AppInstanceList.Exists(AppItem))
Next

1 个答案:

答案 0 :(得分:0)

Const COMAdminAuthenticationDefault   = 0
Const COMAdminAuthenticationNone      = 1
Const COMAdminAuthenticationConnect   = 2
Const COMAdminAuthenticationCall      = 3
Const COMAdminAuthenticationPacket    = 4 
Const COMAdminAuthenticationIntegrity = 5
Const COMAdminAuthenticationPrivacy   = 6

Dim catalog
Dim applications
Dim application

Set catalog = CreateObject("COMAdmin.COMAdminCatalog")
Set applications = catalog.GetCollection("Applications")

Call applications.Populate

For Each application In applications

    If (application.value("Identity")  = "domain\username") Then

Wscript.Echo application.value("Name")

        Call applications.SaveChanges
    End If
Next