Recycle COM+ Running Process

by wethereyet at 2012-09-12 17:55:25

Greetings all, (noob alert)
I have an app thats never releasing close_wait tcp sessions causing eventual port exhaustion in the ephemeral range and the app to stop taking new connections (rpc crashing etc). Unfortunately the vendor is not helpful so I’ve found a workaround. I can release them by recycling the application COM+ running process which creates a new dllhost process allowing me to remove the old dllhost process thats storing the close_wait sessions. (doesnt affect established connections).

I’ve whipped a dirty bare bones script but I’m having problems with the $comAdmin.RecycleApplicationInstances - is anyone able to get that to work?
Many thanks

Error:
Cannot find an overload for “RecycleApplicationInstances” and the argument count: “1”.
+ $comAdmin.RecycleApplicationInstances <<<< ("$runningapp")

Code:
$SPFComApp = “ServicedCom”

#Connect to the COM+ Applications
$comAdmin = New-Object -comobject COMAdmin.COMAdminCatalog
$apps = $comAdmin.GetCollection(“Applications”)
$apps.populate()

#Connect to required COM+ Application
$app = $apps | where-object {$.Name -eq “$SPFComApp”}

#Get correct dllhost process id to end task after recycling the pool
$classid = $app.key
$getdllprocess = gwmi -Class Win32_Process | ? {$
.CommandLine -like “$classid”}
$processid = $getdllprocess.processid

$runningapp = $comAdmin.GetApplicationInstanceIDFromProcessID("$processid")
$comAdmin.RecycleApplicationInstances("$runningapp")

#Stop-Process $processid
by wethereyet at 2012-09-12 22:06:21
I suspected I had the format wrong. Requires an reason code also. Made one up :slight_smile: http://msdn.microsoft.com/en-us/library … 63(v=vs.90).aspx

$comAdmin.RecycleApplicationInstances("$runningapp",“666”)