Upgrading from Windows 7/8 to Windows 10 via SMA script

 

UPDATE: 5-21-2018: There is a new KB that covers this same topic that is available on the Quest support site:

https://support.quest.com/kace-systems-management-appliance/kb/255380/windows-10-build-upgrade-deployment-walkthrough

Very well done by one of their developers. 


UPDATE: I have changed Method 2 around to do just all .bat file since they seem to work more reliably (big thanks to my mate DaveH who helped on that). I may do some more testing to try and use the Launch a Program steps since you can use our Kace variables that way, and those directories get auto-cleaned up, but that could actually cause some problems with this, depending on when the agent decides it needs to clean up that directory. 

I think have another cleanup script would suffice for later; you could use a Smart Label to target newly upgraded windows 10 machines, then have a script delete the C:\windows 10 upgrade folder. 

 FYI 

SMA = Systems Management Appliance A.K.A K1000

SDA = Systems Deployment Appliance A.K.A K2000


This also works for the Windows 10 Features Updates, like the Windows 10 Fall Creators Update as well


Overall time to complete upgrade from start to finish: 30-45 minutes

ENVIRONMENT: VMware workstation running on a windows 10 M3800 laptop with 16GB RAM and SSD drives. 

 

Windows 10 Readiness Report

After talking with some folks and playing around with this upgrade more, I realized that our built in 'Windows 8 Readiness Report' was pretty close to what you would need for a Windows 10 version, so I modified it and thought I would share


TITLEWindows 10 Readiness Assessment
DESCRIPTIONIdentify all devices with hardware capable of installing Windows 10: at least 1Gb RAM (32-bit) or 2Gb RAM (64-bit), 10Gb free disk space (32-bit) or 20Gb free disk space (64-bit), and 1Ghz processor.  Devices are grouped by Can be Upgraded, Install Only, or not able to run Windows 10.
BREAK ONUPGRADABLE
QUERY
SELECT * 
FROM 
(
	SELECT 
		MACHINE.ID, 
		MACHINE.NAME AS NAME,
		OS_NAME, 
		OS_ARCH AS ARCH,
		IF(OS_NAME LIKE '%Vista%' OR OS_NAME LIKE '%7%' OR OS_NAME LIKE '%Windows 8%' OR OS_NAME NOT LIKE 'Server', 
			IF(OS_NAME LIKE '%RTM%' OR OS_NAME LIKE '%Starter%' OR OS_NAME NOT LIKE '%Server%' ,'Install Only', 'Can be Upgraded'),'Install Only'
		) AS UPGRADABLE, 
		PROCESSORS, 
		RAM_TOTAL, 
		SUM(MACHINE_DISKS.DISK_SIZE) AS DISK_SIZE, 
		MACHINE_DISKS.DISK_FREE AS DISK_FREE, 
		VIDEO_CONTROLLERS AS VIDEO 
	FROM MACHINE 
	LEFT JOIN MACHINE_DISKS ON (MACHINE_DISKS.ID = MACHINE.ID) 
	LEFT JOIN OPERATING_SYSTEMS OS ON (OS.ID = MACHINE.OS_ID) 
	WHERE OS.FAMILY = 'windows'
        AND OS.NAME NOT LIKE '%Server%'
	AND NOT (OS_MAJOR = '10' AND OS_MINOR = '0')	-- Win 10
	AND  
	(1  IN 
		(
			SELECT 1 FROM MACHINE_DISKS WHERE MACHINE_DISKS.ID = MACHINE.ID 
			AND 
			IF(MACHINE.OS_ARCH LIKE '%x86%',MACHINE_DISKS.DISK_FREE >= '16',MACHINE_DISKS.DISK_FREE >= '20')
		)
	)  
	AND 
	IF(MACHINE.OS_ARCH LIKE '%x86%', RAM_TOTAL >= '1000',RAM_TOTAL >= '2000')
	AND PROCESSORS NOT LIKE '%Mhz%'
	GROUP BY MACHINE.ID
) AS PASSED

UNION ALL

SELECT * 
FROM 
(
	SELECT  
		MACHINE.ID,
		MACHINE.NAME AS NAME, 
		OS_NAME, 
		OS_ARCH AS ARCH, 
		'Not Enough Disk' AS UPGRADABLE, 
		PROCESSORS, 
		RAM_TOTAL, 
		DISK_SIZE AS DISK_SIZE, 
		MACHINE_DISKS.DISK_FREE AS MACHINE_DISKS_DISK_FREE, 
		VIDEO_CONTROLLERS AS VIDEO 
	FROM MACHINE 
	LEFT JOIN MACHINE_DISKS ON (MACHINE_DISKS.ID = MACHINE.ID) 
	LEFT JOIN OPERATING_SYSTEMS OS ON (OS.ID = MACHINE.OS_ID) 
	WHERE OS.FAMILY = 'windows'
	AND NOT (OS_MAJOR = '10' AND OS_MINOR = '0')	-- Win 10
        AND OS.NAME NOT LIKE '%Server%'
	AND 
	(1  NOT IN 
		(
			SELECT 1 FROM MACHINE_DISKS WHERE MACHINE_DISKS.ID = MACHINE.ID 
			AND 
			IF(MACHINE.OS_ARCH LIKE '%x86%',MACHINE_DISKS.DISK_FREE >= '16',MACHINE_DISKS.DISK_FREE >= '20')
		)
	)
	GROUP BY MACHINE.ID
) AS DISK

