Make an OS template from wim image for WS 2012 R2

Hi guys!

Here I writte how to make a vhdx when you have built an image with DISM for WS 2012 R2 Standard.

http://technet.microsoft.com/en-us/library/hh825691.aspx

Requisites:

WADK 8.1

WS 2012 R2 CU1.

Process:

Creating vhdx disk:

• Diskpart

o create vdisk file=E:\temp\golden.vhdx maximum=122880 type=expandable
o select vdisk file=E:\temp\Image\golden.vhdx
o Attach vdisk
o Create partition primary size=350
o Format quick fs=ntfs
o Assign letter=s
o Active
o Create partition primary
o Format quick fs=ntfs
o assign letter=V
o Exit

Applying wim image to vhdx with dism:
• dism /apply-image /imagefile: E:\temp\ISO_2012R2\sources\golden.wim /index:2 /applydir:V:\

http://technet.microsoft.com/en-us/library/gg318056(v=ws.10).aspx

Type the following command to specify that V is the drive for Windows Boot Manager and the boot configuration data:
V:\windows\system32\bcdboot V:\windows /s S: (S: is the recovery partition)

Use the bcdedit /store <path> option to specify the BCD file inside the VHD as the BCD store, for example:

• bcdedit v:\windows

Bcdedit /store s:\Boot\bcd /set {bootmgr} device locate (where s: is the recovery partition)
Bcdedit /store s:\Boot\bcd /set {default} device locate (where s: is the recovery partition)
Bcdedit /store s:\Boot\bcd /set {default} osdevice locate (where s: is the recovery partition)

• Diskpart
o Select vdisk file= E:\temp\ISO_2012R2\sources\golden.vhdx
o Detach vdisk
o Exit

I hope it will be helpfull

Regards

Anuncios

Generating a 2008 R2 VM Template with DISM

Hi all!

Here I show how to make a new template for WS 2008 R2 EE with DISM installed in a WS 2012 R2 CU1:

Pre-requisites: WADK 8.1 http://www.microsoft.com/en-us/download/details.aspx?id=39982

Copy wim file from WS 2008 R2 EE image and paste in your local C:\W2008R2_Template

Resuming actions:

  • OS WS 2008 R2 Enterprise
  • Telnet client enabled
  • Spanish regional settings
  • UTC+1 Time Zone
  • All updates added from a repository generated with wsusoffline931 http://download.wsusoffline.net/
  • VHDX with 120GB
  • Boot partition 350MB
  • System Partition 119GB

Hands on:

Open DISM CMD with elevated privileges and execute

Template with Features:
—————————-

dism /Mount-Wim /WimFile:C:\W2008R2_Template\VMTemplate.wim /Index:3 /MountDir:C:\W2008R2_Template\new_vm

dism /image:C:\W2008R2_Template\new_vm /Enable-Feature /FeatureName:TelnetClient

dism /image:C:\W2008R2_Template\new_vm /set-syslocale:es-ES
Dism /image:C:\W2008R2_Template\new_vm /Set-UserLocale:es-ES
Dism /image:C:\W2008R2_Template\new_vm /Set-Inputlocale:040a:0000040a

Dism /image:C:\W2008R2_Template\new_vm /Set-TimeZone:”Romance Standard Time”

Dism /unmount-wim /mountdir:C:\W2008R2_Template\new_vm /commit

Adding updates:
—————–
dism /mount-wim /wimfile:C:\W2008R2_Template\VMTemplate.wim /index:3 /mountdir:C:\W2008R2_Template\new_vm

DISM /image:C:\W2008R2_Template\new_vm /Add-Package /Packagepath:C:\WUpdates2k8R2

Dism /unmount-wim /mountdir:C:\W2008R2_Template\new_vm /commit

Open CMD with elevated privileges and execute:

Creating VHDX:
————

diskpart
create vdisk file=C:\W2008R2_Template\vhdx\VMTemplate.vhdx maximum=122880 type=expandable
select vdisk file=C:\W2008R2_Template\vhdx\VMTemplate.vhdx
Attach vdisk

Create partition primary size=350
Format quick fs=ntfs
Assign letter=M
Active
Create partition primary
Format quick fs=ntfs
Assign letter=V
exit

Open DISM CMD with elevated privileges and execute

—————–

