Saturday, June 7, 2014

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

PowerShell Deployment Toolkit (PDT) is a set of scripts written by Rob Willis, Principal Program Manager of Microsoft, for administrators to deploy all System Center 2012 or System Center 2012 R2 components easily. However, this latest version of PDT doesn't download Windows Server 2012 or R2 and System Center 2012 or R2 components. Administrators have to download and then extract it to the specific folders. The latest of PDT is 2.64.2608. The zip file included the following files.

Downloader.ps1
Installer.ps1
Variable.xml
VariableAD.xml
VMCreator.ps1
Workflow.xml

Administrator can download PDT at the following link.


To use these scripts, administrators need to understand the files usage. In part 1, I will focus on Variable.xml, Workflow.xml and Downloader.ps1.

Variable.xml
Variable.xml is a file to store service account names, password of service accounts, VM names with configuration and the prerequisites software download path for System Center deployment.




This file is used by Downloaded.ps1, VMCreator.ps1 and Installer.ps1.

Remark: VariableAD.xml is same as variable.xml but it included some additional codes to install a virtual machine for Active Directory server role. To use variableAD.xml, administrators need to rename it from variableAD.xml to variable.xml.

Workflow.xml
Workflow.xml is a file for installer.ps1 to install System Center into the VMs and then it also is used by downloader.ps1 to check and download the software from internet. I will modify workflow.xml later.

Downloader.ps1
Downloader.ps1 is a PowerShell script to help administrators to download all prerequisites components for installation. However, it doesn't download Windows Server 2012 or Windows Server 2012 R2 operating system and System Center 2012 or System Center 2012 R2 software. Administrators download and copy the software to a folder which is stored with other prerequisites components.

Goal

  • Configure the variable.xml file
  • Download prerequisites components by Downloader.ps1

Lab environment

  • 1 standalone Windows Server 2012 R2 with Hyper-V role named HV01
  • 1 demo VM is installed Windows Server 2012 R2 for testing to download prerequisites components

Prerequisites

  • Download and extract PowerShell Deployment Toolkit (PDT) from the above link to C:\PDT

Lab
1. On a demo VM, log in as Administrator.
2. Launch "PowerShell ISE".
3. Open "VariableAD.xml".


By default, the temp path is under "$SystemDrive\Temp" and the download "Path" is "C:\Installer". Administrators can change it perform download the prerequisites components.


Then, administrators can define the user name and password for all service accounts. These service accounts are needed to create by administrators in the Active Directory. Downloader.ps1, VMCreator.ps1 and Installer.ps1 don't create the service accounts. We will configure this file again in part 2.

4. Save and exit the file.
5. Change the file name to "Variable.xml" to "Variable-Org.xml" and then change "VariableAD.xml" to "Variable.xml".


6. Launch "Windows Explorer" and then navigate to C:\.
7. Double-click "7z920-x64"to install "7 zip".


8. Double-click "wpilauncher" to install "Microsoft Web Platform Installer 5.0".


9. When installation finished, click "Exit".


10. Launch "PowerShell" as administrator.
11. Navigate to "C:\PDT".
12. Perform ".\Downloader.ps1 -DeploymentOnly" to download all prerequisites components for deploying System Center 2012 R2 because it bases on the "Variable.xml". If administrators perform ".\Downloader.ps1", the script download all components for System Center 2012 and System Center 2012 R2.


13. Enter "R".

Remark: Make sure perform "Set-ExecutionPolicy Unrestricted" before perform the PDT scripts because these scripts aren't signed.


Then, the scripts will follow workflow.xml to download and then use "7-zip" to extract the packages. Base on your internet bandwidth, it may need to take a few hours to download all prerequisites components.


If the "7-zip" and "Microsoft Web Platform Installer 5.0" isn't installed in the computer, the script remind you to install these software.


Remark: Some download links may be changed. Administrators will get the error message when it is downloading software.

To solve this issue, administrators need to update the download link in "Workflow.xml". In the above screen capture, administrators need to search this package from internet and then update the download link of "Report Viewer 2012 Redistributable".


After that, administrators have to update the "FileSize" and "Value" of "Report Viewer 2012 Redistributable".



To check the "FileSize", administrators can check the properties of the file.



To check the value, I installed "Report Viewer 2012 Redistributable" to another VM. Locate the "Value" from the following path of the registry.

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\1144BDFD2A45EC14BA98EC451C676AD9

Then, double-click "Production".




This is the value of the "Report Viewer 2012 Redistributable". Copy and paste it on the "Workflow.xml".



Then, save and exit the "Workflow.xml".

Remark: The "FileSize" and "Value" should be different on every updated files. Administrators have to manually update it on "Workflow.xml".

14. Administrators can perform ".\Downloader.ps1 -DeploymentOnly" to verify all prerequisites components to be downloaded successfully.


15. Launch "PowerShell ISE" and then open "Workflow.xml".


16. Try to find "Windows Server 2012 R2" in a script.


"Windows Server 2012 R2" is found in "workflow.xml". Next to "Value", "WindowsServer2012R2" is the folder name which we need to create under "C:\Installer" to store the Windows Server 2012 R2 setup files. Administrators also need to find all folder names of System Center 2012 R2 components.


All System Center 2012 R2 software is under "C:\Installer\SystemCenter2012R2".

17. Close "PowerShell ISE".
18. Launch "Windows Explorer" and then create the folders for Windows Server 2012, Windows Server 2012 R2 and System Center 2012 R2 under "C:\Installer" and "C:\Installer\SystemCenter2012R2".


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.



20. Back to PowerShell, perform ".\Downloader.ps1 -DeploymentOnly" to verify all components for installation.


Finally, all software are ready for installation.

In part 2, we will try to use "VMCreator.ps1" to deploy the VMs.

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

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

No comments:

Post a Comment