Showing posts with label imaging. Show all posts
Showing posts with label imaging. Show all posts

Sunday, February 10, 2019

Free Imaging Server for Deployment

Free is always nice. All businesses love the idea of cutting costs. Sometimes the free stuff can even offer more and better options. Will that be the case here? I don't know. What I do know is that at work we cut costs in almost any way imaginable and this is one way.

FOG Project

This is a very nice solution for the mass deployment and management of operating systems. It is compatible with Windows, Linux and Mac OSX, which is rather impressive. So let's get into a broad overview of the installation and features.

For setting up the server, it's fairly straight forward. I have had the best luck with CentOS, but we have also ran it on Ubuntu. When I tried doing another Ubuntu install when upgrading some things, various issues popped up. I would also recommend that when you create an /images folder for it to store the images that you make it a separate partition or hard drive. I had an issue with some folders using too much room and leaving the OS in an unbootable state and if I had the files separate, recovery would have been easier.

The setup also offers for the server to function as a DHCP and/or DNS server, so making a standalone for a deployment when the necessary server infrastructure might not be there is a good thing to have. This can let you create a quick and easy deployment environment with out too much work. There is also a way to set up multiple servers where others act as storage nodes, which can increase the deployment speed.

The IPXE boot menu for Fog offers a lot of options to customize it. You can change the colors and styles. You can also change the boot method after between options in GRUB or to boot to rEFInd.

There are the basic deploy and capture image options. You can also register a host, will take an inventory and allow for you to manage it in many ways. This can include changing the name, joining a domain, debugging, memory tests, hard drive checks, file recovery, reset local passwords, wake on lan, virus scanning, hard drive wiping, and snapins. It can also deal with printers, keep a login history, schedule powering off, auto-logouts, and this is all just some surface level overview.

There is an ability to group together computers for mass deployments and managing. I use it when setting up computer labs or any group that I could potentially need to install the same software on all of them.

The image management is fairly straight forward. Of course it resizes the partitions for you to take up all the space necessary.

Snapins are very useful. You can create Batch scripts, Bash scripts, Powershell scripts, VB scripts, and send out MSIs. You can essentially create a nice base image, then add extras or tweak with snapins.

After that, there are options for managing printers, printing out reports, and lots of settings you can tweak.

As a basic example of what I would normally do, let's assume I need to deploy an image for a computer lab. After registering each computer to Fog with a name and adding it in a group together, I would then deploy an image and have it join to the domain. After that is all set up, I would then deploy a snapin for the Lanschool MSI for the students. The teacher computer would be kept separate, but I can use snapins to install the Lanschool teacher console and any extra software. In cases where the installer is not an MSI, I would use a batch script with a Samba share that hosts the exe.

With all of those hots registered, I can then use the wake on lan feature to turn them on when needed to remote into them and work. I can also use snapins to deploy simple batch scripts to do various things (personally, I prefer to use PsExec for simple things).

It's a nice tool with lots of features and instructions how to do almost anything you could want.

Monday, February 4, 2019

Windows 10 Sysprep Full Unattended Setup

At work I tend to deal with creating the image we use for distribution of our computers. Windows 10 was a rather unique challenge of anything that could go wrong, did. We use Windows 10 Professional. Here's just a quick list of versions:
  • 1609 - Works, but updates can get stuck, requires different UAC on a domain
  • 1703 - Skipped, updating to worked fine, requires same UAC settings same as 1609
  • 1709 - Skipped, updating sometimes broke the system files, UAC settings same as 1609
  • 1803 - Could not get to work, updating to it broke permissions making searching impossible unless you were a pre-existing admin
  • 1809 - Works, requires slightly different Unattend, works with domain settings and UAC used for Windows 7
(UAC settings need Admin Approval mode enabled and all Admins to run in Admin approval mode)

Common issues I ran into included:
  • Users logged in were unable to use search features
  • The very first login may appear okay, but any after that break
  • Warnings about running programs as an administrator (UAC settings in domain can fix this)
  • Unable to apply all group policies without numerous attempts
  • Creating the .clg file needed has only worked for me once
  • Enabling .NET 3.5 in Windows features
  • Shutdown not working correctly
