I've scripted the start and stop of COM+ applications on a remote server using PowerShell:
function Set-ComPlusStatus {
$comPlusApps=Get-Content $comPlusAppList
$comObj=New-Object -comobject COMAdmin.COMAdminCatalog
$comObj.Connect($server)
ForEach($comPlusApp in $comPlusApps) {
if($setStatus="stop") {
$comObj.ShutdownApplication($comPlusApp)
}
elseif($setStatus="start") {
$comObj.StartApplication($comPlusApp)
}
}
}
This function works i.e. it stops/starts the COM+ packages listed in the reference txt document ($comPlusAppList) as expected.
However, I would like to add some form of verification/validation to confirm that the function has been successful; ideally I'd like to check the status of the specific packages and write a success/fail message back to host based on the status.
How can the COM+ package status (stopped/running) be accessed to accomplish this?