如何使用 PowerShell 更新 COM+ 应用程序并创建其 msi 文件? [英] How to update a COM+ applications and create its msi file using PowerShell?
问题描述
我的机器上安装了一个 COM+ 应用程序,它有两个组件.这个 COM+ 应用程序是使用 SetupCom.exe
文件创建的,该文件是几年前使用 C# 代码创建的.它曾经安装和创建一个 COM+ msi 文件
,但现在我无法访问该代码,我需要从这个 COM+ 应用程序中删除一个组件 - 不再使用.
因此,我使用 google 进行搜索,发现一些 PowerShell 脚本从 COM+ 应用程序中删除了组件,但它们不会创建 msi
文件.我需要这个更新的 COM+ 应用程序 msi\installer
文件,以便我可以在多台机器上安装它.
以下是从 COM+ 应用程序中删除组件的脚本,但不会创建更新的 msi
文件.
$comCatalog = New-Object -ComObject COMAdmin.COMAdminCatalog$appColl = $comCatalog.GetCollection("应用程序")$appCol.Populate()$app = $appCol |其中 {$_.Name -eq "COMAPPNAME"}$compColl = $appColl.GetCollection("组件", $app.Key)$compColl.Populate()美元指数 = 0foreach($compColl 中的 $component) {if ($component.Name -eq "SOMECOMPONENT.NAME") {$compColl.Remove($index)$compColl.SaveChanges()}$index++}
写到下面,我记得以前写过类似的东西.这是:
这个导出的 MSI 文件不是 - 我们应该说 - 自切片面包以来最伟大的事情.如果你想修改它,它会以某种方式迅速中断.那里有一个未记录的 APL 文件,其中包含 COM+ 设置,我从来不知道如何自己处理.就按原样使用 MSI - 如果可以的话.
<小时>一些链接:我对这些链接的理解有点远,请选择粗体链接.
- 创建安装COM+ 应用程序包
- 了解COM+应用安装
- C# - 检索 COM+ 组件的属性?
- 自动化 COM+ 管理
- COM+:库与服务器应用程序
- COM+ 应用程序安装问题
- COM+ 事件系统(松散耦合事件(LCE) 系统)
I have a COM+ application installed on my machine which has two components. This COM+ application was created using an SetupCom.exe
file which was made using C# code some years bac. It used to install and create a COM+ msi file
, but now I don't have access to that code, and I need to remove one component from this COM+ application - which is no longer in use.
So, I searched using google and I found some PowerShell scripts that remove the components from the COM+ application, but they don't create the msi
file. I need this updated COM+ application msi\installer
file so that I can install it on multiple machines.
Below is the Script which removes the component from COM+ application, but doesn't create an updated msi
file.
$comCatalog = New-Object -ComObject COMAdmin.COMAdminCatalog
$appColl = $comCatalog.GetCollection("Applications")
$appColl.Populate()
$app = $appColl | where {$_.Name -eq "COMAPPNAME"}
$compColl = $appColl.GetCollection("Components", $app.Key)
$compColl.Populate()
$index = 0
foreach($component in $compColl) {
if ($component.Name -eq "SOMECOMPONENT.NAME") {
$compColl.Remove($index)
$compColl.SaveChanges()
}
$index++
}
Writing the below, I remembered having written something similar before. Here it is: Would this method of installing COM+ work?
There is support in all major deployment tools (thee main bullet point links) to do COM+ deployment. WiX may provide the most flexible features for COM+ installation, but I have never used them.
COM+ deployment has always been a bit strange to deal with. Despite all my years doing deployment I have only done it a few times. And several times I have had a lot of problems with it. I even had a guy make a basic "hello world" COM+ application that I sent to a deployment vendor to illustrate how they did not do COM+ properly. No luck.
Typically I have ended up exporting a COM+ installer MSI from the Component Services (Launch suggestion: Windows Key + tap R type comexp.msc
and press Enter). After setting up an application as you want it running, you right click it in the list and export an MSI file (in your case I guess it should already be set up):
This exported MSI file is not - shall we say - the greatest thing since sliced bread. If you want to modify it, it will quickly break in some fashion. There is an undocumented APL file in there with COM+ settings that I never understood how to handle on my own. Just use the MSI as it is - if you can.
Some Links: I took it a bit far with these links, just go for the bolded ones.
- Creating Installation Packages for COM+ Applications
- Understanding COM+ Application Installation
- C# - Retrieve properties of a COM+ component?
- Automating COM+ Administration
- COM+:Library vs Server Application
- COM+ Application installation woes
- The COM+ Event System (loosely coupled event (LCE) system)
这篇关于如何使用 PowerShell 更新 COM+ 应用程序并创建其 msi 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!