UNION ALL

SELECT * 
FROM 
(
	SELECT  
		MACHINE.ID,
		MACHINE.NAME AS NAME, 
		OS_NAME, 
		OS_ARCH AS ARCH, 
		'Not enough Memory' AS UPGRADABLE, 
		PROCESSORS, 
		RAM_TOTAL, 
		MACHINE_DISKS.DISK_SIZE AS DISK_SIZE, 
		DISK_FREE AS MACHINE_DISKS_DISK_FREE, 
		VIDEO_CONTROLLERS AS VIDEO 
	FROM MACHINE
	LEFT JOIN MACHINE_DISKS ON (MACHINE_DISKS.ID = MACHINE.ID)
	LEFT JOIN OPERATING_SYSTEMS OS ON (OS.ID = MACHINE.OS_ID) 
	WHERE OS.FAMILY = 'windows'
	AND NOT (OS_MAJOR = '10' AND OS_MINOR = '0')	-- Win 10
        AND OS.NAME NOT LIKE '%Server%'
	AND IF(MACHINE.OS_ARCH LIKE '%x86%', RAM_TOTAL < '1000',RAM_TOTAL < '2000')
	GROUP BY MACHINE.ID
) AS NOT_ENOUGH_MEMORY

UNION ALL

SELECT * 
FROM 
(
	SELECT  
		MACHINE.ID,
		MACHINE.NAME AS NAME, 
		OS_NAME, 
		OS_ARCH AS ARCH, 
		'Not enough Processor Speed' AS UPGRADABLE, 
		PROCESSORS, 
		RAM_TOTAL, 
		MACHINE_DISKS.DISK_SIZE AS DISK_SIZE, 
		MACHINE_DISKS.DISK_FREE AS DISK_FREE, 
		VIDEO_CONTROLLERS AS VIDEO 
	FROM MACHINE 
	LEFT JOIN MACHINE_DISKS ON (MACHINE_DISKS.ID = MACHINE.ID)
	LEFT JOIN OPERATING_SYSTEMS OS ON (OS.ID = MACHINE.OS_ID) 
	WHERE OS.FAMILY = 'windows'
	AND NOT (OS_MAJOR = '10' AND OS_MINOR = '0')	-- Win 10
        AND OS.NAME NOT LIKE '%Server%'
	AND PROCESSORS LIKE '%Mhz%' 
	GROUP BY MACHINE.ID
) AS PROCESSOR_TOO_SLOW

UNION ALL

SELECT * 
FROM 
(
	SELECT  
		MACHINE.ID,
		MACHINE.NAME AS NAME, 
		OS_NAME, 
		OS_ARCH AS ARCH, 
		'Not Required (Windows 10 Already Installed)' AS UPGRADABLE, 
		PROCESSORS, 
		RAM_TOTAL, 
		MACHINE_DISKS.DISK_SIZE AS DISK_SIZE, 
		MACHINE_DISKS.DISK_FREE AS DISK_FREE, 
		VIDEO_CONTROLLERS AS VIDEO 
	FROM MACHINE 
	LEFT JOIN MACHINE_DISKS ON (MACHINE_DISKS.ID = MACHINE.ID) 
	LEFT JOIN OPERATING_SYSTEMS OS ON (OS.ID = MACHINE.OS_ID) 
	WHERE OS.FAMILY = 'windows'	
	AND OS_MAJOR = '10' AND OS_MINOR = '0'  -- Win 10
        AND OS.NAME NOT LIKE '%Server%'
	GROUP BY MACHINE.ID
) AS ALREADY_WIN_10


ORDER BY UPGRADABLE, NAME


QUERY:

Should look like this:


Introduction

Since we have documentation on upgrading in place or clean install to Windows 10 using the SDA:

http://www.itninja.com/blog/view/upgrading-to-windows-10

 

I thought I would write up something specific on upgrading using the SMA in a script. 

 

There are 3 methods I show below. They first two do the same thing, just different in the approach in how we handle where the Windows 10 install files and where they are running from. Method 3 leverages the SMA entirely without the need for Samba access, so this could even be done over the web if needed, or replicated to your replication sites. 

 

(My Preferred) Method 1: Run as a Managed Install does everything from the SMA directly without the need for a file share on your network. You will still need to be able to upload your Win10 install files via the Clientdrop SMB share on the SMA since the files are too big for the web interface


Method 1: Run from network share does everything from a .bat file, and launches the upgrade directly from a UNC path. 

 

Method 3: Copy to/run from client will show copying the files down to the client first, then executing the upgrade. 

 


 

Prerequisites

1.       Must have the appropriate media/ISO for Windows 10

a.       Like for like only. Example: Win7 Pro to Win10 Pro. Can’t do Win7 Home to Win10 Enterprise.

