Thursday, June 12, 2014

Using PowerShell Deployment Toolkit to deploy System Center 2012 R2 for lab environment - Part 2

In part 1, we configured "Varaible.xml" and "Workflow.xml". After that, we performed "Downloader.ps1" on a PowerShell console to download all prerequisites components. We also copied Windows Server operating systems and System Center 2012 R2 software to the folders which are under "Installer" folder.

In this part, We'll configure "Varaible.xml" and "Workflow.xml" again for performing "VMCreator.ps1" and "Installer.ps1" to create virtual machines and install System Center 2012 R2 products.

Remark: Rob Willis releases the latest version of PowerShell Deployment Toolkit (PDT) which is 2.64.2611. Please go to the following website to download it.

PowerShell Deployment Toolkit

This version was updated the download link, file size and value code of Report Viewer 2012 Redistributable. It seems that the size of "ConfigMgt.Manifest.cab" in "Workflow.xml" is incorrect. We need to update it before installation.

VMCreator.ps1
VMcreator.ps1 is an optional PowerShell script to create virtual machines with IP and MAC addresses on a Hyper-Host. If administrators use "VariableAD.xml" for lab environment, VMcreator.ps1 creates service accounts in the lab environment. When all virtual machines are created, "Installer.ps1" will be copied to the "C:\Temp" of DC01 which is a virtual machine with Active Directory Domain Services role.


Then, "Installer.ps1" will follow the "Workflow.xml" to install System Center 2012 R2 with prerequisites components to other virtual machines.

Installer.ps1
Installer.ps1 is a script for installing System Center 2012 or System Center 2012 R2 on your environment. Installer.ps1 can be performed on physical or virtual environments. Before using this script, administrators need to create service accounts in your existing environment and then make sure server names and the drive letters should be matched to the "Variable.xml".



Goals

  • Configure the variable.xml
  • Deploying virtual machines by performing VMCreator.ps1
  • Installing System Center 2012 R2 by performing Installer.ps1
Lab environment
  • 1 standalone Windows Server 2012 R2 with Hyper-V role named HV01
Prerequisites
  • PowerShell Deployment Tookit (PDT ) is under C:\PDT of HV01
  • Download "Convert-WindowsImage.ps1" to C:\PDT folder for converting WIM to virtual hard disk files
  • A virtual switch named HVSwitch01 has been created in HV01 which can connect to the external network and access internet

Lab
1. On HV01, log in as Administrator.
2. Launch "PowerShell ISE".
3. Open "Variable.xml" and navigate to line "200".


There are some things administrators may need to change.

1. By default, the domain name is contoso.com. All service accounts and domain global groups will store in "Services.HQ" and "Groups.HQ". This option can be changed before performing "VMCreator.ps1".

2. By default, all virtual machines and virtual hard disks will store into "C:\VMs" folder. This option can be changed before performing "VMCreator.ps1". In my lab environment, I will change it to "D:\VMs".

3. "CorpNet01" is the default virtual switch name in "Variable.xml". Make sure the virtual switch name is same as your environment one. If not, please change it. In my lab environment, I will update a virtual switch name to "HVSwitch01".

4. The default "Prefix" name is "192.168.1" in "Variable.xml" and the first IP address of a virtual machine is "4" base on "Sequence". The next IP address of other virtual machines starts from "5". The subnet mask is "24" bits base on "Mask". For my lab environment, I need to update these values to the following:

<Prefix>172.16.100.</Prefix>
<Sequence>11</Sequence>
<Mask>16</Mask>
<Gateway>172.16.0.1</Gateway>
<DNS>172.16.100.11</DNS>

5. By default, all virtual machines will be used differencing virtual hard disk. Administrators can perform "Convert-WindowsImage.ps1" to create it and save it at C:\VHD folder. I will do it later

4. Scroll-down to line "260".


Administrators can modify the disk size, Ram size for every virtual machine.

Remark: By default, all virtual machines will be created to generation 1 configuration. To create generation 2 virtual machines, administrators can add <VMGeneration>2</VMGeneration> in the <Default> for all virtual machines or add <VMGeneration>2</VMGeneration> in each individual <VM>.



5. Scroll-down to line "400".


One of the virtual machine will be installed Windows Server 2008 R2 operating system. Then, we need to convert WIM to VHD.

6. Save and exit the "Variable.xml".
7. Insert "Windows Server 2008 R2 SP1 DVD" into HV01.
8. Launch "PowerShell" as administrator.
9. Navigate to "C:\PDT".
10. Perform ".\Convert-WindowsImage.ps1 -SourcePath E:\Sources\install.wim -VHDFormat VHDX -Edition ServerDataCenter -SizeBytes 100GB -VHDPath C:\VHD\WS08R2E-SP1.vhdx" to create a Windows Server 2008 R2 virtual hard disk with 100 GB disk size.
11. Enter "R".


12. Perform ".\Convert-WindowsImage.ps1 -SourcePath C:\Installer\WindowsServer2012R2\sources\install.wim -VHDFormat VHDX -Edition ServerDataCenter -SizeBytes 100GB -VHDPath C:\VHD\WS12R2D.vhdx" to create a Windows Server 2012 R2 virtual hard disk with 100 GB disk size.
13 Enter "R".


