Go4Expert (http://www.go4expert.com/)
-   Web Design, HTML And CSS Forums (http://www.go4expert.com/forums/web-design-forum/)
-   -   VBScript in LNSS Editor, Cannot Figure Out Error (http://www.go4expert.com/forums/vbscript-lnss-editor-figure-error-t14159/)

zdunham6287 23Sep2008 22:33

VBScript in LNSS Editor, Cannot Figure Out Error
Hi, I'm not sure if this is the right place to post this because its not web development although it is VBScript, but here we go. At work I'm trying to create a script that will let a user input a list of computers on the network and then a program to uninstall from those computers, and then have the program automatically do that. As of now it just accepts one computer as input, I can worry about a list later. I'm getting this error message when I debug: "Error on line: 11 - Method or data member not found: objSoftware". Here is my code:


Dim inputString As String
Dim inputProgram As String
inputComputer = InputBox("Computer: ")
inputProgram = InputBox("Program to be Uninstalled: ")

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & inputComputer & "\root\cimv2")

Set colSoftware = objWMIService.ExecQuery ("Select * from Win32_Product Where Name = '" & inputProgram & "'")

For Each objSoftware In colSoftware

I'm new to both For Each loops and VBScript so I'm not quite sure why that would be happening. I'm using LNSS Script Debugger Version 1.0 through GFI 8. If anyone knows a better way to do this or something I should change please let me know. Thanks so much for any help.

zdunham6287 25Sep2008 19:41

Re: VBScript in LNSS Editor, Cannot Figure Out Error
I just changed the For Each loop to a For loop:


Set length = UBound(colSoftware)
For count = 0 To length

And now I get "the parameter is incorrect" as an error. Am I doing something wrong?

All times are GMT +5.5. The time now is 15:41.