none
Having trouble getting script to run on a custom pane

    Question

  • I'm trying to create a custom pane to perform an offline user data that only copies certain files to a network share. I wrote an .HTA that does this exactly as I had planned, but trying to implement this into MDT as part of Task Sequence step is proving to be difficult.

    I downloaded the Wizard Editor for MDT 2012 Update 1. I have the pane created as I want it, but for some reason I just can't get the script to run. When I do a test run from the Wizard Editor, I get the following error:

     

    This error doesn't help me much because I don't know where the object is required. Here are my XML and VBScript files for the custom pane.

    XML

    <Wizard>
      <Global>
        <CustomScript>DeployWiz_OfflineUserData.vbs</CustomScript>
      </Global>
      <Pane id="OfflineUserDataCapture" title="Move Data and Settings">
        <Body><![CDATA[<H1>Move data and settings?</H1>
    <table width="100%"
      <tr>
      <td>
       <input type="Listbox" size="6" name="UserProfilesListBox" id="UserProfilesListBox" language=vbscript onchange="GetProfiles">
      </td>
      <td>
       <Label class="Larger" for=UserProfilesListBox language=vbscript >Choose the profile you would like to back up.</Label>
      </td>
     </tr>
     <tr> 
      <tr>
       <td colspan=2>&nbsp;</td>
      </tr>
      <td>
      </td>
      <td>
       <p>This will copy the user's Favorites, pictures and documents
       from the desktop to a Network Share. After the computer has been
       imaged, the user's Favorites, pictures and documents will be
       put back where they were found.</p>
       </td> 
     </tr>
    </table>

    ]]></Body>
        <HideBackNext>false</HideBackNext>
      </Pane>
    </Wizard>

    VBScript

    Option Explicit

    Function GetProfiles
     Dim strPath, objFSO, objFolder, colFiles, objFile, objOption, a, objSub
     Dim objSubFolder, colSubFolder, strSelected, wscript, strTarget2
     Dim objItem, strFolder1, strTarget, strDirectory, arrExt, strSource, SubFolder
     Dim UserProfilesListBox

     Set objFSO = CreateObject("Scripting.FileSystemObject")
     strTarget = "\\tsc116\USMTData$\"
      strPath = "C:\Users\"
     arrExt=Array(".txt",".jpg",".doc","docx",".xls","xlsx",".pdf",".ppt","pptx",".bmp")
      Set objFolder = objFSO.GetFolder(strPath)
     Set colSubFolder = objFolder.SubFolders
     For Each objSubFolder in colSubFolder
      Set objOption = Document.CreateElement("OPTION")
      objOption.text = objSubFolder.Name
      objOption.Value = objSubFolder.Name
      UserProfilesListBox.Add(objOption)
     Next
     

     strFolder1 = "\Favorites"
      For Each objItem in UserProfilesListBox.Options
       If objItem.Selected Then
        strSelected = strSelected & objItem.Value
        strDirectory = (strPath & strSelected & strFolder1)
         If NOT objFSO.FolderExists (strTarget & strSelected) = True Then
          objFSO.CreateFolder(strTarget & strSelected)
         End If
         objFSO.CopyFolder strDirectory, (strTarget & strSelected & "\Favorites"), True
        End If
       Next
     
     strSource = strPath & strSelected & "\Desktop\"
     strTarget2 = strTarget & strSelected & "\Desktop\"
     
     Set objFolder = objFSO.GetFolder(strSource)
     Set colFiles = objFolder.Files
     If Not objFSO.FolderExists(strTarget2) = True Then
     objFSO.CreateFolder(strTarget2)
     End If
     For a=0 to ubound(arrExt)
     For Each objFile in colFiles
      
      If Right(objFile,4)=arrExt(a) Then
        objFSO.CopyFile objFile, strTarget2
      End If
     Next
     Next
     set colFiles=nothing
     set objFolder=nothing
     
     For Each Subfolder in Folder.SubFolders
      objSub = strTarget2 & Subfolder.Name & "\"
      Set objFolder = objFSO.GetFolder(Subfolder)
      Set colFiles = objFolder.Files
      
      If Not objFSO.FolderExists(objSub) = True Then
       objFSO.CreateFolder(objSub)
      End If
            For a=0 to ubound(arrExt)
         For Each objFile in colFiles
          If Right(objFile,4)=arrExt(a) Then
          objFSO.CopyFile objFile, objSub
          End If
         Next
        Next
      strTarget2 = objSub
            ShowSubFolders Subfolder
     Next
     Set strTarget2 = NOTHING
    End Function

    This VBS code varies some from the HTA code that I originally wrote. But, I just don't know where to go from here. In in the Wizard Editor, I have the vbscript under the Global pane being listed as a CustomScript as in the pic below.

    As for the OfflineUserDataCapture Pane, I don't have anything listed for Initialization or Validation. I don't think I need them, but I'm not entirely sure either. I don't think this is causing my error, but I just don't know.

    I need to use this custom pane because I only need to copy files for a certain profile from certain computers. I don't know what that profile is going to be which is why I'm trying to get the custom pane to show a List Box of the existing profile folders listed under C:\Users (the drive letter might change in MDT, but right now this is early testing phase).

    I've read a lot of posts about creating custom panes and I think I understand the concept and how things should work, but obviously I'm missing something. If anyone can help or point me in the right direction, I would greatly appreciate it. If there is something I'm not showing that you need to see, I can post it. I just wish I knew more to give back and help others.

    ~Mike

    Sunday, May 12, 2013 2:25 AM