How to modify COM+ applications from powershell

com+, powershell

Solution

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)

Problem

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?

Original source