Deployment Solution

 View Only
  • 1.  Computername problem with Sysprep image DS 6.9 sp5 mr1

    Posted Oct 07, 2011 04:37 AM

    I updated from DS 6.9 sp4 to sp5 MR1

    When I use existing sysprep images and deploy them to an existing computer (for example PC18075) in de DS there is a problem with it.

    After the job, the computer name is changed to PCXXXXX. This is the name used on a different computer to create the base sysprep image.

    What's wrong?



  • 2.  RE: Computername problem with Sysprep image DS 6.9 sp5 mr1

    Posted Oct 07, 2011 05:20 AM

    I found this, in a KB document:

    When this job is deployed to a target computer, the following occurs:

    a. A custom unattend.xml file is created based on the name and basic configuration of the target computer.

    b. The selected image is deployed to the target computer.

    c. The custom unattend.xml file is copied to C:\Windows\System32\Sysprep\Unattend.xml

    d. The system reboots and the setup process completes unattended with the answers from the custom unattend.xml  

    Step a. I checked, and found this file for the computer in .\eXpress\Deployement Server\Temp with the right computername

    Step b. no problem

    Step c. could be the problem. Maybe the file from the .\eXpress\Deployement Server\Temp is not copied to the target machine? WinPe problem?



  • 3.  RE: Computername problem with Sysprep image DS 6.9 sp5 mr1

    Posted Oct 10, 2011 11:38 AM

    any ideas?



  • 4.  RE: Computername problem with Sysprep image DS 6.9 sp5 mr1

    Posted Oct 12, 2011 03:13 AM

    When I run a script after the image is deployed:

    REM Token Replacement

    copy n:\Temp\%ID%.xml c:\Windows\System32\Sysprep\unattend.xml /Y
    copy n:\Temp\%ID%.xml c:\Windows\Panther\unattend.xml /Y

    (N drive is mapped during generating WinPE bootdisk to eXpress share)

    It's working fine...but this is just a workaround...why is it normally failing?



  • 5.  RE: Computername problem with Sysprep image DS 6.9 sp5 mr1

    Posted Nov 02, 2011 11:06 PM

    I've generally found the "Scripted OS Install" process to be a little clumsy and not all that useful when wanting your own naming convention or customisations. I tend to SYSPREP my master computer without supplying an unattend XML, then use a "Run Script" job (I guess you could use a Copy File) to push that into the "Panther" folder. That is a default location where Windows looks for configuration files, so it picks it up perfectly. I generated my XML in SIM, then customise it per-computer with ReplaceTokens and custom data sources. Much more reliable.



  • 6.  RE: Computername problem with Sysprep image DS 6.9 sp5 mr1

    Posted Nov 02, 2011 11:20 PM

    You can easily run a .vbs to prompt you to enter a computer name, which is then picked up by the PECT Agent and passed to the console for unknown computers.  For existing computers, you can use the existing name.  The .vbs can be customized to check for compliance against a naming convention.  That requires user input at the computer, but if that's the desired input, it works.



  • 7.  RE: Computername problem with Sysprep image DS 6.9 sp5 mr1

    Posted Nov 03, 2011 03:46 AM

    when I exclude c:\Windows\Panther\unattend.xml in the sysprep image...it all works fine...

    so no extra script needed for token replacement



  • 8.  RE: Computername problem with Sysprep image DS 6.9 sp5 mr1

    Posted Mar 09, 2012 10:47 AM

    McLemson, I need to run a script on the initial deployment menu that prompts for computer name and passes that info to console so when PC is managed, the computer name is stored and we do not have to rely on predefined computers. You seem to know that this is possible, do you have a copy of this script avaialble? Also, do you have to specify domain and credentials with this method or will it still pull this info by pushing system configuration?

     

    Thanks for your help



  • 9.  RE: Computername problem with Sysprep image DS 6.9 sp5 mr1

    Posted Mar 16, 2012 05:50 PM

    PXE booting doesn't work well in our environment and so we choose to boot from flash drive to configure a new pc.  Computer name is typed in before imaging and then injected after imaging so you can boot, type the name, and leave.  The computer then joins the domain, auto logs on, and then runs a runonce script that is defined in the unattend.xml file.  You could probably adopt this to work with the initial deployment wizard as well even though it's probably more complicated than you need.  It also assumes that you have some drives mapped to the UNC path containing the images and the ds management share where you have the unattend.xml file you want to inject. 

    Save the following code as "imageMenu.hta" and tell your console to run imagemenu.hta just like you would an exe file.  If you have included hta support in your pxe boot image, it should start up right away.  It supports both ghost and redploy images.  New images must be added in two places, find them both.

    There is also a command to run DISM to inject drivers from a folder that is named the same as the computer model.  I highly recommend that process for Windows 7 over deploy anywhere for Windows 7 hardware independant imaging.  Just fix the root path and make sure your driver store has all the raw inf driver files in it as it will search it recursively.  PM me if you want to learn more about the full flash drive boot process which has several more options on it for XP, 7, and scripted isntallations from a Win7 source disk.

     <HTML>
     <HEAD>
        <TITLE>Welcome to Microsoft Windows PE</TITLE>
        <HTA:APPLICATION
            ID="imageMenu"
     WINDOWSTATE="maximize"
     BORDER="none"
     INNERBORDER="no"
     SHOWINTASKBAR="no"
     SCROLL="no"
     APPLICATIONNAME="Windows PE Wizard"
     NAVIGABLE="yes">
    
    <SCRIPT LANGUAGE="VBScript">
    
    sub addOption (path, title)
    dim opt : set opt = document.createelement("option")
    opt.value = path
    opt.text = title
    Image_cb.add opt
    set opt = nothing
    end sub
    
    Sub CheckKey()
    Dim TheKey
    TheKey = window.event.keyCode
    if TheKey = 13 then
      BeginImaging
    end if
    End Sub
    
    Function LookupImageOptions()
    
    FOR i= 0 to Image_cb.length
    Image_cb.remove 0
    NEXT
    
    'List of images also goes here.  Ghost, Rdeploy, and Wim supported
    'xml files for wim installation must be put in the "orignalDVD" folder in the images folder
    '----------------------------------------------------------------------------
    '----------------------------------------------------------------------------
    SELECT CASE Level_cb.value
      Case "District"
       addOption "I:\Images\Win7x32\District\DM_12-22-2011\WIN7_DM_12_22_2011.img","District Master 12-22-2011"
      addOption "I:\Images\Win7x32\District\PlainVanillaTest\PlainVanillaTest.gho","PlainVanillaTest"
      addOption "PlainVanilla.xml","Plain Vanilla For Image Creation" 
     Case "HighSchool"
      
     Case "MiddleSchool"
      
      Case "Elementary"
       
    END SELECT
    END FUNCTION
    
    FUNCTION BeginImaging()
    
    IF Level_cb.value = "None" THEN
      MsgBox("You must choose a Model")
      Exit Function
    END IF
    IF Image_cb.value = "None" THEN
      MsgBox("You must choose an Image")
      Exit Function
    END IF
    IF ComputerName.value = "" then
      MsgBox("You must enter the new computer's name")
      Exit Function
    END IF
    
    SET WSHShell = CreateObject("WScript.Shell")
      'cleans the hard drive to remove corrupt or vendor partitions then create's a c drive of the correct size.
      WSHShell.Run "cmd /c copy /Y I:\automation\NewPCDiskPart.txt x:\NewPCDiskPart.txt",,True
      rc = WSHShell.Run ("diskpart /s x:\NewPCDiskPart.txt",,True)
      if rc <> 0 then
        MsgBox ("diskpart failed to clean and partition the disk, reboot into PE and try again")
     Exit Function
      end if
     
     
    extension = LCase(Right(Image_cb.value,3)) 
     
    SELECT CASE extension
      Case "gho" 'image is in ghost format
      rc = WSHShell.Run ("X:\Progra~2\ghost\ghost32.exe -clone,mode=restore,src=" & Image_cb.value & ",dst=1 -sure -batch -assign=*",,True)
     
     'check for ghost errors
     if rc <> 0 then 
        Dim objFSO, strTextFile, strData, strLine, arrLines
        CONST ForReading = 1
        strTextFile = "x:\windows\system32\ghosterr.txt"
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        strData = objFSO.OpenTextFile(strTextFile,ForReading).ReadAll
        arrLines = Split(strData,vbCrLf)
        MsgBox("Ghost " & arrLines(1) & ", " & arrLines(2) & "  " & arrLines(3))
        MsgBox("Command Given: " & "X:\Progra~2\Ghost\ghost32.exe -clone,mode=restore,src=" & Image_cb.value & ",dst=1 -sure -batch -assign=*")
       Exit Function
     end if
     
     'wait 10 seconds
     WSHShell.Run "ping -n 10 127.0.0.1",,True
     
     'check for C drive
     set filesys=CreateObject("Scripting.FileSystemObject")
        If Not filesys.FolderExists("c:\windows") Then
          MsgBox("C drive not accessable, scripts cannot run.  Reboot to flash drive and run the inject Sysprep task." & rc)
          Exit Function
        end if
     
     'copy unattend.xml
     rc = WSHShell.Run ("cmd /c copy /y I:\automation\sysprepcfgs\Win7CommitteeSysprepDomainJoin.xml c:\windows\panther\unattend.xml" ,,True)
     if rc <> 0 then
       msgbox("Cannot copy unattend.xml: " & rc)
       Exit Function
     end if
     
     'replace computer name inside unattend.xml
     rc = WSHShell.Run ("X:\searchandreplace c:\windows\panther\unattend.xml <ComputerName>* <ComputerName>" & ComputerName.value,,True)
     if rc <> 1 then
       msgbox("computer name couldn't be injected into unattend.xml: " & rc)
       Exit Function
     end if
     
     'inject drivers and reboot
     rc = WSHShell.Run ("cscript I:\automation\driverinjection.vbs",,True)
     if rc <> 0 then
      msgbox("driver injection failed with error: " & rc)
      Exit Function
     end if
     WSHShell.Run "shutdown -r -t 00",,True
     
     'verify that computer name is found in unattend.xml
     rc = WSHShell.Run("find /C " & ComputerName.value & " c:\windows\panther\unattend.xml",,True)
      if rc <> 0 then
      msgbox("The computer's name could not be read from unattend.xml.  Reinject sysprep after rebooting to flash drive")
        Exit Function
     end if
    
     
    Case "img" 'image is in Rdeploy format 
     rc = WSHShell.Run ("X:\Progra~2\Rdeploy\rdeployt.exe -noprompt -rescan -md -f" & Image_cb.value,,True)
     
     'check for rdeploy errors
     if rc <> 0 then
        msgbox("Rdeploy failed with error: " & rc)
      Exit Function
      end if
     
     'wait 10 seconds
     WSHShell.Run "ping -n 10 127.0.0.1",,True
     
     'check for C drive
     set filesys=CreateObject("Scripting.FileSystemObject")
        If Not filesys.FolderExists("c:\windows") Then
          MsgBox("C drive not accessable, scripts cannot run.  Reboot to flash drive and run the inject Sysprep task." & rc)
          Exit Function
        end if
     
     'copy unattend.xml
     rc = WSHShell.Run ("cmd /c copy /y I:\automation\sysprepcfgs\Win7CommitteeSysprepDomainJoin.xml c:\windows\panther\unattend.xml" ,,True)
     if rc <> 0 then
       msgbox("Cannot copy unattend.xml: " & rc)
       Exit Function
     end if
     
     'replace computer name inside unattend.xml
     rc = WSHShell.Run ("X:\searchandreplace c:\windows\panther\unattend.xml <ComputerName>* <ComputerName>" & ComputerName.value,,True)
     if rc <> 1 then
       msgbox("computer name couldn't be injected into unattend.xml: " & rc)
       Exit Function
     end if
     
     'inject drivers and reboot
     rc = WSHShell.Run ("cscript I:\automation\driverinjection.vbs",,True)
     if rc <> 0 then
      msgbox("driver injection failed with error: " & rc)
      Exit Function
     end if
     WSHShell.Run "shutdown -r -t 00",,True
     
     'verify that computer name is found in unattend.xml
     rc = WSHShell.Run("find /C " & ComputerName.value & " c:\windows\panther\unattend.xml",,True)
      if rc <> 0 then
      msgbox("The computer's name could not be read from unattend.xml.  Reinject sysprep after rebooting to flash drive")
        Exit Function
     end if
     
    Case "xml" 'image is in WIM format
     'determine if WinPE is 32bit or 64bit
     strComputer = "."
     Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
     Set colItems = objWMIService.ExecQuery( _
        "SELECT * FROM Win32_OperatingSystem",,48)
     For Each objItem in colItems
        OSbit = objItem.OSArchitecture
     Next
     
     If inStr(image_cb.value,"64") = 0 then  'if 64 is not found in the name of the xml file, this must be for a 32bit image
      If OSbit <> "32-bit" Then 'if WinPE is not 32bit, error as this is a 32bit WIM image.
       msgbox("You cannot use a 32bit wim image from WinPE 64bit.  Change your flash drive's boot.wim file to be the 32bit version.")
       Exit Function
      End If
     Else 'This is a 64bit Wim Image
       If OSbit = "32-bit" Then 'if WinPE is 32bit, error as this is a 64bit WIM image.
       msgbox("Not supported yet")
       Exit Function
      End If
     End If
     
     'copy the unattendxml file to temp location x:\
     SET WSHShell = CreateObject("WScript.Shell")
     WSHShell.Run "cmd /c copy /Y I:\images\win7x32\district\OriginalDVD\" & image_cb.value & " x:\unattendD204.xml",,True
     if rc <> 0 then
       msgbox ("I:\images\win7x32\district\OriginalDVD\" & image_cb.value & " failed to copy")
       Exit Function
     end if
     
     'replace the computer's name in unattend.xml on the X drive
     rc = WSHShell.Run ("X:\searchandreplace x:\unattendD204.xml <ComputerName>* <ComputerName>" & ComputerName.value,,True)
     if rc <> 1 then
       msgbox ("failed to inject computer name: " & rc)
       Exit Function
     End If
     
     'begin windows setup and use the customized xml file.
     WSHSHELL.Run "I:\Images\Win7x32\District\OriginalDVD\setup.exe /unattend:X:\unattendD204.xml",,True
    End Select
    
    SET WSHShell = NOTHING
    END FUNCTION
    
    </script>
    
     </HEAD>
    <BODY BGCOLOR="black" Text="white" onload="ComputerName.focus()" onkeydown="CheckKey()">
    
    <center>
    <div style="position:absolute;left:300; top:200; width:400;">
    
    <fieldset>
    <legend>Windows 7 32bit Images</legend> 
    Computer Name: &nbsp;&nbsp;&nbsp;&nbsp;<input name="ComputerName" type="text" maxlength="15" style="width: 220px; height: 22px"><BR><BR>
      <select name="Level_cb" style="width: 150px" onChange="LookupImageOptions"> 
        <option value="District">District Images</option>
      <option value="HighSchool">HighSchool Images</option>
      <option value="MiddleSchool">MiddleSchool Images</option>
      <option value="Elementary">Elementary Images</option>
      </select> 
     
      <select name="Image_cb" size=1 style="width: 200px">
     
     'Relist district images in this section.  Do not list images for other levels.
     'xml files for wim installation must be put in the "orignalDVD" folder in the images folder
     '----------------------------------------------------------------------------
     '----------------------------------------------------------------------------
     <option value="I:\Images\Win7x32\District\DM_12-22-2011\WIN7_DM_12_22_2011.img">District Master 12-22-2011</option>
     <option value="I:\Images\Win7x32\District\PlainVanillaTest\PlainVanillaTest.gho">Plain Vanilla Test</option>
     <option value="PlainVanilla.xml">Plain Vanilla for Image Creation</option>
       
      </select><BR><BR>
      
      <input id=runbutton style="width: 1.2in" type="button" value="Begin Imaging" name="BeginImagingBtn" onClick="BeginImaging" tabindex="1"> &nbsp;
      <BUTTON ACCESSKEY="B" STYLE="font-face:Tahoma;font-size:13px;width: 1.2in;" onclick="self.close()"><U>B</U>ack</BUTTON> 
      
     
    </fieldset>
    </div>