none
Help with custom code in ZTIGather.wsf RRS feed

  • Question

  • To pick up WMI "version" info to deal with Lenovo computer models I found this code and integrated it by adding these lines to ZTIGather.wsf:

    ABout line 542:

    oEnvironment.Item("LenovoModel") = sLenovoModel

    About line 383

    '/////////////////////////////////////////
            ' Get the Lenovo Model Version from the Win32_ComputerSystemProduct class
            ' Siva Mulpuru | 10:30 PM Monday, February 14, 2011        
            Set objResults = objWMI.ExecQuery("select * from Win32_ComputerSystemProduct")
            For Each objInstance In objResults
                sLenovoModel = objInstance.Version
            Next
            if sLenovoModel = "" then
                oLogging.CreateEntry "Unable to determine LenovoModel tag via WMI.", LogTypeInfo
            End if
    '///////////////////////////////////////////

    The code works as intended, and appears to present no problems when imaging from a USB stick, however, when running a standalone image media or trying to launch the wizard from LiteTouch.wsf, the wizard starts and hangs on the initialization step.

    If I remove the additional code from ZTIgather.wsf the issue disappears. Looking at the code, does anyone have any ideas?

    sd

    Thursday, June 5, 2014 4:48 PM

All replies

  • To pick up WMI "version" info to deal with Lenovo computer models I found this code and integrated it by adding these lines to ZTIGather.wsf:

    ABout line 542:

    oEnvironment.Item("LenovoModel") = sLenovoModel

    About line 383

    '/////////////////////////////////////////
            ' Get the Lenovo Model Version from the Win32_ComputerSystemProduct class
            ' Siva Mulpuru | 10:30 PM Monday, February 14, 2011        
            Set objResults = objWMI.ExecQuery("select * from Win32_ComputerSystemProduct")
            For Each objInstance In objResults
                sLenovoModel = objInstance.Version
            Next
            if sLenovoModel = "" then
                oLogging.CreateEntry "Unable to determine LenovoModel tag via WMI.", LogTypeInfo
            End if
    '///////////////////////////////////////////

    The code works as intended, and appears to present no problems when imaging from a USB stick, however, when running a standalone image media or trying to launch the wizard from LiteTouch.wsf, the wizard starts and hangs on the initialization step.

    If I remove the additional code from ZTIgather.wsf the issue disappears. Looking at the code, does anyone have any ideas?

    sd

    Editing post...

    So at first I was just using the downloaded copy from the site where I got the code and realized that the ZTIGather.wsf versions were different.

    Just editing the correct version of the file gets passed the above, but then it hangs on "Getting local computer information: Asset Information" I know its choking on the code somehow as the WMI function referenced in my original message comes right after getting the asset info.

    Thursday, June 5, 2014 5:25 PM
  • I *really* don't recommend editing any of the built-in scripts.  This makes things a pain to be sure in case of disaster, rebuild, or server replacement.

    I would use Mikael Nystrom's script from his website deploymentbunny.com.

    You may have to edit for some of the newer models, but the basis of the code is there.  This is much easier than having to put a WMI query and troubleshooting a section of code that could be 500+ lines vs the custom script that is only referencing your specific Lenovo models.

    Tuesday, June 10, 2014 4:44 AM
  • SD, 

    I found this answer today....

    replace the "objwmi.execquery" to "objWMI.InstancesOf"

    Try that and let us know.

    Tuesday, April 12, 2016 5:17 PM