Friday, January 29, 2016

Deploying Winclone Image Packages with DeployStudio

Background: 

As of DeployStudio version 1.7.2 it is not possible to create and deploy an image of Windows 10 on a Bootcamp partition. Due to this issue we purchased licenses of Winclone so that we can still deploy dual boot systems at Dickinson College. Winclone images have a few options which potentially make them a better solution for deploying Windows on Apple hardware so overall this isn't a bad decision in the long term. DeployStudio is capable of distributing Winclone images but the process is a little different. This documentation will serve as a guide to creating a workflow that images an Apple device with a dual boot setup using Winclone to create the Windows image for the Bootcamp partition. You will need a licensed copy of Winclone to complete this procedure.

I created a few scripts to help automate the imaging process. They are available on my GitHub repository:

Preparing a Mac Image: 

The process for preparing a MacOS image for a dual boot setup is not any different from before. Setup your image as desired and upload it to DeployStudio as you normally would. 

Preparing the Windows system: 

  1. Launch the Bootcamp assistant and use the wizard to create a Bootcamp partition.  Note: You will need a disk image of Windows 10. The size of the Bootcamp partition needs to be large enough to accommodate Windows and any applications you want to install. Winclone will be able to shrink the partition to a smaller footprint and also create a larger or smaller partition for restoration. 
  1. The computer should restart and proceed with installing Windows. Remember that you need to format the Bootcamp partition in order to select it and install the OS. 
  1. After installation is complete the Bootcamp installer should launch. Note: I have seen an issue with the RealTek audio drivers failing to install. If the Bootcamp installer stalls for a long period of time open Task Manager and kill the RealTek setup process. 
  1. Restart after installing the Bootcamp software. 
  1. Configure the computer as required with applications and settings.  
  1. Winclone uses text in c:\windows\system32\license.rtf to determine the operating system when creating an image. Check the file to make sure it contains "Windows 10". In my experience the Enterprise version does not have the text and it needs to be added. 
  1. Perform a sysprep on the computer. I have created a basic unattend.xml file that includes examples of several key settings and made it available on GitHub: https://github.com/csteelatgburg/scripts/blob/master/Windows/Win10Unattend.xml 

Creating the Bootcamp image: 

You will need a licensed copy of Winclone for this task. I was using version 5.5 when I wrote these instructions. 
  1. Boot the computer to MacOS. 
  1. Launch Winclone and load your license file if you have not already done so. 
  1. Select the Bootcamp partition. 
  1. In the Tools menu select Shrink Windows (NTFS) Filesystem. 
  1. After shrinking the partition click Save Image and give it a name. 
  1. After the image is saved, select it in the list on the left. 
  1. Click the Make Package button. 
  1. Select the appropriate option for the size of the Bootcamp partition. 
  1. Click Create package and choose a name and location. 

Getting the image to DeployStudio:

Depending on your environment you need to get the package to your DeployStudio server. Place it in the Packages folder of your Images share.

Creating your workflow: 

I have created several scripts that will assist in the automated deployment of Winclone packages. You will need to add these scripts to the workflow for imaging a dual boot computer using a Winclone package. You can download them from my GitHub repository:
These scripts need to be placed on your DeployStudio server in the Scripts folder of your Images share.

  1. Create a new workflow and name it appropriately. 
  1. Add the following tasks 
  1. Partition Target Volume: First Disk available Create one partition using the entire disk named Macintosh HD Check the Automate checkbox. Note: We do not need to create the partition for Windows at this point because the Winclone installer will handle that for us. 
  1. Restore Target Volume: Enter value, Macintosh HD Image: HFS, select the appropriate image for the MacOS partition Check the boxes for the following options: Don't check restoration, Rename ByHost prefs, Delete machine dependent files and caches, Set as default startup volume, Automate 
  1. Generic Select the disable_sip.sh shell script in the Command dropdown Note: The Winclone package can't run with SIP enabled.  You can read more about this on the Twocanoes website.Check the Automate checkbox. 
  1. Configure Target volume: Previous task target Check the boxes for the following options: Rename computer, Automate 
  1. Generic Select the copy_tools_local.sh shell script in the Command dropdown.  Check the Automate checkbox. Note: This copies the DeployStudio scripts to /etc/deploystudio on the Macintosh HD, we will need them after the computer reboots. 
  1. Generic Select the bootcamp_save_name_to_file.sh shell script in the Command dropdown. Check the Automate checkbox. Note: This is a script that I created that saves the computers Bootcamp name from the DeployStudio database in /etc/deploystudio/bootcampname on the Macintosh HD.  Check the Automate checkbox. 
  1. Package Install Target volume: Previous task target Package: Select the Winclone package that you created and placed in the Packages folder on the DeployStudio server. Check the boxes for the following options: Postponed Installation, Automate 
  1. Generic Select the bootcamp_set_name_from_file.sh shell script in the Command dropdown.  Check the Postponed Execution checkbox and select Previous Task Target for the target volume. Parameters: /dev/disk0s3 Note: This is the disk and partition that is typically used for Bootcamp in my configurations. If your partition scheme is different you will have to adjust this value accordingly. Check the Automate checkbox. Note: This script retrieves the computer name from /etc/deploystudio/bootcampname and then searches the Bootcamp partition for an unattend.xml line that contains the <computername>*</computername> directive. It replaces the * with the computer name so that the machine is named correctly after it completes the OOBE stage. 
  1. Add any other tasks for your image (additional software installs, active directory binding, etc.). 
  1. Click Save  