Currently I am trying to only work on a 64 bit image, we're in the process of phasing out 32 bit. So now let's do a walk-through and with any luck someone will find this helpful, maybe even help me fix problems I've come across. I'll be doing the most recent at the time, 1809.
So the first and obvious step, install Windows 10. After installed and gets ready for setup, press Ctrl+Shift+F3. Get into Windows and get it started on updates. After that, you can install any software you need to. I personally try to install everything through Chocolatey, and I may include setting that up in another post.
So let's talk about enabling .NET 3.5. To do this, you need the Windows 10 installation disc in, and let's assume that it's the D drive (adjust to your needs). You then use the command:

DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:D:\sources\sxs

After that, your .NET 3.5 should be enabled.

Now at this point, we should direct our attention to the unattend file. On another computer, install the Windows ADK (make sure the computer is the same architecture). From what I've read, some say to create an unattend using the install.wim on the iso, others say turn a blank Windows 10 installation to a wim and then use that. Both fail when creating the .clg file for it after a while of sitting there trying. One day after it said it failed, a .clg file magically appeared. Why or how, I don't know. Rather than walk anyone through the process, I'll just include the .wim and .clg file. If anyone knows why it fails making the .clg file, let me know.

WIM
CLG

So here's the bear minimum settings I found I needed to get the installation to go through. Keep in mind, it still flashes the setup for a moment, I think it's just because the network takes a minute to figure itself out. Open up Windows System Image Manager and create a new Unattend using the WIM file. Then add these settings at minimum:

  • amd64_Microsoft-Windows-Security-SPP_neutral -> Pass 3 Generalize
    • SkipRearm set to 1
  • amd64_Microsoft-Windows-Deployment_neutral -> Pass 4 Specialize
    • ExtendOSPartition
      • Extend set to true
    • Delete other options that appear
  • amd64_Microsoft-Windows-Shell-Setup_neutral -> Pass 4 Specialize
    • ComputerName set to *
    • Set your product key
    • Set your timezone
    • Do NOT put in anything for copy profile, that breaks the search feature for users setup after the installation
    • Delete all the other sub pieces that show.
  • amd64_Microsoft-Windows-International-Core_neutral -> Pass 7 oobe System
    • InputLocale set to 0409:00000409 for en-US
    • SystemLocale set to en-US
    • UILanguage set to en-US
    • UserLocale set to en-US
  • amd64_Microsoft-Windows-Deployment_neutral -> Pass 7 oobe System
    • AutoLogon should be set if you need any of that set with enabled to true and logoncount to 2
      • Set a password if you want it to autologon
    • FirstLogonCommands is where you are going to set any Post-SysPrep stuff that should supercede a logon, add as many as you need with whatever you need
    • Under OOBE you need all of these to skip the setup:
      • HideEULAPage true
      • HideLocalAccountScreen true
      • HideOEMRegistrationgScreen true
      • HideOnlineAccountScreens true
      • HideWirelessSetupInOOBE true
      • ProtectYourPC 2
    • UserAccounts needs at least the administrator password to skip past the login
      • You can either set the AdministratorPassword or right-click on LocalAccounts and create one if needed
After that is done, you should be ready to load what you need on the computer to create an image with and get that going. So let's talk about that.

First we need to copy over our unattend.xml file we so painstakingly made. I copy this to C:\. Now there is a cleanup we can do, using the SetupComplete.cmd that will get ran automatically after. So do that, we need to create the directory C:\Windows\Setups\Scripts. Then let's create a file called SetupComplete.cmd in that folder and open it with notepad. We need the following commands for a decent cleanup:

DEL /Q /F C:\Windows\System32\sysprep\unattend.xml
DEL /Q /F C:\Windows\panther\unattend.xml
DEL /Q /F C:\unattend.xml
DEL /Q /F C:\Windows\Setup\Scripts\SetupComplete.cmd

This will remove all the traces of our unattend file and then itself. With that being setup, we need to run the sysprep. So do this, just run the command:

"C:\windows\system32\sysprep\sysprep.exe" /generalize /oobe /reboot /unattend:c:\unattend.xml

Word of caution, this will reboot the computer, not shut it down. I've had to use reboot because shutdown does not shut down Windows properly, it hibernates. That means after you boot back up, it just drops you back where you were until you tell it to restart. At one point shutdown worked, but I had other issues around then and I think it was because I changed the shutdown procedure.

Anyway, that's a rough guide for setting up a Sysprep of Windows 10 x64 version 1809 to install and skip past the setup. Hope it helps anyone having issues with this.