11 Replies Latest reply on Jun 15, 2012 8:05 AM by manc01

    Activating Windows 7 via unattend.xml

    Apprentice

      Hi,

       

      I now have successfully imaged a Win 7 machine using ImageW and OSD. However, although the MAK key was specified in the unattend.xml,

       

      <ProductKey>xxxxx-xxxxx-xxxxx-xxxxx-xxxxx</ProductKey>

       

      The image deploys fine and logs on as administrator (with Internet access), but Windows does not activate.

       

      Does anyone know if there is a way around this?

       

      Thanks

       

      Steve

        • 1. Re: Activating Windows 7 via unattend.xml
          Specialist

          You need to add this line one of your first run once command  in the xml

           

          cscript c:\windows\system32\slmgr.vbs /ato

          • 2. Re: Activating Windows 7 via unattend.xml
            Rookie

            Sorry drag up old thread, but i just opened my xml file to edit and it looks like this:

             

            <?xml version="1.0" encoding="utf-8"?>

            <unattend>

              <settings pass="auditSystem">

                <component name="Microsoft-Windows-PnpCustomizationsNonWinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

                  <DriverPaths>

                    <PathAndCredentials wcm:keyValue="1" wcm:action="add">

                      <Path>c:\windows\LDDriverStore</Path>

             

            Where would this csrcipt command go?

            • 3. Re: Activating Windows 7 via unattend.xml
              Rookie

              I would like to know where this command needs to be entered into the XML file too.

               

              Thanks

              • 4. Re: Activating Windows 7 via unattend.xml
                Apprentice

                In my XML the Audit system pass is the very first pass of the XML

                 

                <?xml version="1.0" encoding="utf-8" ?>

                - <unattend>

                - <settings pass="auditSystem">

                - <component name="Microsoft-Windows-PnpCustomizationsNonWinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

                - <DriverPaths>

                - <PathAndCredentials wcm:keyValue="1" wcm:action="add">

                <Path>c:\windows\LDDriverStore</Path>

                </PathAndCredentials>

                </DriverPaths>

                </component>

                - <component name="Microsoft-Windows-Shell-Setup" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" processorArchitecture="x86">

                - <UserAccounts>

                - <AdministratorPassword>

                <PlainText>true</PlainText>

                <Value>%AdminPass%</Value>

                </AdministratorPassword>

                </UserAccounts>

                - <AutoLogon>

                <Enabled>true</Enabled>

                <Username>Administrator</Username>

                - <Password>

                <PlainText>true</PlainText>

                <Value>%AdminPass%</Value>

                </Password>

                <LogonCount>1</LogonCount>

                </AutoLogon>

                </component>

                </settings>

                • 5. Re: Activating Windows 7 via unattend.xml
                  Rookie

                  Bump.. anyone help?

                  • 6. Re: Activating Windows 7 via unattend.xml
                    EMiranda Expert

                    manc01 wrote:

                     

                    Sorry drag up old thread, but i just opened my xml file to edit and it looks like this:

                     

                    Where would this csrcipt command go?

                     

                    for Sysprep you can choose 1 of 3 locations, it just depends on when you want to run it:

                     

                    1. Specialize Pass -  Microsoft-Windows-Deployment | RunSynchronous  (If you place it here, it will try to activate it before logging into windows for the first time and still in "black screen" in sysprep

                    Reference - http://technet.microsoft.com/en-us/library/ff716159

                     

                    2. OoobeSystem Pass - Microsoft-Windows-Shell-Setup | FirstLogonCommands (If you place it here, it will launch activation during the first time logging into the system)

                    Reference - http://technet.microsoft.com/en-us/library/ff715886

                     

                    3. Using SetupComplete.cmd - Create the following folder directory and script file - C:\Windows\Setup\Scripts\SetupComplete.cmd and add the script inside the .cmd file.  Sysprep will check this file and run anything inside it (These commands are run after setup completes but before unattend executes any synchronous or asynchronous FirstLogonCommands.)

                    Referece - http://technet.microsoft.com/en-us/library/cc766314(v=ws.10).aspx

                     

                     

                    Hope this helps

                    • 7. Re: Activating Windows 7 via unattend.xml
                      Rookie

                      I normally just edit the xml file on notepad editor, afriad don't know much about xml stuff, so if i want it to run at firstlogoncommands do i just add the line

                      cscript c:\windows\system32\slmgr.vbs /ato

                       

                      currently it looks like this.

                       

                      <FirstLogonCommands>

                              <SynchronousCommand>

                                <CommandLine>c:\ldsleep.exe 30</CommandLine>

                                <Description></Description>

                                <Order>1</Order>

                              </SynchronousCommand>

                              <SynchronousCommand>

                                <CommandLine>cmd /q /c del /q c:\ldsleep.exe</CommandLine>

                                <Description></Description>

                                <Order>2</Order>

                              </SynchronousCommand>

                              <SynchronousCommand>

                                 etc...........

                      • 8. Re: Activating Windows 7 via unattend.xml
                        EMiranda Expert

                        yes, you can do that by adding another line like this

                         

                        <SynchronousCommand> 

                        <CommandLine>cscript c:\windows\system32\slmgr.vbs /ato</CommandLine>

                        <Description></Description>

                        <Order>3</Order>

                        </SynchronousCommand>

                         

                        you can also download Windows System Image Manager (WSIM) which gives you full control of the sysprep in a nice GUI

                        • 9. Re: Activating Windows 7 via unattend.xml
                          Rookie

                          Thanks, but no luck, i dont have KMS server, just using MAK key woudl that be why?

                          • 10. Re: Activating Windows 7 via unattend.xml
                            EMiranda Expert

                            you would have to add a line before hand to put in your MAK key, unless you are hardcoding your MAK key in your sysprep

                             

                            that would be cscript c:\windows\system32\slmgr.vbs /ipk product_key

                            • 11. Re: Activating Windows 7 via unattend.xml
                              Rookie

                              Still no luck. I put the key in the xml file

                               

                              - <settings pass="generalize">

                              - <component name="Microsoft-Windows-PnpSysprep" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

                                <PersistAllDeviceInstalls>true</PersistAllDeviceInstalls>

                                </component>

                                </settings>

                              - <settings pass="oobeSystem">

                              - <component name="Microsoft-Windows-Shell-Setup" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" processorArchitecture="x86">

                              - <OOBE>

                                <HideEULAPage>true</HideEULAPage>

                                <ProtectYourPC>1</ProtectYourPC>

                                <SkipMachineOOBE>true</SkipMachineOOBE>

                                <SkipUserOOBE>true</SkipUserOOBE>

                                </OOBE>

                                <ProductKey>***********************</ProductKey>

                                <RegisteredOwner>*****</RegisteredOwner>

                                <RegisteredOrganization>******</RegisteredOrganization>

                                <TimeZone>GMT Standard Time</TimeZone>

                              - <UserAccounts>