Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

manipulating remote COM applications

72 views
Skip to first unread message

lone...@gmail.com

unread,
Mar 26, 2007, 2:13:19 PM3/26/07
to
So far I've been unsuccessful in looking this information up, so if
someone could kindly point me in the right direction, I'd appreciate
it!

I have to run a script on Computer A that will connect to Computer B
and check if a certain COM+ application is running. If the COM+ is
running, I need to shut it down. How does PowerShell go about
interacting with COM+?

Andrew Savinykh

unread,
Mar 27, 2007, 5:41:51 AM3/27/07
to
Try this:

$targetComputer = "irealm"
$targetApplication = "COM+ QC Dead Letter Queue Listener"

$comAdmin = New-Object -comobject COMAdmin.COMAdminCatalog
$apps = $comAdmin.GetCollection("Applications")
$apps.Populate()
$app = $apps | Where-Object { $_.Name -eq $targetApplication }

$insts = $apps.GetCollection("ApplicationInstances",$app.Key)
$insts.Populate()

$isRunning = $insts.Count -gt 0

if ($isRunning) { Write-Output Running } else { Write-Output "Not Running" }

if ($isRunning) { $comAdmin.ShutDownApplication($app.Key) }


Also note that you don't need to check if application is running if you
just need to shut it down. ShutdownApplication method won't return a
error if an application is already shutdown.

//Andrew

Andrew Savinykh

unread,
Mar 27, 2007, 5:44:32 AM3/27/07
to
I missed

$comAdmin.Connect($targetComputer)

right after

$comAdmin = New-Object -comobject COMAdmin.COMAdminCatalog

//Andrew

lone...@gmail.com

unread,
Mar 27, 2007, 10:50:57 AM3/27/07
to
Thank you very much! That worked perfectly! I was close, but wasn't
working with the COMAdmin.COMAdminCatalog properly.

And I did get to use that IsRunning check to make sure the app started
up later on. :)

0 new messages