Link to home
Start Free TrialLog in
Avatar of Leo Torres
Leo TorresFlag 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?
Avatar of Qlemo
Qlemo
Flag of Germany image

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.
Avatar of Leo Torres

ASKER

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.
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).
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you, out of office till Friday morning will try to get to it before then thank you!
Havent had Chance to test but I have confidence  in your code. will update at some point for now I will give you credit.