2.       I wrote this with the understanding you have a very basic knowledge of how our scripting module works. If you’d like a primer to this, please review some of our scripting tutorial video:

a.       Scripting 101 with Kace SMA and Windows 10 upgrade 

Here is where the magic happens in this one .bat file example (you would run this from the root of the Windows 10 ISO directory:


Converting .esd files to .wim


Shout out to WraithKnight80 who discovered this. 


dism /Get-WimInfo /WimFile:install.esd

dism /export-image /SourceImageFile:install.esd /SourceIndex:1 /DestinationImageFile:install.wim /Compress:max /CheckIntegrity


https://community.spiceworks.com/how_to/125905-change-esd-to-wim

 

setup.exe /auto upgrade /installfrom sources\install.wim /dynamicupdate disable

 



Basically we launch setup.exe with some switches from a network share, and the path to where the install.wim is.

 

For your script, you will need to change the server IP Address or name to yours, and the share path.

 

Link to list of switches you can use:

http://winaero.com/blog/windows-10-setup-exe-command-line-switches/

 

 

Method 1 (preferred)

Run as a Managed Install

Step 1 – Upload your Windows 10 .zip file

 

1.    Unpack the contents of your Windows 10 ISO into a folder on your workstation.
2.    Zip all of those files up.
            a. TIP: Use 7zip to zip them. The Windows compression for some reason causes an issue with unpacking a file this large
3.    Copy the .zip file to your clientdrop share on your SMA
4.    Login to your SMA admin interface
5.    Click Inventory > Software Catalog (NOTE: You can use the Legacy 'Software' library if you wish instead)
6.    Search for the version of Windows 10
        a.    In this example, I’m using Windows 10 Enterprise
7.    In the Windows 10 software catalog record, locate the exact version you are upgrading to
        a.    TIP: To make sure I was using the exact version, I used the same ISO to install a fresh copy of Windows onto a VM, then installed the SMA agent and inventoried it to verify the version was correct
8.    Click the blue plus icon next to the desired version
9.    In the Associate a File dialog box, select the Choose file from Samba share radio button
10.  Select the .zip file from the drop down box
11.  Click Save


Step 2 – Create your Managed Installation

 

12.  Click Distribution > Choose Action > New

13.  Enter a name for your Managed Install

a.    Example: Windows 10 Enterprise Upgrade

14.  Select the Cataloged Software radio button

15.  Select your Windows 10 record from the Cataloged Software drop down

16.  In the Associated File box, select the .zip file you uploaded and associated

17.  In Installation Options, select Override Default Installation

18.  Enter the following command line:

a.    setup.exe /auto upgrade /installfrom C:\programdata\quest\kace\downloads\139\sources\install.wim
/dynamicupdate disable

b.    Change ‘139’ to the software ID of the .zip you uploaded. To obtain this, go back to the Software Catalog item for Windows 10, and hover your mouse or inspect the hyperlink for the .zip file under the Associated Files section. Example: https://k1000.mydomain.com/packages/139/en_windows_10_enterprise_version_1703_updated_march_2017_x64_dvd_10189290.zip

19.  Target the machines you desire

20.  Click Save

 

Method 2

 Copy to and run from client


Prerequisite:

  1. Put the contents of you Windows 10 ISO files on a share.

    1.  In this example, i put my files on \\10.0.0.122\win10_upgrade\

 Step 5.1.1 shows how to do the robocopy part. Just explaining what it's doing; we're making a directory on the root of C:\ called win10_upgrade. You don't have to put it there, you could put it wherever really. 



Steps

1.      1.       Create a new Online Kscript

2.       Create a task and add the following steps

3.       Verify a registry value is exactly…

3.1.    Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion

3.2.    Name: ProductName

3.3.    Equal To: Windows 10 Enterprise

3.3.1. NOTE: Change this value to which ever version you are upgrading to

4.       On Success:

4.1.    Log message

4.1.1. Status: Windows 10 already installed

5.       Remediation:

5.1.    Run a batch file

5.1.1. Batch file:  md c:\Windows10_media

robocopy /MIR \\10.0.0.122\win10_upgrade\ c:\windows10_media

5.2.    Run a batch file

       5.2.1 Batch file: cd c:\windows10_media\

setup.exe /auto upgrade /installfrom c:\windows10_media\sources\install.wim /dynamicupdate disable


Method 3

Run from network share 


1.       Create a new Online Kscript

2.       Create a task and add the following steps

3.       Verify a registry value is exactly…

3.1.    Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion

3.2.    Name: ProductName

3.3.    Equal To: Windows 10 Enterprise

3.3.1. NOTE: Change this value to which ever version you are upgrading to

4.       On Success:

4.1.    Log message

4.1.1. Status: Windows 10 already installed

5.       Remediation:

5.1.    Run a batch file

5.1.1. Batch File: \\10.0.0.122\win10_upgrade\setup.exe /auto upgrade /installfrom \\10.0.0.122\win10_upgrade\sources\install.wim /dynamicupdate disable

And that's pretty much it. Enjoy! Leave any questions/comments below