dism /apply-image /imagefile:C:\W2008R2_Template\VMTemplate.wim /index:3 /applydir:V:\

V:\windows\system32\bcdboot V:\windows /s M:

Open CMD with elevated privileges and execute:

Diskpart
Select vdisk file=C:\W2008R2_Template\vhdx\VMTemplate.vhdx
Detach vdisk
exit

Regional settings overrided to en-US when using a vm template from SCVMM 2012

Hi guys,

These days I´m deploying VM from vm templates. We found that when you deploy a new vm from a VM Template the regional settings are configured en-US, overriding other settings.

I found an article that fix this issue http://support.microsoft.com/kb/2709539 and in my case the I only have needed the following:

$template = Get-SCVMtemplate | where {$_.Name -eq “Template_Name”}
$settings = $template.UnattendSettings;

$settings.add(“oobeSystem/Microsoft-Windows-International-Core/UserLocale”,”es-ES”)
$settings.add(“oobeSystem/Microsoft-Windows-International-Core/InputLocale”,”040a:0000040a”)

Set-SCVMTemplate -VMTemplate $template -UnattendSettings $settings

You can check the regional settings for all vmtemplates with the following PS1 sintaxis (change 2vNICs by other equal in all vmtemplates):

Get-SCVMtemplate | where {$_.Name  -like “*2vNICs*”}  | fl name,unattendsettings

Regards!

How to create a security template for hardening

Hi!

To create and apply a customized security template I did the following:

Use a template based in Security Compliance Manager

http://technet.microsoft.com/en-us/library/cc677002.aspx

Deploy a temporal standalone WS 2012 R2 to do tests

Import the .inf file exported from GPO Backup (folder) option in SCM to a Security Template mmc and then modify all options you want.

Add Security Configuration and Analysis snapin, import your template .inf and then execute the analyze option, remember to use a new database.

http://technet.microsoft.com/en-us/library/bb742512.aspx#EFAA

Save configurations as inf file and it will be your security template for hardening.

Regards

Create and deploy a sysprep image from a vhdx

Hi guys,

With the below commands we can deploy a winpe image made with WADK 8.1 for WS 2012 R2

Regards

Create a WinPEMEdia

  • Install ADK 8.1
  • Start deployment and imaging tools environment as Administrator
  • copype amd64 c:\winpe_amd64
  • Copy VHD at this directory before made winpemedia
  • MakeWinPEMedia /ISO C:\WinPE_amd64 C:\WinPE_x86\WinPE_x86.iso

Create image:

  • Diskpart

o    create vdisk file=C:\temp\vhd\master.vhdx maximum=122880 type=expandable

o    select vdisk file=C:\temp\vhd\master.vhdx

o    Attach vdisk

o    create partition primary

o    assign letter=V

o    format quick label=vhd

o    Exit

  • Dism /apply-image /imagefile:E:\sources\install.wim /index:4 /applydir:V:\
  • Diskpart

o    Select vdisk file=C:\temp\vhd_cloud\master.vhdx

o    Detach vdisk

o    Exit

Install image

  • Boot host with WinPE (with vhdx) generated before.
  • Diskpart

o    Select disk 0

o    Clean

o    Create partition primary size=350

o    Format quick fs=ntfs

o    Assign letter=s

o    Active

o    Create partition primary

o    Format quick fs=ntfs

o    Assign letter=c       (maybe you need to leave C: from Winpe and reassign to another drive letter)

o    exit

  • Copy vhdx to C:

o    Diskpart

o    List volume

o    Detect volume where is vhdx and copy to c:

  • Diskpart

o    Select vdisk file=c:\master_win.vhdx

o    Attach vdisk

o    List volume

o    Select volume (press volume number for attached disk)

o    Assign letter=v

o    Exit

  • Cd v:\Windows\system32
  • Bcdboot v:\windows
  • Diskpart

o    Select vdisk file=c:\master_win.vhdx

o    Detach vdisk

o    exit

o    exit (reboot)

  • password: XXXXXX
  • Change to your System Locale – Reboot
  • Format your language and country
  • Copy Settings to default user and Welcome screen
  • Powercfg /hibernate OFF (for HyperV hosts)
  • powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (for HyperV hosts)
  • Eventvwr, everyone to 51200 and Overwrite as needed