gfunkpilot Posted July 23, 2014 Share Posted July 23, 2014 Hello, I am a bit new to manipulating COM+ stuff. I am able to get the Identity for the application set correctly, however, I am trying to update the Object Pooling option for the COM+ application component. Here is my code snippet for retrieving the COM+ class, the application (retrieval and updating the identity) and attempting the component retrieval and updating. However, the $Components variable is empty, so for some reason I am not finding the component data properly. Note: I did change the actual names of the application and component since the are proprietary applications and I didn't want to get into trouble. Any help is greatly appreciated! expandcollapse popup$oCatalog = ObjCreate("COMAdmin.COMAdminCatalog.1") If IsObj($oCatalog) Then $Applications = $oCatalog.GetCollection("Applications") $Applications.Populate For $app in $Applications $appName = $app.Value("Name") If StringInStr($appName, "ApplicationName", 0) Then _FileWriteLog(@ScriptDir & "\Logs\FAS_Config.log", "Setting Identity = " & $ID & " for COM+ application ""ApplicationName""") $app.Value("Identity") = $ID $app.Value("Password") = $PW $Applications.SaveChanges MsgBox(0, "appName", $appName) ;debug line, this does retrieve the correct application. MsgBox(0, "app.Key", $app.Key) ;debug line, this is the correct GUID. $Components = $Applications.GetCollection("Components", $app.Key) ;;;$Components results in empty string for some reason $Components.Populate MsgBox(0, "component populated?", $Components) ;debug line If StringLen($Components) > 0 Then MsgBox(0, "Components are populated", $Components) ;debug line For $comp in $Components MsgBox(0, "Each Component", $comp) ;debug line $compName = $comp.Value("Name") If StringInStr($compName, "ComponentName", 0) Then $comp.Value("ObjectPoolingEnabled") = 1 $comp.Value("MaxPoolSize") = $CPUcount * 2 $comp.Value("MinPoolSize") = $CPUcount * 2 $comp.Value("IISIntrinsics") = 1 MsgBox(0, "My Component", $compName) ;debug line $Components.SaveChanges EndIf Next Else MsgBox(0, "Component Error", "No components found for application!") EndIf EndIf Next _deleteTMPfiles() Else Msgbox(0,"Error","Failed to connect to COM+ catalog." & @CRLF & "Please verify you have access to COM+ settings. Exiting!") _FileWriteLog(@ScriptDir & "\Logs\FAS_Config.log", "Failed to connect to COM+ catalog. Please verify you have access to COM+ settings. Exiting!") _deleteTMPfiles() EndIf Link to comment Share on other sites More sharing options...
water Posted July 23, 2014 Share Posted July 23, 2014 Welcome to AutoIt and the forum! Which version of AutoIt do you run? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
gfunkpilot Posted July 23, 2014 Author Share Posted July 23, 2014 Oh, crud, I forgot to include that part. I wrote this script using 3.3.6.1, but this morning I upgraded to 3.3.12.0 and recompiled but still have the same results. Thanks! Link to comment Share on other sites More sharing options...
water Posted July 23, 2014 Share Posted July 23, 2014 To get better error information you could add this lines at the top of your script: #include <Debug.au3> _DebugSetup() _DebugCOMError() What do you get then? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
gfunkpilot Posted July 23, 2014 Author Share Posted July 23, 2014 The debug report only shows this: >>>>>> Please close the "Report Log Window" to exit <<<<<<< Link to comment Share on other sites More sharing options...
water Posted July 23, 2014 Share Posted July 23, 2014 So there are no COM errors. What type is $Components supposed to be (according to the documentation)? I would assume a collection. So you can't check for a string. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
gfunkpilot Posted July 23, 2014 Author Share Posted July 23, 2014 Correct, $Components would be a collection. I have been going by the MSDN pages to find help. http://msdn.microsoft.com/en-us/library/windows/desktop/ms688285(v=vs.85).aspx Link to comment Share on other sites More sharing options...
water Posted July 23, 2014 Share Posted July 23, 2014 (edited) In this case I would replace If StringLen($Components) > 0 Then with If $Components.Count > 0 Then if the collection offers the count property. Edited July 23, 2014 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
gfunkpilot Posted July 23, 2014 Author Share Posted July 23, 2014 (edited) Well, either the collection doesn't offer the count property or it is reporting > 0, cause I made it past the If statement to the MsgBox(0, "Components are populated", $Components) ;debug line For $comp in $Components MsgBox(0, "Each Component", $comp) ;debug line and from there it tries to complete the value setting and errors with exception occurred due to the empty string for $comp. Edited July 23, 2014 by gfunkpilot Link to comment Share on other sites More sharing options...
water Posted July 23, 2014 Share Posted July 23, 2014 If the debug statements I posted above are still present in your script then there is a count property available. Else you would see a COM error emssage. For $comp in $Components doesn't return a string but an object of the collection. What's the exact error message you get? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
gfunkpilot Posted July 23, 2014 Author Share Posted July 23, 2014 I took out my other error capturing function and this is the error I am seeing now: @@ DEBUG COM Error encountered in COMupdate.exe (-1) : Number = 0x80020009 (-2147352567) WinDescription = Exception occurred. Description = Source = HelpFile = HelpContext = 0 LastDllError = 0 Retcode = 0x80070057 >>>>>> Please close the "Report Log Window" to exit <<<<<<< I am logged in as Administrator, so it is not a permissions issue. However, it very well could be I have the wrong catalog for the components, but I am not sure what the catalog it would be if not this one. Link to comment Share on other sites More sharing options...
gfunkpilot Posted July 24, 2014 Author Share Posted July 24, 2014 After doing some more testing, I think the catalog is correct. I changed the code to look at one of the "default" COM+ applications named 'COM+ Utilities'. This change still returns blank entries, however, when I get to the individual component loop For $comp in $Components MsgBox(0, "Each Component", $comp.Value("Name")) ;debug line I receive a popup titled "Each Component" with the value field blank five times and there are five components for the 'COM+ Utilities' application. Therefore, it seems to be finding the components, but I guess I am not "looking" for the correct value to display? Any one have any thoughts on where I could be missing something? Link to comment Share on other sites More sharing options...
gfunkpilot Posted July 24, 2014 Author Share Posted July 24, 2014 I figured it out. The components have different naming conventions than the applications group. The value to find the "name" of the component is "ProgID" and not "Name" like the applications group. Therefore, my code changes to this: For $comp in $Components $compName = $comp.Value("ProgID") MsgBox(0, "Each Component", $compName) ;debug line Hope this helps other people in the future. Thanks for the help!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now