{"id":467,"date":"2014-10-28T00:01:00","date_gmt":"2014-10-28T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2014\/10\/28\/automatedlab-tutorial-part-3-working-with-predefined-server-roles\/"},"modified":"2022-06-22T13:07:00","modified_gmt":"2022-06-22T20:07:00","slug":"automatedlab-tutorial-part-3-working-with-predefined-server-roles","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/automatedlab-tutorial-part-3-working-with-predefined-server-roles\/","title":{"rendered":"AutomatedLab Tutorial Part 3: Working with Predefined Server Roles"},"content":{"rendered":"<p><b style=\"font-size:12px\">Summary<\/b><span style=\"font-size:12px\">: Learn how to predefine server roles and switch the operating system to Windows 10 Technical Preview in your AutomatedLab environment.<\/span><\/p>\n<p>Microsoft Scripting Guy, Ed Wilson, is here. Today brings us Part 3 in a series by Microsoft PFEs, Raimund Andree and Per Pedersen. The last blog post explained how to create a small lab environment using AutomatedLab. This post explains how to extend the lab you created by predefining server roles and switching the operating system to Windows 10 Technical Preview.<\/p>\n<p>To catch up, read:<\/p>\n<ul>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/scripting\/automatedlab-tutorial-part-1-introduction-to-automatedlab\/\" target=\"_blank\" rel=\"noopener\">AutomatedLab Tutorial Part\u00a01: Introduction to AutomatedLab<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/scripting\/automatedlab-tutorial-part-2-create-a-simple-lab\/\" target=\"_blank\" rel=\"noopener\">AutomatedLab Tutorial Part 2: Create a Simple Lab<\/a><\/li>\n<\/ul>\n<h2>Installation<\/h2>\n<p>If you have a version of AutomatedLab that is earlier than AutomatedLab\u00a02.5, please uninstall it and install the latest version. You can find what you need on Microsoft TechNet: <a href=\"https:\/\/gallery.technet.microsoft.com\/AutomatedLab-026d81f9\" target=\"_blank\" rel=\"noopener\">AutomatedLab<\/a>.<\/p>\n<p>The installation process for AutomatedLab is explained in <a href=\"https:\/\/devblogs.microsoft.com\/scripting\/automatedlab-tutorial-part-2-create-a-simple-lab\/\" target=\"_blank\" rel=\"noopener\">AutomatedLab Tutorial Part 2: Create a Simple Lab<\/a>.<\/p>\n<h2>Prerequisites for extending the lab<\/h2>\n<p>Today our goal is to extend the lab we created in Part\u00a02 of this series. The steps described in Part 2 must be completed before you attempt this process.<\/p>\n<p>Adding operating systems and products requires that the respective ISO images are available on the Hyper-V host.\u00a0<span style=\"font-size:12px\">To get a list of available operating systems, use the \u00a0<\/span><b style=\"font-size:12px\">Get-LabAvailableOperatingSystems\u00a0<\/b><span style=\"font-size:12px\">cmdlet.\u00a0When you point to the\u00a0<\/span><b style=\"font-size:12px\">LabSources<\/b><span style=\"font-size:12px\">\u00a0folder, the cmdlet will mount each ISO found in the folder hierarchy and return the available operating systems.<\/span><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-10-28-14-1.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-10-28-14-1.png\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p style=\"margin-left:30px\">\n  <b>Note<\/b>\u00a0\u00a0The output shows that the operating system name you are going to use later is\u00a0<b>&#8216;Windows Server vNext SERVERDATACENTER&#8217;<\/b>.\n<\/p>\n<p>The following ISO images need to be downloaded to the \\LabSources\\ISOs folder:<\/p>\n<ul>\n<li>Windows Server Technical Preview (x64) &#8211; DVD (English)<\/li>\n<li>Exchange Server\u00a02013 with Service Pack 1 (x64)<\/li>\n<li>SQL Server\u00a02012\u00a0R2<\/li>\n<\/ul>\n<p>Later, the operating system for all the machines in the lab needs to be changed to have AutomatedLab install Windows 10 Technical Preview.\u00a0<\/p>\n<h2>Remove the previous lab<\/h2>\n<p>If the test lab that we created in the previous post still exists on the Hyper-V host, it needs to be removed. This is required because the domain controller should run on Windows 10 and the Active Directory forest needs to be re-created.<\/p>\n<p>To remove the existing lab, open an elevated command prompt in Windows PowerShell and run the following command:<\/p>\n<p>Remove-Lab \u2013Path <LabPath>\\Lab.xml<\/p>\n<p style=\"margin-left:30px\">\n  <b>Warning<\/b>\u00a0\u00a0This command removes the virtual machines running Hyper-V, the VHDs, and the virtual network switch. There is no way to undo this change.\n<\/p>\n<p>The <strong>Remove-Lab<\/strong> cmdlet is also quite helpful if you have to perform tests multiple times and you do not want to use checkpoints. Creating a lab over and over again requires calling the lab build script. Removing a large lab with many virtual machines can be quite a boring task and fault prone (for example, forgetting to remove a virtual machine or VHD). The more you use AutomatedLab, the more you will become accustomed to removing an entire lab because the rebuild takes only minutes.<\/p>\n<h2>Set up the new lab<\/h2>\n<p>To set up the new lab, first add the required ISOs to the lab. AutomatedLab needs to know about the ISO for Windows Server Technical Preview. The cmdlet <strong>Add-LabIsoImageDefinition<\/strong> adds the definition to the lab. It is important to flag the image as <strong>IsOperatingSystem<\/strong>. The name of the image does not matter, but it needs to be unique.<\/p>\n<p style=\"margin-left:30px\">\n  Add-LabIsoImageDefinition -Name Win10 -Path $labSources\\ISOs\\en_windows_server_technical_preview_x64_dvd_5554304.iso \u2013IsOperatingSystem\n<\/p>\n<p>The next ISOs that need to be added are the Exchange Server\u00a02013 and the SQL Server\u00a02012 images:<\/p>\n<p style=\"margin-left:30px\">\n  Add-LabIsoImageDefinition -Name Exchange2013 -Path $labSources\\ISOs\\mu_exchange_server_2013_with_sp1_x64_dvd_4059293.iso\n<\/p>\n<p style=\"margin-left:30px\">\n  Add-LabIsoImageDefinition -Name SQLServer2012 -Path $labSources\\ISOs\\en_sql_server_2012_standard_edition_with_sp1_x64_dvd_1228198.iso\n<\/p>\n<h3>Change the operating system<\/h3>\n<p>The lab that we created in Part\u00a02 contains two machines: S1DC1 and S1Server1. We need to change the operating system of the two machines in the existing lab. This is a simple find and replace operation. Replace the string <strong>&#8216;Windows Server 2012 R2 SERVERDATACENTER&#8217;<\/strong> with <strong>&#8216;Windows Server vNext SERVERDATACENTER&#8217;<\/strong>.<\/p>\n<p>The definition of the domain controller looks like this:<\/p>\n<p style=\"margin-left:30px\">\n  $role = Get-LabMachineRoleDefinition -Role RootDC -Properties @{ DomainFunctionalLevel = &#8216;Win2012R2&#8217;; ForestFunctionalLevel = &#8216;Win2012R2&#8217; }\n<\/p>\n<p style=\"margin-left:30px\">\n  Add-LabMachineDefinition -Name S1DC1 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -MemoryInMb 512 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -Network $labName `\n<\/p>\n<p style=\"margin-left:30px\">\n  -IpAddress 192.168.81.10 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -DnsServer1 192.168.81.10 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -DomainName test1.net `\n<\/p>\n<p style=\"margin-left:30px\">\n  -IsDomainJoined `\n<\/p>\n<p style=\"margin-left:30px\">\n  -Roles $role `\n<\/p>\n<p style=\"margin-left:30px\">\n  -InstallationUserCredential $installationCredential `\n<\/p>\n<p style=\"margin-left:30px\">\n  -ToolsPath $labSources\\Tools `\n<\/p>\n<p style=\"margin-left:30px\">\n  -OperatingSystem &#8216;Windows Server vNext SERVERDATACENTER&#8217;\n<\/p>\n<h3>Exchange Server role<\/h3>\n<p>The easiest way to configure machines in AutomatedLab is by using roles. However, assigning a role to a machine is not mandatory. You can also configure things manually. You can find a list of available roles that are available in AutomatedLab in <a href=\"https:\/\/devblogs.microsoft.com\/scripting\/automatedlab-tutorial-part-2-create-a-simple-lab\/\" target=\"_blank\" rel=\"noopener\">AutomatedLab Tutorial Part 2: Create a Simple Lab<\/a>.<\/p>\n<p>To add a server running Exchange Server 2013 to the current lab, the respective role needs to be selected. Use the <strong>Get-LabMachineRoleDefinition<\/strong> cmdlet for that by providing the role and additional information as a hash table.<\/p>\n<p>A basic Exchange Server\u00a02013 installation needs the following additional information:<\/p>\n<ul>\n<li><strong>OrganizationName<\/strong><br \/>\nThe name assigned to the new Exchange Server organization.<\/li>\n<li><strong>DependencySourceFolder<\/strong><br \/>\nExchange Server\u00a02013 has some prerequisites that need to be installed. AutomatedLab needs to know where to find these files.<\/li>\n<\/ul>\n<p>If you forget to specify these values, the AutomatedLab validator creates an error, and the installation will not start.<\/p>\n<p>To name the organization <strong>&#8216;TestOrg&#8217;<\/strong> and point to the <strong>SoftwarePackages<\/strong> folder in <strong>LabSources<\/strong> (the folder that contains all AutomatedLab resources), use the following command:<\/p>\n<p style=\"margin-left:30px\">\n  $role = Get-LabMachineRoleDefinition -Role Exchange -Properties @{ OrganizationName = &#8216;TestOrg&#8217;; DependencySourceFolder = &#8220;$labSources\\SoftwarePackages&#8221; }\n<\/p>\n<h3>Exchange Server definition<\/h3>\n<p>The Exchange Server role is now stored in a variable and the next task is to define the new machine that is going to run Exchange Server. Simply copy one of the servers to the clipboard and paste the machine under the <strong>S1Server1<\/strong>.<\/p>\n<p>Remember to give the new machine a new name and IP address. We also recommend that you give the Exchange Server more RAM. Finally, the previously created role needs to be assigned to this machine. Now you have the full server definition for Exchange Server 2013 running on Windows 10 Technical Preview. Here is the script:<\/p>\n<p style=\"margin-left:30px\">\n  Add-LabMachineDefinition -Name S1Ex1 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -MemoryInMb 4096 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -Network $labName `\n<\/p>\n<p style=\"margin-left:30px\">\n  -IpAddress 192.168.81.21 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -DnsServer1 192.168.81.10 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -DomainName test1.net `\n<\/p>\n<p style=\"margin-left:30px\">\n  -IsDomainJoined `\n<\/p>\n<p style=\"margin-left:30px\">\n  -Role $role `\n<\/p>\n<p style=\"margin-left:30px\">\n  -InstallationUserCredential $installationCredential `\n<\/p>\n<p style=\"margin-left:30px\">\n  -ToolsPath $labSources\\Tools `\n<\/p>\n<p style=\"margin-left:30px\">\n  -OperatingSystem &#8216;Windows Server vNext SERVERDATACENTER&#8217;\n<\/p>\n<h3>SQL\u00a0Server\u00a02012 role and server definition<\/h3>\n<p>AutomatedLab does a standard installation for SQL Server\u00a02012. There are no customizations supported yet. Therefore, defining the role for SQL Server\u00a02012 is easier, and it does not take additional parameters. Defining the SQL Server is also a mere copy and paste:<\/p>\n<p style=\"margin-left:30px\">\n  $role = Get-LabMachineRoleDefinition -Role SQLServer2012\n<\/p>\n<p style=\"margin-left:30px\">\n  Add-LabMachineDefinition -Name S1Sql1 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -MemoryInMb 4096 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -Network $labName `\n<\/p>\n<p style=\"margin-left:30px\">\n  -IpAddress 192.168.81.22 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -DnsServer1 192.168.81.10 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -DomainName test1.net `\n<\/p>\n<p style=\"margin-left:30px\">\n  -IsDomainJoined `\n<\/p>\n<p style=\"margin-left:30px\">\n  -Role $role `\n<\/p>\n<p style=\"margin-left:30px\">\n  -InstallationUserCredential $installationCredential `\n<\/p>\n<p style=\"margin-left:30px\">\n  -ToolsPath $labSources\\Tools `\n<\/p>\n<p style=\"margin-left:30px\">\n  -OperatingSystem &#8216;Windows Server vNext SERVERDATACENTER&#8217;\n<\/p>\n<p><strong>Note<\/strong>\u00a0 See the predefined <strong>PostInstallationActivity<\/strong> for SQL Server. It installs the common sample databases, Northwind and Pubs.<\/p>\n<h3>Export the lab<\/h3>\n<p>After configuring all lab definitions, you can export the lab configuration by using the <strong>Export-LabDefinition<\/strong> cmdlet. This cmdlet creates two XML files in the directory D:\\FirstLab. These files contain the configuration of the lab, which makes them persistent.<\/p>\n<p style=\"margin-left:30px\">\n  Export-LabDefinition \u2013Force\n<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/1537.A.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/1537.A.PNG\" border=\"0\" alt=\" \" \/><\/a><\/p>\n<p style=\"margin-left:30px\">\n  <b>Note<\/b>\u00a0\u00a0The Force switch overwrites existing files without asking for permission.\n<\/p>\n<h3>Installation process<\/h3>\n<p>All the lab definitions are complete. The installation of the lab is triggered with the **Install-Lab **cmdlet. But first the lab that was exported to XML needs to be imported. When a lab definition is importing, it runs through validators that to ensure that it is consistent and it can be installed. The next four lines are doing the actual hard work.<\/p>\n<p style=\"margin-left:30px\">\n  Import-Lab -Path (Get-LabDefinition).LabFilePath\n<\/p>\n<p style=\"margin-left:30px\">\n  Install-Lab -NetworkSwitches -BaseImages -VMs\n<\/p>\n<p style=\"margin-left:30px\">\n  #This sets up all Domains \/ Domain Controllers\n<\/p>\n<p style=\"margin-left:30px\">\n  Install-Lab -Domains\n<\/p>\n<p style=\"margin-left:30px\">\n  #Start the SQL Server 2012 Installation\n<\/p>\n<p style=\"margin-left:30px\">\n  Install-Lab \u2013SQLServer2012\n<\/p>\n<p style=\"margin-left:30px\">\n  #Start the Exchange 2013 Installation\n<\/p>\n<p style=\"margin-left:30px\">\n  Install-Lab -Exchange2013\n<\/p>\n<p style=\"margin-left:30px\">\n  #Start all machines which have not yet been started\n<\/p>\n<p style=\"margin-left:30px\">\n  Install-Lab -StartRemainingMachines\n<\/p>\n<p><strong>Note<\/strong>\u00a0\u00a0For details about the installation process, refer to the previous two posts in this series.<\/p>\n<h3>Create checkpoints<\/h3>\n<p>AutomatedLab comes with an easy solution to manage checkpoints for multiple machines. There is no need to handle checkpoints by using the GUI in Hyper-V or by creating Windows PowerShell loops.<\/p>\n<p>The <strong>Checkpoint-LabVM<\/strong> cmdlet can take checkpoints of a single machine or multiple machines (like the <strong>Hyper-V<\/strong> cmdlet). It can also take checkpoints of the whole lab, which is accomplished by using the switch parameter <strong>All<\/strong>, for example:<\/p>\n<p style=\"margin-left:30px\">\n  Checkpoint-LabVM -All -SnapshotName &#8216;InstallationDone&#8217;\n<\/p>\n<p>To restore from the checkpoint, simply use the following command:<\/p>\n<p style=\"margin-left:30px\">\n  Restore-LabVMSnapshot -All -SnapshotName &#8216;InstallationDone&#8217;\n<\/p>\n<p>You can also restore specific checkpoint from all machines by using the <strong>Restore-LabVMSnapshot<\/strong> cmdlet:<\/p>\n<p style=\"margin-left:30px\">\n  Restore-LabVMSnapshot -All -SnapshotName &#8216;<SomeName>&#8216;\n<\/p>\n<p><strong>Note<\/strong>\u00a0 When you call <strong>Checkpoint-LabVM<\/strong>, all virtual machines in the lab are paused before taking the checkpoints. This makes sure that checkpoints on all machines are captured at the same time, which is important for Active Directory replication, for instance. However, there can be a gap of one or two seconds, so this feature may not be suitable for all products or scenarios.<\/p>\n<h3>Remove a lab<\/h3>\n<p>Removing the small lab described in this post is quite easy. However, if a lab of 10+ machines needs to be removed, the task becomes tedious. AutomatedLab also contains a cmdlet that can help clean up all the machines used in a lab.<\/p>\n<p>The <strong>Remove-Lab<\/strong> cmdlet first removes all the virtual machines used in a lab, then the disks, and finally the network adapter. This enables you to sequentially perform lab installations first, then perform tests in the lab, remove the lab, install a new lab, perform tests, and so on.<\/p>\n<p>Of course, checkpoints that enable you to revert are also available. One of the later blog posts in this series will show how you can take advantage of this functionality.<\/p>\n<h2>The full script<\/h2>\n<p>This is how the full script should look after putting all the pieces together.<\/p>\n<p style=\"margin-left:30px\">\n  $start = Get-Date\n<\/p>\n<p style=\"margin-left:30px\">\n  $labSources = &#8216;E:\\LabSources&#8217; #here are the lab sources\n<\/p>\n<p style=\"margin-left:30px\">\n  $vmDrive = &#8216;D:&#8217; #this is the drive where to create the VMs\n<\/p>\n<p style=\"margin-left:30px\">\n  $labName = &#8216;FirstLab&#8217; #the name of the lab, VM folder and network Switch\n<\/p>\n<p style=\"margin-left:30px\">\n  #create the folder path for the lab using Join-Path\n<\/p>\n<p style=\"margin-left:30px\">\n  $labPath = Join-Path -Path $vmDrive -ChildPath $labName\n<\/p>\n<p style=\"margin-left:30px\">\n  #create the target directory if it does not exist\n<\/p>\n<p style=\"margin-left:30px\">\n  if (-not (Test-Path $labPath)) { New-Item $labPath -ItemType Directory | Out-Null }\n<\/p>\n<p style=\"margin-left:30px\">\n  New-LabDefinition -Path $labPath -VmPath $labPath -Name $labName -ReferenceDiskSizeInGB 60\n<\/p>\n<p style=\"margin-left:30px\">\n  Add-LabVirtualNetworkDefinition -Name $labName -IpAddress 192.168.81.1 -PrefixLength 24\n<\/p>\n<p style=\"margin-left:30px\">\n  Add-LabDomainDefinition -Name test1.net -AdminUser administrator -AdminPassword Password1\n<\/p>\n<p style=\"margin-left:30px\">\n  Add-LabIsoImageDefinition -Name Win10 -Path $labSources\\ISOs\\en_windows_server_technical_preview_x64_dvd_5554304.iso \u2013IsOperatingSystem\n<\/p>\n<p style=\"margin-left:30px\">\n  Add-LabIsoImageDefinition -Name Exchange2013 -Path $labSources\\ISOs\\mu_exchange_server_2013_with_sp1_x64_dvd_4059293.iso\n<\/p>\n<p style=\"margin-left:30px\">\n  Add-LabIsoImageDefinition -Name SQLServer2012 -Path $labSources\\ISOs\\en_sql_server_2012_standard_edition_with_sp1_x64_dvd_1228198.iso\n<\/p>\n<p style=\"margin-left:30px\">\n  $installationCredential = New-Object PSCredential(&#8216;Administrator&#8217;, (&#8216;Password1&#8217; | ConvertTo-SecureString -AsPlainText -Force))\n<\/p>\n<p style=\"margin-left:30px\">\n  $role = Get-LabMachineRoleDefinition -Role RootDC -Properties @{ DomainFunctionalLevel = &#8216;Win2012R2&#8217;; ForestFunctionalLevel = &#8216;Win2012R2&#8217; }\n<\/p>\n<p style=\"margin-left:30px\">\n  Add-LabMachineDefinition -Name S1DC1 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -MemoryInMb 512 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -Network $labName `\n<\/p>\n<p style=\"margin-left:30px\">\n  -IpAddress 192.168.81.10 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -DnsServer1 192.168.81.10 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -DomainName test1.net `\n<\/p>\n<p style=\"margin-left:30px\">\n  -IsDomainJoined `\n<\/p>\n<p style=\"margin-left:30px\">\n  -Roles $role `\n<\/p>\n<p style=\"margin-left:30px\">\n  -InstallationUserCredential $installationCredential `\n<\/p>\n<p style=\"margin-left:30px\">\n  -ToolsPath $labSources\\Tools `\n<\/p>\n<p style=\"margin-left:30px\">\n  -OperatingSystem &#8216;Windows Server vNext SERVERDATACENTER&#8217;\n<\/p>\n<p style=\"margin-left:30px\">\n  Add-LabMachineDefinition -Name S1Server1 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -MemoryInMb 512 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -Network $labName `\n<\/p>\n<p style=\"margin-left:30px\">\n  -IpAddress 192.168.81.20 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -DnsServer1 192.168.81.10 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -DomainName test1.net `\n<\/p>\n<p style=\"margin-left:30px\">\n  -IsDomainJoined `\n<\/p>\n<p style=\"margin-left:30px\">\n  -InstallationUserCredential $installationCredential `\n<\/p>\n<p style=\"margin-left:30px\">\n  -ToolsPath $labSources\\Tools `\n<\/p>\n<p style=\"margin-left:30px\">\n  -OperatingSystem &#8216;Windows Server vNext SERVERDATACENTER&#8217;\n<\/p>\n<p style=\"margin-left:30px\">\n  $role = Get-LabMachineRoleDefinition -Role Exchange -Properties @{ OrganizationName = &#8216;TestOrg&#8217;; DependencySourceFolder = &#8220;$labSources\\SoftwarePackages&#8221; }\n<\/p>\n<p style=\"margin-left:30px\">\n  Add-LabMachineDefinition -Name S1Ex1 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -MemoryInMb 4096 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -Network $labName `\n<\/p>\n<p style=\"margin-left:30px\">\n  -IpAddress 192.168.81.21 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -DnsServer1 192.168.81.10 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -DomainName test1.net `\n<\/p>\n<p style=\"margin-left:30px\">\n  -IsDomainJoined `\n<\/p>\n<p style=\"margin-left:30px\">\n  -Role $role `\n<\/p>\n<p style=\"margin-left:30px\">\n  -InstallationUserCredential $installationCredential `\n<\/p>\n<p style=\"margin-left:30px\">\n  -ToolsPath $labSources\\Tools `\n<\/p>\n<p style=\"margin-left:30px\">\n  -OperatingSystem &#8216;Windows Server vNext SERVERDATACENTER&#8217;\n<\/p>\n<p style=\"margin-left:30px\">\n  $role = Get-LabMachineRoleDefinition -Role SQLServer2012\n<\/p>\n<p style=\"margin-left:30px\">\n  Add-LabMachineDefinition -Name S1Sql1 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -MemoryInMb 4096 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -Network $labName `\n<\/p>\n<p style=\"margin-left:30px\">\n  -IpAddress 192.168.81.22 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -DnsServer1 192.168.81.10 `\n<\/p>\n<p style=\"margin-left:30px\">\n  -DomainName test1.net `\n<\/p>\n<p style=\"margin-left:30px\">\n  -IsDomainJoined `\n<\/p>\n<p style=\"margin-left:30px\">\n  -Role $role `\n<\/p>\n<p style=\"margin-left:30px\">\n  -InstallationUserCredential $installationCredential `\n<\/p>\n<p style=\"margin-left:30px\">\n  -ToolsPath $labSources\\Tools `\n<\/p>\n<p style=\"margin-left:30px\">\n  -OperatingSystem &#8216;Windows Server vNext SERVERDATACENTER&#8217;\n<\/p>\n<p style=\"margin-left:30px\">\n  Export-LabDefinition -ExportDefaultUnattendedXml \u2013Force\n<\/p>\n<p style=\"margin-left:30px\">\n  Import-Lab -Path (Get-LabDefinition).LabFilePath\n<\/p>\n<p style=\"margin-left:30px\">\n  Install-Lab -NetworkSwitches -BaseImages -VMs\n<\/p>\n<p style=\"margin-left:30px\">\n  #This sets up all Domains \/ Domain Controllers\n<\/p>\n<p style=\"margin-left:30px\">\n  Install-Lab -Domains\n<\/p>\n<p style=\"margin-left:30px\">\n  #Start the SQL Server 2012 Installation\n<\/p>\n<p style=\"margin-left:30px\">\n  Install-Lab \u2013SQLServer2012\n<\/p>\n<p style=\"margin-left:30px\">\n  #Start the Exchange 2013 Installation\n<\/p>\n<p style=\"margin-left:30px\">\n  Install-Lab -Exchange2013\n<\/p>\n<p style=\"margin-left:30px\">\n  #Start all machines which have not yet been started\n<\/p>\n<p style=\"margin-left:30px\">\n  Install-Lab \u2013StartRemainingMachines\n<\/p>\n<p style=\"margin-left:30px\">\n  $end = Get-Date\n<\/p>\n<p style=\"margin-left:30px\">\n  Write-Host &#8220;Setting up the lab took $($end &#8211; $start)&#8221;\n<\/p>\n<h2>What\u2019s next?<\/h2>\n<p>The next post in the series describes, how AutomatedLab can be used to set up a public key infrastructure (PKI).<\/p>\n<p>~Raimund and Per<\/p>\n<p>Thank you, Raimund and Per. Please tune in tomorrow for Part 4.<\/p>\n<p>I invite you to follow me on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\" rel=\"noopener\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\" rel=\"noopener\">Facebook<\/a>. If you have any questions, send email to me at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\" rel=\"noopener\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\" rel=\"noopener\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p><strong>Ed Wilson, Microsoft Scripting Guy<\/strong><span style=\"font-size:12px\">\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Learn how to predefine server roles and switch the operating system to Windows 10 Technical Preview in your AutomatedLab environment. Microsoft Scripting Guy, Ed Wilson, is here. Today brings us Part 3 in a series by Microsoft PFEs, Raimund Andree and Per Pedersen. The last blog post explained how to create a small lab [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[56,543,544,3,45],"class_list":["post-467","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-guest-blogger","tag-per-pedersen","tag-raimund-andree","tag-scripting-guy","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Learn how to predefine server roles and switch the operating system to Windows 10 Technical Preview in your AutomatedLab environment. Microsoft Scripting Guy, Ed Wilson, is here. Today brings us Part 3 in a series by Microsoft PFEs, Raimund Andree and Per Pedersen. The last blog post explained how to create a small lab [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/467","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=467"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/467\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=467"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=467"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=467"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}