Getting an Error: 0x80041002 Code: 80041002 Source: (null)
in scripts on some computers (not others).
here is a snippit
The error is hitting on the "Set oReg = " line. I've copied it directly from all kinds of VBScript sites, with and without the ") _" line breaks and it keeps getting this error. So, it is NOT the syntax of the line (since it works on some computers) The OS is XP on computers it works on and ones it doesn't.
From one site : (
"The Cause of Code 80041002
Your VBScript contains a misspelled object name. Code 80041002 is an unusual Error in that a number is returned rather than 'Syntax Error' or other message.
The Solutions
Check the class definitions in the WMI section of the your script, check for extra letters, plurals can be a particular problem, e.g. system or systemS. Note: The Line: 4 Char: 1 In this case it Char: 1 is not to blame. When none of the line can execute, the error gets charged to the first character."
Which is NOT the case from all research I've done. (no misspellings).
.
So, WHAT is happening?
:O
in scripts on some computers (not others).
here is a snippit
Code:
strPCName = "."
Dim objWMIService, Err, objProcess, strShell, objProgram, searchkey
Dim strDisplayName, strDisplayVersion, strUninstall, strUninstallf
Dim subkey, oReg, arrSubKeys, strKeyPath, NValueName, VValueName, UValueName, intTest, intTest2
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" 'The path in the Registry needed to search
NValueName = "DisplayName"
VValueName = "DisplayVersion"
UValueName = "UninstallString"
' On Error Resume Next
Set oReg = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" _
& strPCName & "\root\default:StdRegProv")
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
searchkey = strKeyPath & "\" & subkey
The error is hitting on the "Set oReg = " line. I've copied it directly from all kinds of VBScript sites, with and without the ") _" line breaks and it keeps getting this error. So, it is NOT the syntax of the line (since it works on some computers) The OS is XP on computers it works on and ones it doesn't.
From one site : (
"The Cause of Code 80041002
Your VBScript contains a misspelled object name. Code 80041002 is an unusual Error in that a number is returned rather than 'Syntax Error' or other message.
The Solutions
Check the class definitions in the WMI section of the your script, check for extra letters, plurals can be a particular problem, e.g. system or systemS. Note: The Line: 4 Char: 1 In this case it Char: 1 is not to blame. When none of the line can execute, the error gets charged to the first character."
Which is NOT the case from all research I've done. (no misspellings).
.
So, WHAT is happening?
:O