Avatar of Leo Torres
Leo Torres
Flag for United States of America asked on

Powershell and COM objects

The code below stops service.

$comAdmin = New-Object -com ("COMAdmin.COMAdminCatalog.1")
$comAdmin.ShutdownApplication("US Business Objects")

Open in new window

What would the code be to check status of COM object before and after I stop service?
Powershell.NET ProgrammingC#

Avatar of undefined
Last Comment
Leo Torres

8/22/2022 - Mon

The specific COM object implements status members. Aside from "does the object exist" (the result not being $null or an empty object), there is nothing generic you can check.
Leo Torres

OK so there is no way to check is COM object is running or not?

No. If you get an object, the process hosting the object is running - necessarily. If the object can check for the status of other processes, it is different, and that might be what you are after. I'll check the COM object you use to see if I can find out more.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Leo Torres

Mind you the "US Business Objects" i am using is an internal object your going to have to use another Object.

In a quick glance, going thru all COM app instances, and checking for the GUID matching, is the only way to check if all instances are shut down (see http://www.31a2ba2a-b718-11dc-8314-0800200c9a66.com/2008/11/shutting-down-running-com-instance_9879.html for non-PS example code).

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Leo Torres

Thank you, out of office till Friday morning will try to get to it before then thank you!
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Leo Torres

Havent had Chance to test but I have confidence  in your code. will update at some point for now I will give you credit.