We help IT Professionals succeed at work.
Get Started

Object not a collection error when running VBScript at login

3,684 Views
Last Modified: 2013-11-25
I'm trying to run this VBScript through kix for Citrix login script. The VBScript runs fine when I run it manually after user has logged into the Citrix. However I want it to run by kix calling the vbscript. It calls fine but it doesn't seem to run too well at the moment.

VBScript forces changes of the timezone for citrix user

The error message I get is

AEDT.vbs(29, 1) Microsoft VBScript runtime error: Object not a collection

AEDT.vbs is the vbscript file I'm running from kix command


Const HKEY_CLASSES_ROOT   = &H80000000
Const HKEY_CURRENT_USER   = &H80000001
Const HKEY_LOCAL_MACHINE  = &H80000002
Const HKEY_USERS          = &H80000003
 
Const REG_SZ        = 1
Const REG_EXPAND_SZ = 2
Const REG_BINARY    = 3
Const REG_DWORD     = 4
Const REG_MULTI_SZ  = 7
 
uBinary = Array(&Ha8,&Hfd,&Hff,&Hff,&H00,&H00,&H00,&H00,&Hc4,&Hff,&Hff,&Hff,&H00,&H00,&H04,&H00,&H00,&H00,&H01,&H00,&H03,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H0a,&H00,&H00,&H00,&H01,&H00,&H02,&H00,&H00,&H00,&H00,&H00,&H00,&H00)
 
' Chose computer name, registry tree and key path
'
strComputer = "." ' Use . for current machine
hDefKey = HKEY_CURRENT_USER
strKeyPath = "Software\Citrix\SessionTimeZone\"
 
' Connect to registry provider on target machine with current user
'
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
 
' Enum the subkeys of the key path we've chosen
'
oReg.EnumKey hDefKey, strKeyPath, arrSubKeys
 
For Each strSubkey In arrSubKeys
 
  strKeyPath = strKeyPath + strSubkey
  
oReg.SetStringValue hDefKey, strKeyPath, "Display", "AUS Eastern Standard Time"
oReg.SetStringValue hDefKey, strKeyPath, "Dlt", "AUS Eastern Daylight Time"
oReg.SetBinaryValue hDefKey, strKeyPath, "TZI", uBinary
oReg.SetDWORDValue hDefKey, strKeyPath, "UseRegTimeZone", "00000001"
 
Next

Open in new window

Comment
Watch Question
Client Technology Manager
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 47 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE