vbs is similar to this one
On Error Resume Next
For Each objItem in colItems
' Create an instance of COMAdmin Catalog
set cat = CreateObject( "COMAdmin.COMAdminCatalog" )
' Reference the Applications Collection
Set apps = cat.GetCollection("Applications")
' Retrieve the data
apps.Populate
' Loop from upperbound to lower since the Remove method
' triggers an automatic reindexing.
For i = apps.Count - 1 to 0 step -1
' query application collection x for name and compare
if ( apps.Item(i).Name = "MYAPPNAME") then
' we have a match, nuke it
apps.Remove (i)
End If
Next
'commit changes
apps.SaveChanges
Next
PS1
#Set the current computername
$sComputer = gc env:computername
#Set the Com+ Application name
$COMPlusAppName = "appname"
#Set a catalog object
$Catalog = New-Object -comobject COMAdmin.COMAdminCatalog
#connect with the current catalog
$Catalog.connect($sComputer)
#retrieve all the com applications
$oapplications = $catalog.getcollection("Applications")
#populate the list
$oapplications.populate()
#Set the start index
$a = 0
#iterate through the list
foreach ($oapplication in $oapplications){
#find the application {
if($oapplication.name -eq $COMPlusAppName){
#remove it
$oapplications.remove($a)
}
#Next item -> index +1
$a = $a + 1
}
#Save the changes
$oapplications.SaveChanges
#show result
foreach ($oapplication in $oapplications){
Write-Host $oapplication.name
}
#inform the user - done
$f = new-object -comobject wscript.shell
$g = $f.popup("Done",0,"FOBreset",64)
Also it's a conversion from VBS so if there is a proper way of doing it in PS then please post it. Thx.
<message edited by Chrisnach on Friday, February 04, 2011 9:47 AM>