How do I resize a disk after imaging?

Q. How do I resize a disk after imaging? 

A. With KID 1.0, we do not currently support dynamic disk resizing on any partition type including basic, dynamic or GPT on the target endpoint. 

So the target of any imaging operation must be the same size or greater.

To expand the disk to take advantage of additional space when imaging to a new larger disk, you do have several utilities to assist. 

In Windows operating systems XP and above we have the Microsoft utility diskpart
Due to the command line nature of this utility you could script the expansion of a disk using agent procedures or powershell script after an imaging operation.

Create the following file "DiskPart-Extend.PS1' in C:\Temp on the endpoint to be imaged with the following content:

--- Diskpart-extend.PS1 ---
$script = $Null
$script = @"
select disk 0
select volume 2
$script | Out-File -Encoding ASCII -FilePath "c:\temp\Diskpart-extend.txt"

diskpart.exe /s c:\temp\Diskpart-extend.txt
--- End of Diskpart-extend.PS1 ---

Then create a C:\Windows\Setup\Scripts\SetupComplete.cmd file that executes the following:

--- SetupComplete.cmd ---
@echo off
powershell Set-ExecutionPolicy RemoteSigned -force
powershell C:\temp\DiskPart-Extend.PS1
powershell Set-ExecutionPolicy AllSigned
--- End of SetupComplete.cmd ---

This script SetupComplete.cmd will be executed after Windows Setup will be finished and this is documented here: 

* Currently any disk partition that is over 2TB needs to be a GPT partition and currently a GPT partition is not recognized by KID. 

Many thanks to Darryl Ping for this script to extend disk partitions.




Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Article is closed for comments.