Solved

Not understanding what is wrong with a VBS script.

Posted on 2013-11-11
2
305 Views
Last Modified: 2013-11-11
Hi guys,

Can any of you tell me what's wrong with this script? It keeps giving me a syntax error in line 3 character 1, and I'm not able to figure out why. Thanks in advance.

strComputer = "Computername"

Set objWMIService = GetObject("winmgmt:\\" & strComputer & "\root\cimv2")

Set colProcessors = objWMIService.ExecQuery("Select * from Win32_Processor")

For Each objProcessor in colProcessors
    WScript.Echo objProcessor.AddressWidth     'or  objProcessor.DataWidth
    Exit For
Next
0
Comment
Question by:roycbene
2 Comments
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 500 total points
ID: 39639307
Set objWMIService = GetObject("winmgmt:\\" & strComputer & "\root\cimv2")

should be

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
0
 
LVL 3

Author Comment

by:roycbene
ID: 39639337
Thanks, Jacko! You rock!!!
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …

932 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now