Remark: To create a generation 2 virtual hard disk by "Convert-WindowsImage.ps1", we can add "-VHDPartitionStyle GPT" parameter.


14. Perform "VMCreator.ps1" to create virtual machines.
15. Enter "R".


"VMCreator.ps1" checks all prerequisites components. If there is a problem in one of the components, it stops continuing creating any virtual machine. administrators can delete a component and then perform "Downloader.ps1" to re-download the incorrect component or update the size in "Workflow.xml". Administrators can add "-SkipValidation" parameter to skip check all validation.

When validation finished, 'VMCreator.ps1" started to create virtual machines on the current Hyper-v host.


It takes some times to create all virtual machines.


After created all virtual machines, all virtual machines will join to the domain automatically.


16. Enter "R" in DC01's Command Prompt to perform "Installer.ps1".



It spends some times to install all System Center 2012 R2 products to all virtual machines.

Is it difficult to modify the "Variable.xml" and "Workflow.xml"?

If yes, please try to use "PDT GUI".

PDT-GUI is a GUI tool to modify "Variable.xml". This tools is created by Benedict Berger (Hyper-V MVP and Hybrid Cloud Geek) and Kamil Kosek (Powershell Geek and Automation IT Pro).

How to use it?

1. Download PDT GUI and then save as the same folder of "Variable.xml" and "Workflow.xml".
2. Perform "PDT-GUI.Export.ps1" to launch "PDT GUI".
3. Enter "R".



4. On "Select file" tab, select "Browse for variable file" to select existing "Variable.xml".


5. On "General" tab, we can modify the settings.


6. On "VMs" tab, we can define the domain name, default VM settings and how many VMs we need.




7. On "SQL" tab, we can configure SQL service account, password, installation folder and so on.


8. On "Roles" tab, we can select which role to install to which server and we can also add or remove a role in this pane.


9. On "Finish" tab, we can perform the "Downloader.ps1", "VMCreator.ps1" and "Installer.ps1". These scripts will follow the "Variable.xml" and "Workflow.xml" which we updated.

Other parts
Using PowerShell Deployment Toolkit to deploy System Center 2012 R2 for lab environment - Part 1

More information
Deployment-The PDT VM Creator

Deployment-VMCreator updates with PDT 2.6

ThojoUno / PDT (Some updated Variable.xml and Workflow.xml by other)

Automating Microsoft System Center Deployments with the PowerShell Deployment Toolkit

This posting is provided “AS IS” with no warranties, and confers no rights!

2 comments:

  1. Hi,

    We are using the current version of PDT 2.65.1.0.0 and have followed all the required steps to download the additional components through the Downloader.ps1 script.

    It seems I am having some issues with validating the VMCreator.ps1 script and I am getting the following errors in the validating media section:
    Validating media…

    ASP.NET MVC 4… Passed
    ASP.NET Web Pages 2… Passed
    SQL Server 2012… Passed
    SQL Server 2012 Command Line Utilities… Passed
    SQL Server 2012 Native Client… Passed
    SQL Server 2012 SP2… Passed
    SQL Server 2012 SP2 CU1… Passed
    System Center 2012 R2 Orchestrator… Failed
    C:\Installer\SystemCenter2012R2\Orchestrator\SetupOrchestrator.exe incorrect version
    System Center 2012 R2 Virtual Machine Manager… Failed
    C:\Installer\SystemCenter2012R2\VirtualMachineManager\setup.exe incorrect version
    URL Rewrite 2… Passed
    Visual C++ 2010 Redistributable… Passed
    WCF Data Services 5.0… Passed
    Windows Automated Deployment Kit 8.1… Passed
    Windows Azure Pack 2013… Passed
    Windows Server 2012… Failed
    C:\Installer\WindowsServer2012\setup.exe missing
    Windows Server 2012 R2… Failed
    C:\Installer\WindowsServer2012R2\setup.exe missing

    Validation failed

    I have tried to resolve this issue by downloading the current versions from the MS website for these components but the error is the same. Also, in the workflow.xml error the ISO files are not defined for Windows server OS.

    Any inputs or feedback will be appreciated.

    Thanks,
    Hriday Biyani

    ReplyDelete
    Replies
    1. Hi,

      For your first case, Please update the version of Orchestrator and Virtual Machine Manager in the workflow.xml to solve this issue.

      System Center 2012 R2 Orchestrator… Failed
      C:\Installer\SystemCenter2012R2\Orchestrator\SetupOrchestrator.exe incorrect version

      System Center 2012 R2 Virtual Machine Manager… Failed
      C:\Installer\SystemCenter2012R2\VirtualMachineManager\setup.exe incorrect version

      For the second case, you need to do the following.

      19. Administrators need to copy the setup files from the ISOs of Windows Server 2012, Windows Server 2012 R2 and System Center 2012 R2 to the folders which we created.

      Ref: Using PowerShell Deployment Toolkit to deploy System Center 2012 R2 for lab environment - part 1

      http://terrytlslau.tls1.cc/2014/06/using-powershell-deployment-toolkit-to.html

      Best regards,
      Terry

      Delete