Some days ago I read a blog post from Bjorn Houben called SCOM2012 – Quick test lab setup OpsMgr 2012 SP1 Beta using prepared VHD.
In that blog post he described how he had used the pre-configured System Center 2012 SP1 Beta downloadable evaluation VHDs to quickly install a test lab setup for OpsMgr 2012 SP1 beta.
And that’s exactly what I needed to do too, but I wanted to take it one step further also using the Windows Server 2012 Evaluation VHD for the needed Domain Controller in my test lab setup. And to top it off, use PowerShell as much as possible.
On the 24th of December I posted a tweet with a picture showing the installation of the Domain Controller using some PowerShell scripts to automate the installation.
And since I’ve been getting requests to publish the PowerShell script I used to install the roles needed on the Domain Controller for the OpsMgr 2012 SP1 Beta test lab environment.
And because Mats Wigle told me that “Sharing is caring”, I decided to share my experiences setting up a test lab environment with PowerShell and the steps outlined by Bjorn Houben.
He should get most credits for this article, because he got me inspired.
Pre-requisites:
- Download the following VHDs:
- Extract the EVAL VHDs
- I created the following directory structure to store the extracted VHDs
- Create Hyper-V Virtual Machines using the above extracted VHDs. We are going to create two VM’s, one is the Domain Controller called OM2012SP1DC and one OM2012 SP1 Management Server called OM2012SP1MS01.
- Make sure both machines can communicate with each other. I created a Virtual Switch called Internal OM2012SP1 so both servers can communicate with each other.*
* I used a PowerShell script to create these Hyper-V switches, but this is an internal script we use for our workshops, so I cannot share this script.
Now we have the Virtual Machines ready, we can start with the installation. First we need to start with the Domain Controller (OM2012SP1DC)
Installation of Domain Controller
For the Domain Controller we need to configure the following:
- Configure a static IP address.
- Rename default computer name of EVAL Windows Server 2012 Evaluation server.
- Configure AD DS / domain controller role.
- Configure DHCP server role.
This is needed for the installation of the System Center 2012 Service Pack 1 Beta – Operations Manager – Evaluation (VHD) server which needs a DHCP server to get an initial IP address. - Configure DNS server role (if desirable, include DNS forwarder for internet DNS queries).
After starting the Virtual Machine you need to go through the walk-through of the setup.
Enter Password for Administrator Account
Remark: If you want to convert the Eval version to a full version with a Product Key of your own, you need to run the DISM tool before installing the Domain Controller Role.
Make sure you are connected to the internet!
DISM /online /Set-Edition:ServerDatacenter /ProductKey:[enter your key here] /AcceptEula
You can also continue to use the EVAL version till it expires if you want to.
To run a PowerShell script with the steps described below you need to configure the Execution Policy on the future Domain Controller.
Run the following PowerShell command from an elevated PowerShell console:
Set-ExecutionPolicy ByPass
In the following PowerShell script we are going to configure the following:
- Configure a static IP address.
- Rename default computer name of EVAL Windows Server 2012 Evaluation server.
- Configure AD DS / domain controller role.
- Configure DHCP server role.
This is needed for the installation of the System Center 2012 Service Pack 1 Beta – Operations Manager – Evaluation (VHD) server which needs a DHCP server to get an initial IP address. - Configure DNS server role (if desirable, include DNS forwarder for internet DNS queries).
Pro-Tip: Store below script in an ISO so you can easily use the script from within your Virtual Machine.
#Configure a static IP address.$IPAddress="192.168.1.101"$SubnetMask="255.255.255.0"$DefaultGateway="192.168.1.1"$DNSServers="192.168.1.101"#enter here a DNS server which can resolve (exteral) addresses Get-WmiObject Win32_NetworkAdapterConfiguration -Filter"IPEnabled=TRUE"|ForEach-Object {$_.EnableStatic($IPAddress,$SubnetMask)$_.SetGateways($DefaultGateway)$_.SetDNSServerSearchOrder($DNSServers) }#Rename Computername$NewComputerName="OM2012SP1DC"$ComputerInfo= Get-WmiObject -Class Win32_ComputerSystem$ComputerInfo.rename($NewComputerName)#Reboot ComputerRestart-Computer -Force#Configure AD DS / domain controller role.Install-WindowsFeature AD-Domain-Services -IncludeManagementTools$Password= ConvertTo-SecureString "P@ssw0rd"-AsPlainText -Force #Enter the same password you used during the initial install of the server.Install-ADDSForest -DomainName "corp.contoso.com"-SafeModeAdministratorPassword $Password-Force#Install DHCP RoleInstall-WindowsFeature DHCP -IncludeManagementTools#Create ScopeAdd-DhcpServerv4Scope -ComputerName OM2012SP1DC -Name OM2012SP1Scope `-StartRange 192.168.1.105-EndRange 192.168.1.110 ` -Description "Scope for OM2012SP1"-Type DHCP `-State Active -SubnetMask 255.255.255.0 `-LeaseDuration (New-TimeSpan -Days 1)#Set DNS Server Scope optionSet-DhcpServerv4OptionValue -OptionId 6-Value 192.168.1.101#Restart ComputerRestart-Computer -force#Authorize DHCP ServerAdd-DhcpServerInDC -DnsName OM2012SP1DC.CORP.CONTOSO.COM
We now have a Domain Controller ready for the test lab OM2012SP1 Beta Evalution VHD Virtual Machine.
Installation of the OM2012 SP1 Beta Management Server
Start the OM2012SP1 Beta Evalution VHD Virtual Machine from within Hyper-V and continue with the installation of OM2012 SP1 Beta Management Server.
When you connect with the OM2012SP1 Beta Evalution VHD Virtual Machine you need to use the Wizard to configure the Management Server.
After configuring the correct settings and clicking OK, you need to go get a cup of coffee, because the rest of the installation will take about 90 minutes to finish (on my Windows 8 Hyper-V machine).
You will see the following screens during the setup.
When finished you have your test lab OM2012 SP1 beta ready for testing. Now you only have to wait for the Public SP1 availability and upgrade to the latest version
And remember “Sharing is caring!”