cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cloud List <>
Subject Automatically initialize data-disk on Windows Server 2016 OS template
Date Mon, 14 Aug 2017 05:32:12 GMT
Dear all,

I am using CloudStack 4.8.1 and KVM hypervisor. When creating my Windows
Server 2016 OS template, I tried to automate the initialization and
formatting of the data-disk so that it will automatically be put online,
initialized with MBR partition, formatted and assigned the E: drive letter,
without the user having to manually initialize the disk using Computer
Management > Disk Management.

I tried to do so by preparing 2 scripts:

1. A PowerShell script to automatically initialize and format all disks
with RAW partition, which I am taking from here:

I saved it on C:\script\InitializePartitionFormatNewDisks.ps1.

2. A command script to automatically run the above PowerShell script when
the Administrator user logs in. I follow the instructions on below URL:

to create a command script to set PowerShell execution policy to
"unrestricted" and then run the script.

PowerShell -Command "Set-ExecutionPolicy Unrestricted" >>
"%TEMP%\StartupLog.txt" 2>&1 PowerShell
C:\script\InitializePartitionFormatNewDisks.ps1 >> "%TEMP%\StartupLog.txt"

I saved the command script onto:

The issue I face is that the command script I put onto
Menu\Programs\Startup\startup.cmd is deleted during the "sysprep" process,
as part of the Windows template creation on CloudStack as per:

Is there a way I can put the startup.cmd file somewhere else so that it
will not be deleted during the sysprep process but will still be executed
when the VM boots up or when the Administrator user logs in? Or is there
any better approach on how to automate the data-disk initialization?

Any advice is highly appreciated.

Looking forward to your reply, thank you.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message