Quick-Hits Friday: The Scripting Guys Respond to a Bunch of Questions (9/3/10)

In this post:


 How to Identify COM Objects for Use by Windows PowerShell or VBScript

Hey, Scripting Guy! Question

Hey, Scripting Guy! I usually create simple scripts (network mapping, printers, and similar stuff), but all along I have dreamt about more complex and intelligent things. I would like to use objects, but I have such a mess in my head with all this COM components, Word, Excel objects, winnt://, and so on. My main problem is that I have no strict system knowledge.

Could I ask you to suggest some links for the following (you can believe me I spent hours surfing the net but apart from fragments nothing comprehensive). Is there a comprehensive list of Windows objects that are used with all possible parameters. For example, I can use the following to create objects:




The problem is that I do not know where these objects come from. They make sense when I see them referred to on your blog, but it’s like you have to know the secret passphrase.

I appreciate any consistent links and maybe some redirections to books. I explored MSDN, but it is for people with the basic framework inside their head already. I look forward to your response.

— AM


Hey, Scripting Guy! Answer Hello AM,

Your question is one that was often been asked of me when I was teaching VBScript and Windows PowerShell classes around the world. Therefore, it is a relatively easy one to answer. No, there is no comprehensive list of COM objects, other than the HKEY_CLASSES_ROOT registry hive on your own computer. HKEY_CLASSES_ROOT is seen in the following image.


The reason for this is that nearly every computer in the world is different, even in managed environments. This is because they all have a different combination of software installed, service packs, hotfixes, and even applets that get downloaded via web pages. All install software of some type, and all provide various capabilities. Even two computers running exactly the same software may expose different capabilities because of configuration changes and options selected at installation. Even when two different machines were installed with exactly the same software, installation mechanism, and options could still end up with different COM objects available because many software packages offer features that are “installed on first use.” Therefore, if anyone were to succeed in providing a list of all available COM objects in the world, it would be out of date before it was even published.

MSDN is the best place for comprehensive documentation in the Microsoft world, but I will agree with you that at times it is a bit confusing to peruse. The search mechanism is great these days. Unfortunately, when searching you need to have an idea of what you would like to find. We have not yet implemented a “find cool COM objects” feature for MSDN. Maybe it is coming.

Until MSDN gets the “cool COM objects” feature working, you may wish to start with this table which is taken from Appendix C of Windows PowerShell 2.0 Best Practices, a book I wrote for Microsoft Press.

Table C-1 COM objects and their use




Refers to the active Microsoft Office Access application.


Defines a specific command that you intend to execute against a data source.


Represents an open connection to a data source.


Represents the entire set of records from a base table or the results of an executed command. At any time, the Recordset object refers to only a single record within the set as the current record.


Returns an instance of the IADsADSystemInfo interface. The IADsADSystemInfo interface retrieves data about the local computer. For example, you can get the domain, site, and distinguished name of the local computer.


The top-level object in Excel’s object model. Use the Application object to determine or specify application-level properties or execute application-level methods. The Application object is also the entry point into the rest of the Excel object model.


Allows you to define the criteria to use for search operations when using the Group Policy Management Console (GPMC) interfaces.


Returns the INetFwMgr interface which provides access to the firewall settings for a computer.


Returns the INetFwPolicy interface that provides access to a firewall policy.


Gets the automation object for Internet Explorer.


Exposes methods that provide access to the Common Feed List, which is a hierarchy of Really Simple Syndication (RSS) feeds to which the user is subscribed.


Returns the IAutomaticUpdates interface, which contains the functionality of Automatic Updates.


Returns the IUpdateInstaller interface that installs or uninstalls updates from or onto a computer.


Returns the IUpdateSearcher interface that searches for updates on a server.


Returns the IUpdateSession interface that represents a session in which the caller can perform operations that involve updates.


Returns the IUpdateCollection interface, which represents an ordered list of updates.


Represents the entire Microsoft Graph application. The Application object represents the top level of the object hierarchy and contains all of the objects, properties, and methods for the application.


Represents the specified Microsoft Graph chart.


Provides ability to run other script code, such as VBScript, from within a Windows PowerShell script.


Returns an instance of a DOM document for MSXML 2.0.


Returns an instance of a DOM document for MSXML 3.0.


Represents the entire Outlook application.


Returns the ISpTTSEngineSite interface that is used to write audio data and events.


Creates a taskservice object that provides access to the Task Scheduler service for managing registered tasks.


Creates the FileSystemObject that provides access to files and to folders.


Provides access to scriptable shell objects.


Returns the WMI SwbemLocator object that contains the ConnectServer method for connecting to namespaces on remote computers.


Represents the Microsoft Office Word application. The Application object includes properties and methods that return top-level objects.


Returns the WshNetwork object that provides access to the shared resources on the network to which your computer is connected.


Returns the WshShell object that provides access to the native Windows shell.


Returns the automation object for Windows Remote Management, which can be used to retrieve data exposed by Windows Management Instrumentation.


 How Can I Make My Scripts Take Less Time? 

Hey, Scripting Guy! Question

Hey, Scripting Guy! I am looking into making my Windows PowerShell scripts take less time. I often write scripts that have to hit every machine in my environment and want to make this process take considerably less time. Right now, the steps in my scripts are synchronous (I ping a machine, check if I have access, then do something on that machine), which doesn’t scale well as my environment grows. I am looking to leverage Windows PowerShell jobs to allow my script to run more asynchronously (ping all machines, as soon as I start having machines that are online kick off job to test access, and take action on machine). The thing is that I can’t figure out how to get this working, meaning I can start a job but can’t seem to trigger an event on the output of that job. Is this something you can help with?

— JB


Hey, Scripting Guy! Answer Hello JB,

I wrote a week’s worth of articles in March about jobs, and there are some Weekend Scripter blog posts about testing the performance of Windows PowerShell scripts. I have a cool script that I use to check the performance of changes that I make to two scripts.


Well, this concludes another edition of Quick-Hits Friday. Join us tomorrow for the Weekend Scripter as we conclude our series of Weekend Scripter articles about the Windows PowerShell ISE.

We would love you to follow us on Twitter and Facebook. If you have any questions, send email to us at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.


Ed Wilson and Craig Liebendorfer, Scripting Guys


Comments are closed. Login to edit/delete your existing comments