Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Object Not a Collection

Posted on 2011-09-28
1
Medium Priority
?
321 Views
Last Modified: 2012-05-12
I have a script that modfies the user account and password used for a windows service, but I have issues with running it, I get 'Object Not a Collection'.


Option Explicit
dim strComputer, objWMIService, colServiceList,colServices,objService
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colServiceList = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_Service WHERE StartName = '.\\Scheduler'")
For Each objService in colServices
 errServiceChange = objService.Change _
 ( , , , , , , ".\TESTDOMAN\svcuser" , "santa10")
Next

Open in new window

0
Comment
Question by:rimmena
1 Comment
 
LVL 10

Accepted Solution

by:
ienaxxx earned 2000 total points
ID: 36720117
u're trying to recall colservicelist as colservices in the loop declaration
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
A quick step-by-step overview of installing and configuring Carbonite Server Backup.
The viewer will learn how to dynamically set the form action using jQuery.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question