Question

I have a Task Sequence that we are using to install different operating systems and software. The task sequence opens an HTA which gives our techs a list of options to choose from, then creates Task Sequence variables based on these choices which are used in the rest of the Task Sequence to determine which steps to run.

The last step that is run is a WriteRegistryImageSettings.vbs which dumps all Task Sequence variables to the registry.

It doesn't work for Windows 7, but it works for XP.

Set env = CreateObject("Microsoft.SMS.TSEnvironment")
Set objShell = CreateObject("WScript.Shell")
strKeyPath = "HKEY_LOCAL_MACHINE\SYSTEM\Image Settings\"
For Each var In env.GetVariables
    If Left(var,3) = "OSD" Then 
        objShell.RegWrite strKeyPath & var,env(var),"REG_SZ"
    End If
Next

I'm also logging this script by writing to a text file, and here's the last line of the script:

objLog.WriteLine "Final Result: " & Err.Number & " " & Err.Description

This is the result in the log: Final Result: 451 Object not a collection

Again, this works for Windows XP. Any ideas why it doesn't work for Windows 7 images?

(I'm actually passing a variable to the script that is getting written earlier, and this works for Windows 7. The command line for the script is WriteRegistryImageSettings.vbs %OSDType%. The code for this (occurring earlier in the script) is:

Err.Clear
objLog.WriteLine "Attempting to write strImageType: """ & strImageType & """"
objShell.RegWrite strKeyPath & "ImageType",strImageType,"REG_SZ"
objLog.WriteLine "Result is " & Err.Number & " " & Err.Description

The log file shows an error code of 0 for this step, and the registry setting is populated.)

Was it helpful?

Solution

I fixed it by unchecking "Enable 64bit file redirection" for the task sequence step.

I can't believe I didn't try that earlier!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top