Link to home
Start Free TrialLog in
Avatar of djd23
djd23

asked on

Windows Script Host 80041002 error when running a VBS login script

Hey all,

I have deployed a log on script that runs a VBS script. This runs ok on around 30 TS servers, but it comes up with a 80041002 error on 2 of the servers. They are all Windows 2003 SP2 servers running Citrix.

The error shown is

Line: 4
Char: 1
Error: 0x80041002
Code: 80041002
Source: (Null)


The allow.vbs script is -

Const HKEY_CURRENT_USER = &H80000001

strComputer = "."
Set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")

strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" _
    & "ZoneMap\domains\internal.uk\testmail.ad"
objReg.CreateKey HKEY_CURRENT_USER,strKeyPath

strValueName = "https"
dwValue = 2
objReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue

I have no idea what to look for and how to fix this for the two servers that are being affected.
Avatar of rlandquist
rlandquist
Flag of United States of America image

What OS and SP are the servers that it works on?
Avatar of djd23
djd23

ASKER

Windows 2003 SP2 as well, they should all be the same OS (version & patch level)
There have been a few times I have seen computers have issues with the strComputer = ".", so here is a different way to get the computer name.  Try this and let me know if it works any better.
Const HKEY_CURRENT_USER = &H80000001

Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName

Set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")

strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" _
& "ZoneMap\domains\internal.uk\testmail.ad"
objReg.CreateKey HKEY_CURRENT_USER, strKeyPath

strValueName = "https"
dwValue = 2
objReg.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue

Open in new window

Avatar of jkr
The error code seems to be WBEM_E_NOT_FOUND - can you check whether the registry key in question exists on the machines where the script fails?
ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of djd23

ASKER

Cheers, will give the above a try today.
The other servers run Citrix and are in the same OU, so have the same group Policies applied.

Avatar of djd23

ASKER

rlandquist: I get the same error but on line 6 when running your script.
jkr: The key should exist, if nto I would like it created?
RobSampson: This seemed to have done the trick - man thanks
Great. Thanks for the grade.

Regards,

Rob.