How to fix Error in script - "Object not a collection" 800A01C3? - TechRepublic
Question
June 23, 2011 at 07:58 AM
acox1976

How to fix Error in script – "Object not a collection" 800A01C3?

by acox1976 . Updated 15 years ago

I’m trying to set up a renaming script but I’m getting an error at line 15, character 2 which says “Object not a collection” (error code 800A01C3). This is the script (numbered to make it easier to identify the error line):

1 Const ForReading = 1
2
3 strComputer = “.”
4 Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)
5
6 Set objFSO = CreateObject(“Scripting.FileSystemObject”)
7 Set objFile = objFSO.OpenTextFile (“C:\Users\gzqj79\Desktop\Renaming.txt”, ForReading)
8
9 Do Until objFile.AtEndOfStream
10 strLine = objFile.ReadLine
11 arrParts = Split (StrLine, “,”)
12 strFile = “C:\\Photos\\” & arrParts(0)
13 Set colItems = objWMIService.ExecQuery _
14 (“Select * From CIM_Datafile Where Name = ‘” & StrFile & “‘”)
15 For Each objItem in colItems
16 strNewName = “C:\Photos\” & arrParts(1)
17 objItem.Rename strNewName
18 NEXT
19 LOOP
20
21 objFile.Close

Any help would be appreciated!
Thanks —

This discussion is locked

All Comments