5

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.

enter image description here

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

enter image description here

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

1
  • I don't know for sure whether it's possible or how, but if the COM object can't do it you might want to see if there's a way to do it with WMI. Commented Feb 25, 2015 at 20:37

1 Answer 1

8

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)
Sign up to request clarification or add additional context in comments.

1 Comment

The Update to $comAdmin,ShutdownApplication line would fail if $app somehow contains multiple apps, I suggested a change in the edit of your answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.