Applying the images to a computer: 

  1. NetBoot the computer to the DeployStudio server. 
  1. If you have not already added the computer to the DeployStudio database then do so now.  
  1. Run the workflow you created. 
  1. DeployStudio will perform the selected tasks. Note that it will copy the Winclone image to the local machine, this may take a long time depending on network speed. 
  1. After the tasks which run in the DeployStudio Runtime complete the computer will restart and then run the postponed tasks, including installing the Winclone package. 
  1. Once all of the postponed tasks are complete the computer will restart. 
  1. Login to MacOS and set the startup volume to the Bootcamp partition.  Note: Before restarting you can verify the naming scripts worked by browsing the Bootcamp partition to c:\windows\panther and checking the unattend.xml file. The <computername> directive should contain the name from the DeployStudio database. 
  1. Restart the computer and allow Windows to complete the sysprep OOBE process. 



34 comments:

cem62793 said...

Can you deploy a package if Windows was never setup?

Chuck Steel said...

I'm not sure what you mean by "if Windows was never setup".

cem62793 said...

I made an image using winclone of window 7, I never went through the setup process for windows, it is still at the setup screen.

Chuck Steel said...

Ideally you should go through setup and then sysprep the machine, but if you haven't gone through it then I'm not sure what will happen. Have you tried it and it failed?

cem62793 said...

Yes, I tried it and it failed. It gets to about 85% of the post install then just keeps restarting the install and failing.

Grendizer said...

Great write up, mine works pretty much like this. Have you ever encountered this?
On reboot holding the Option Key, I am presented with two Macintosh HD along with the Windows. If I select the 2nd Macintosh it loads with the do not enter sign.

Retro Robot said...

Hi, somewhat new to deployment and I was wondering - can I deploy a winclone-captured Windows image not as a .pkg but as just the .winclone file? I used to be able to do this with older versions of DeployStudio/Winclone, but since I've updated my DS setup, I am unable to do so. I work in an environment where we don't always need to deploy both OS X and Windows simultaneously - usually it's just the Boot Camp with Windows. Any information you could provide would be a great help! Thanks!

cem62793 said...

@Retro Robot You can deploy incline images using deploy studio. The workflow I have used restores both OS X and Windows. See - http://twocanoes.com/support/winclone/using-deploystudio-and-winclone-pro-to-image-a-lab-of-dual-boot-macs

Retro Robot said...

@cem62793 Thanks for the info. I've checked that post out and followed those steps already. The issue I'm encountering when attempting to deploy the .winclone image is that deployment hangs on the "waiting for pigz" step and doesn't progress past it.

cem62793 said...

@Retro Robot Are you running the latest version of deploy studio, also what version of the OS is your deploy server running?

Retro Robot said...

@cem62793 I am running DS v1.7.2 on OS X 10.11.3 w/ Server v5.0.15. My DS netboot set was created in this environment as well. Attempting to deploy a Windows 7 image captured with Winclone Pro 4.4 and deployment to a MacBook Retina Mid2012 running OS X 10.11.3.

Chuck Steel said...

The libraries required by pigz aren't included in the DeployStudio Netboot set, so the .winclone image won't deploy. You can read more about the issue here:
http://www.deploystudio.com/Forums/viewtopic.php?id=7518

cem62793 said...

@Retro Robot I have seen many issues when the server is running 10.11.x and is a deploy studio server.

Unknown said...

Hi Chuck,
I use your walkthrough to clone my dual boot macs and it helped me a lot. Thanks.
I have a problem though with my windows computer renaming.

As far as I can see, my Deploystudio database Windows name gets in the /etc/deploystudio/bootcampname file correctly but when I check in my sysprep file before starting Windows, the * string is not replaced with what's in the file and I don't know how to debug this. Nothing special about this in the logs.

Can you help me debug this?
Thanks a lot!

Chuck Steel said...

@mrcil20, when you created the workflow did you include step 2, h? It sounds like the script that sets the computer name isn't running. Make sure that step happens after the Winclone image is deployed.

Unknown said...

Thanks for this. I have followed your directions perfectly but I am getting the error, Cannot bless. Any ideas?

Unknown said...

Hi Chuck,

This is a great write up. I'm hopping to try it on Monday. Can I use this same workflow on a fusion drive? if not any suggestions? I also have run into the same issue as @Grendizer

On reboot holding the Option Key, I am presented with two Macintosh HD along with the Windows. If I select the 2nd Macintosh it boots the same OS has the first Macintosh HD. Grendizer said...

