如何从 powershell 修改 COM+ 应用程序 [英] How to modify COM+ applications from powershell

查看:60
本文介绍了如何从 powershell 修改 COM+ 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在自动创建 Web 服务器.为我创建了一个应用程序,但我需要手动更改 COM+ 应用程序的标识以作为特定用户运行.

作为一个对 powershell 几乎没有经验的 linux 管理员,我很困惑.看起来有一个 API 来修改 COM+ 应用程序.

,我得到了它的工作.

$targetApp = "examplecompany"$comAdmin = New-Object -comobject COMAdmin.COMAdminCatalog$apps = $comAdmin.GetCollection("应用程序")$apps.Populate();$app = $apps |Where-Object {$_.Name -eq $targetApp}$comAdmin.ShutdownApplication($targetApp)$app.Value("Identity") = 'example.com\exampleuser'$app.Value("Password") = '正确的马电池主食'$apps.SaveChanges()$comAdmin.StartApplication($targetApp)

I am automating the creation of a web server. An application is created for me, but I need to manually change the Identity of a COM+ Application to run as a specific user.

Being a linux admin with little experience with powershell, I'm in over my head. It looks like there is an API to modify COM+ applications.

https://msdn.microsoft.com/en-us/library/ms679173(v=vs.85).aspx

From this stackoverflow question, I've gotten this far in modifying the application

$comAdmin = New-Object -comobject COMAdmin.COMAdminCatalog
$apps = $comAdmin.GetCollection("Applications")
$apps.Populate();

I am able to see my application in the list by typing in this command

$apps

Is it possible to modify the foobar application Identity from powershell?

解决方案

Thanks to this stackoverflow question, I got it working.

$targetApp = "examplecompany"
$comAdmin = New-Object -comobject COMAdmin.COMAdminCatalog
$apps = $comAdmin.GetCollection("Applications")
$apps.Populate();
$app = $apps | Where-Object {$_.Name -eq $targetApp}
$comAdmin.ShutdownApplication($targetApp)

$app.Value("Identity") = 'example.com\exampleuser'
$app.Value("Password") = 'correct-horse-battery-staple'
$apps.SaveChanges()
$comAdmin.StartApplication($targetApp)

这篇关于如何从 powershell 修改 COM+ 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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