Computer Performance, Logon Scripts

Guy recommends :
Free Solarwinds
VM Console

Solarwinds VM Console Free Download

Find out which of your VMs are a waste of space and which VMs need more resources.


Guy's Review of
Computer Utilities

 1) FreePing
 2) Engineer's Toolset
 3) Xobni
 4) PuTTY
 5) WMI Monitor
 6) BgInfo
 7) Net-SNMP
 8) IP Address Tracker
 9) DNS Stuff
10) WinDiff Compare


Code Error 800A0CC1 - Item cannot be found in the collection

Troubleshooting Code 800A0CC1 - Item cannot be found in the collection

Difficult error code to solve. You may need lateral thinking to cure 800A0CC1

Introduction to Code 800A0CC1

Error code, 800A0CC1 occurs when you execute a VBScript.Code 800A0CC1 - Item cannot be found in the collection

The Symptoms You Get

The script does not execute as you had hoped.  Instead. Windows Scripting host generates a message box like this picture:

The Cause of Code 800A0CC1

Your VBScript contains an incorrect argument.   Note: The clue Source: ADODB.Recordset.

The Solution

The Windows Scripting Host gives us three useful clues, firstly, look on Line: 22, do count any remark or empty lines.  Secondly, the Char: number 1, is less useful as the error could be anywhere on that line.  Thirdly Expected 'Item not found....' is pointing us to the script problem.  This an obscure error, the problem is that the script is trying to display OU, but OU is not a valid property of the computer object.

  ‡

Example of error 800A0CC1 Script

I admit that this is a specialist script in the sense that it has a hard-coded name of the domain.

Check the  & OU line.

 

' VBScript to display the XP machines in your Active Directory domain
' Guy Thomas February 2010.
' ******************************
Const ADS_SCOPE_SUBTREE = 2
objDom = "cn=computers,DC=cp,DC=com"
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"Select Name, Location, operatingSystemVersion from 'LDAP:// cn=computers,DC=cp,DC=com'" _
& " where objectClass='computer' " _
& " and operatingSystemVersion = '5.1 (2600)'"
objCommand.Properties("Page Size") = 500
objCommand.Properties("Timeout") = 20
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo "Computer Name: " & objRecordSet.Fields("Name").Value & VBCr _
& "Version: " & objRecordSet.Fields("operatingSystemVersion").Value & VBCr _
<& "OU: " & objRecordSet.Fields("ou").Value>
objRecordSet.MoveNext
Loop

' End of Script

 

Corrected Version

With & "OU: " & objRecordSet.Fields("ou").Value removed.

 

' Computers.vbs
' Example VBScript to display the Computer Objects in your domain
' Guy Thomas February 2010.
' ******************************
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"Select Name, operatingSystemVersion from 'LDAP://dc=cp, dc=com'" _
& " where objectClass='computer' "
objCommand.Properties("Page Size") = 500
objCommand.Properties("Timeout") = 20
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo "Computer: " & objRecordSet.Fields("Name").Value & VbCr _
& "Version: " & objRecordSet.Fields("operatingSystemVersion").Value
objRecordSet.MoveNext
Loop

' End of example VBScript

 

Guy Recommends: WMI Monitor and It's Free!Solarwinds WMI Monitor

Windows Management Instrumentation (WMI) is one of the hidden treasures of Microsoft operating systems.  Fortunately, Solarwinds have created the WMI Monitor so that you can examine these gems of performance information for free.  Take the guess work out of which WMI counters to use for applications like Microsoft Active Directory, SQL or Exchange Server.

Download your free copy of WMI Monitor


Do you need extra help?

For interpreting the WSH messages check Diagnose 800 errors.

For general advice try my 7 Troubleshooting techniques

Give something back?

Would you like to help others?  If you have a good example of this error, then please email me, I will publish it with a credit to you:

 

If you like this page then please share it with your friends

 


 *


Custom Search

Solarwinds Network Device MonitorSolarwinds' Free Network Device Monitor

Thus utility makes it easy to check the health of a router or firewall.  Check the real-time performance and availability statistics for any device on your network.

Get started with an extensive collection of "out-of-the-box" monitors for popular network devices.  Download your free Network Device Monitor

 

Home Copyright © 1999-2012 Computer Performance LTD All rights reserved

Please report a broken link, or an error.