Chuck Steel said...

An update to @mrcil20's comment. It looks like DeployStudio might delete the /etc/deploystudio folder before the bootcamp naming script runs. I'm not sure what would cause that but one solution is to have the scripts copy the tools and bootcampname file to /etc/ds_tools instead of /etc/deploystudio/ds_tools.

I'm not sure if this will work well on a fusion drive, I would recommend checking the WinClone documentation on that front.

I have not seen the two Macintosh HD problem in my environment.

Unknown said...

Thanks for following up,

I did a lot of test and I figured out that the script was not running correctly with blank spaces. Maybe it's the way I copied it from web and saved it. I rewrote most of what I needed in another file and it worked perfectly.

Everything's good for now. Just need to perfect my Windows 10 master image.

Anonymous said...

@Retro Robot I was having same issue with DS 1.7.2 and NBI 10.11.X hanging with my winclone at "waiting for pigz". It's something with 10.11.X NBI. The very instant I netbooted to 10.10.X NBI, it no longer hung at "waiting for pigz"

SCDavis said...

Hey Chuck,
Not sure if interested, but i've been able to get my Win10 image deployed to my new macs (16,2) using KACE. I could give you more info on my process if interested.

I'm wondering if your SIP script permanently disables SIP on the macs. that's one of the main problems we're seeing as we don't want to have to touch all our macs.

-Steve

Chuck Steel said...

Thanks, @SCDavis. I would be interested in seeing what you've done. Perhaps you can post it on ITNinja for others to see?

Yes, my process does leave SIP disabled. You could enable it by booting into the DeployStudio runtime again and running the appropriate commands, but since I can't easily automate that part I made the decision to leave it disabled. There are ways to automate that entire process but I'm just being lazy at this point.

SCDavis said...

I'm sure i'll post it to ITNinja, i've posted some things there before...

It actually ended up being pretty simple.

I split the partition equally, boot off a UEFI USB thumb drive i created with KACE. I build my image in Audit mode, so i take the same image i use on my Dells and create a pre-install task to set up the disks properly and then KACE pushes the image to the appropriate partition.

Once the image is on the mac, i boot back to mac and tell WinClone to allow the partiton to be EFI bootable. This is the hardest part. If i knew what this code was, we could automate it some more. Once that's set you're all done! boot back to the Windows partition and let KACE do it's magic. I do have to have a post-install for the chipset drivers, but other than that it's pretty much the same as my PCs.

-Steve

TechGuy said...

I can confirm I was able to use WinClone 4.4 and created a Windows 10 image on 10.11.6 iMac. I Shrank it and made it "Make Self Extracting..." and used DeployStudio 1.6.15 that was built on 10.10 and running on a Mac Mini server running 10.6.8. I know what a mouth full but it worked for me!! Our next CAD Lab will be Windows Machines as they spend most of their time there anyway. Just wanted to share my experience in getting this to work and not getting the "waiting on pigz" message. Good luck!

ThinkB!G_tech said...

I have a 2016 MacBook Pro with touchpad (1TB Fusion Drive). I did everything to the tee on your list for making all the workflows. The Mac partition installed, then the disable_spi script ran as well. After that, it just booted to the Mac partition. I'm stuck after that because it didn't even attempt to run any of the other scripts or install the winclone package. Any thoughts?

Chuck Steel said...

@ThinkB!G_tech, check the DeployStudio logs to see if one of the steps failed. What is in your workflow after the disable_sip script?

Chuck Steel said...

It looks like you have an error in the disable_sip.sh script, make sure that the syntax is correct and there aren't any special characters that might have been inadvertently copied.

ThinkB!G_tech said...

@Chuck Steel

It looks like I saved the link and it added a bunch of unnecessary lines. Going to try again by just copying the script directly instead of saving the link. Will try again! Thank you.

ThinkB!G_tech said...

@Chuck Steel, thank you for all your help. All of the scripts ran before the package install. It's been sitting on that step for about 10 minutes, so I'm hoping for the best! Any input on the average time the step will usually take? Thank you once again for all of your help.

MrTech2017 said...

I'm running into a minor issue where it keeps running "installer:PHASE:Running Package scripts..." over and over again and doesn't stop. This is after everything has been run and it is doing it in the DeployStudio Finalize script log. Any thoughts? Is it safe to stop it and assume all went through?

MrTech2017 said...
This comment has been removed by a blog administrator.
MrTech2017 said...
This comment has been removed by a blog administrator.
Chuck Steel said...

@MrTech2017 My guess is that one of your packages isn't completing installation. You can try netbooting again and looking at the DeployStudio finalize log to see what might be hanging up. You can also check the /var/log/install.log.

MrTech2017 said...

@Chuck Steel thank you. It worked the second time. As far as non-sysprepped windows packages, any suggestions on what to do in those situations? I used the same work flows as your tutorial, but get the "bless" error when trying to start into the Windows partition.