<Activity mc:Ignorable="sads sap" x:Class="PostInstallConfiguration.Set_RDSHDeployment" this:Set_RDSHDeployment.RDSHServers="[{}]"
 xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities"
 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 xmlns:mpa="clr-namespace:Microsoft.PowerShell.Activities;assembly=Microsoft.PowerShell.Activities"
 xmlns:mpma="clr-namespace:Microsoft.PowerShell.Management.Activities;assembly=Microsoft.PowerShell.Management.Activities"
 xmlns:mpua="clr-namespace:Microsoft.PowerShell.Utility.Activities;assembly=Microsoft.PowerShell.Utility.Activities"
 xmlns:mrc="clr-namespace:Microsoft.RemoteDesktopServices.Common;assembly=Microsoft.RemoteDesktopServices.Management.Activities"
 xmlns:mrma="clr-namespace:Microsoft.RemoteDesktopServices.Management.Activities;assembly=Microsoft.RemoteDesktopServices.Management.Activities"
 xmlns:mrmc="clr-namespace:Microsoft.RemoteDesktopServices.Management.Cmdlets;assembly=Microsoft.RemoteDesktopServices.Management.Activities"
 xmlns:mv="clr-namespace:Microsoft.VisualBasic;assembly=System"
 xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities"
 xmlns:mvc="clr-namespace:Microsoft.VisualBasic.CompilerServices;assembly=Microsoft.VisualBasic"
 xmlns:s="clr-namespace:System;assembly=mscorlib"
 xmlns:s1="clr-namespace:System;assembly=System"
 xmlns:s2="clr-namespace:System;assembly=System.Xml"
 xmlns:s3="clr-namespace:System;assembly=System.Core"
 xmlns:s4="clr-namespace:System;assembly=System.ServiceModel"
 xmlns:s5="clr-namespace:System;assembly=System.ComponentModel.Composition"
 xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities"
 xmlns:sad="clr-namespace:System.Activities.Debugger;assembly=System.Activities"
 xmlns:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger"
 xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"
 xmlns:scg="clr-namespace:System.Collections.Generic;assembly=System"
 xmlns:scg1="clr-namespace:System.Collections.Generic;assembly=System.ServiceModel"
 xmlns:scg2="clr-namespace:System.Collections.Generic;assembly=System.Core"
 xmlns:scg3="clr-namespace:System.Collections.Generic;assembly=mscorlib"
 xmlns:sd="clr-namespace:System.Data;assembly=System.Data"
 xmlns:sl="clr-namespace:System.Linq;assembly=System.Core"
 xmlns:sm="clr-namespace:System.Management;assembly=System.Management"
 xmlns:sma="clr-namespace:System.Management.Automation;assembly=System.Management.Automation"
 xmlns:smar="clr-namespace:System.Management.Automation.Remoting;assembly=System.Management.Automation"
 xmlns:sn="clr-namespace:System.Net;assembly=System"
 xmlns:st="clr-namespace:System.Text;assembly=mscorlib"
 xmlns:this="clr-namespace:PostInstallConfiguration"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <x:Members>
    <x:Property Name="RDMSServer" Type="InArgument(x:String)">
      <x:Property.Attributes>
        <RequiredArgumentAttribute />
      </x:Property.Attributes>
    </x:Property>
    <x:Property Name="Results" Type="OutArgument(sma:PSDataCollection(sma:PSObject))" />
    <x:Property Name="ErrorLog" Type="OutArgument(sma:PSDataCollection(x:String))" />
    <x:Property Name="RDSHServers" Type="InArgument(s:String[])" />
    <x:Property Name="RDWebAccessServers" Type="InArgument(x:String)" />
  </x:Members>
  <this:Set_RDSHDeployment.RDMSServer>
    <InArgument x:TypeArguments="x:String">
      <Literal x:TypeArguments="x:String" Value="" />
    </InArgument>
  </this:Set_RDSHDeployment.RDMSServer>
  <this:Set_RDSHDeployment.RDWebAccessServers>
    <InArgument x:TypeArguments="x:String">
      <Literal x:TypeArguments="x:String" Value="" />
    </InArgument>
  </this:Set_RDSHDeployment.RDWebAccessServers>
  <sap:VirtualizedContainerService.HintSize>284,1749</sap:VirtualizedContainerService.HintSize>
  <mva:VisualBasic.Settings>Assembly references and imported namespaces for internal implementation</mva:VisualBasic.Settings>
  <Sequence sap:VirtualizedContainerService.HintSize="244,1709">
    <Sequence.Variables>
      <Variable x:TypeArguments="x:String" Default="S-1-5-32-577" Name="RDMSServersGroupSID" />
      <Variable x:TypeArguments="x:String" Default="S-1-5-32-575" Name="WebAccessComputersGroupSID" />
      <Variable x:TypeArguments="x:String" Name="ShortRDMSServerName">
        <Variable.Default>
          <Literal x:TypeArguments="x:String" Value="" />
        </Variable.Default>
      </Variable>
      <Variable x:TypeArguments="sma:PSDataCollection(sma:ErrorRecord)" Name="Errors" />
      <Variable x:TypeArguments="x:String" Name="AdministratorsGroup">
        <Variable.Default>
          <Literal x:TypeArguments="x:String" Value="" />
        </Variable.Default>
      </Variable>
      <Variable x:TypeArguments="x:String" Name="RDMSServerDomain">
        <Variable.Default>
          <Literal x:TypeArguments="x:String" Value="" />
        </Variable.Default>
      </Variable>
      <Variable x:TypeArguments="x:String" Name="RDMSServersGroup">
        <Variable.Default>
          <Literal x:TypeArguments="x:String" Value="" />
        </Variable.Default>
      </Variable>
      <Variable x:TypeArguments="x:String" Name="WebAccessComputersGroup">
        <Variable.Default>
          <Literal x:TypeArguments="x:String" Value="" />
        </Variable.Default>
      </Variable>
      <Variable x:TypeArguments="x:String" Default="S-1-5-20" Name="NetworkServiceSID" />
      <Variable x:TypeArguments="x:String" Name="NetworkServiceName">
        <Variable.Default>
          <Literal x:TypeArguments="x:String" Value="" />
        </Variable.Default>
      </Variable>
      <Variable x:TypeArguments="x:String" Default="S-1-5-32-544" Name="AdministratorsGroupSID" />
      <Variable x:TypeArguments="x:String" Name="RDWebAccessDomain">
        <Variable.Default>
          <Literal x:TypeArguments="x:String" Value="" />
        </Variable.Default>
      </Variable>
      <Variable x:TypeArguments="scg3:List(x:String)" Name="SucceededRDSHServers" />
      <Variable x:TypeArguments="x:String" Name="LocalServer" />
      <Variable x:TypeArguments="x:Boolean" Name="IsLocalServerPresent" />
      <Variable x:TypeArguments="x:Int32" Name="ServerIndex" />
      <Variable x:TypeArguments="x:Boolean" Name="AddLocalServerToCollection" />
      <Variable x:TypeArguments="sma:PSObject" Name="ResultSet" />
    </Sequence.Variables>
    <mpua:WriteDebug DisplayName="Write-Debug" sap:VirtualizedContainerService.HintSize="222,22" Message="RDSH Deployment Configuration Started ...." />
    <Sequence DisplayName="InputValidation" sap:VirtualizedContainerService.HintSize="222,51">
      <mpua:WriteDebug DisplayName="Write-Debug" sap:VirtualizedContainerService.HintSize="910,22" Message="Validating Input " />
      <If Condition="[RDMSServer.Length = 0 Or (Not RDMSServer.Contains(&quot;.&quot;))]" sap:VirtualizedContainerService.HintSize="910,540">
        <If.Then>
          <TerminateWorkflow Exception="[New System.ArgumentException(&quot;Invalid Input&quot;)]" sap:VirtualizedContainerService.HintSize="200,22" Reason="[RDManagementResources.InvalidFqdnManagementServer]" />
        </If.Then>
        <If.Else>
          <Sequence sap:VirtualizedContainerService.HintSize="486,432">
            <Assign sap:VirtualizedContainerService.HintSize="464,60">
              <Assign.To>
                <OutArgument x:TypeArguments="x:String">[RDMSServerDomain]</OutArgument>
              </Assign.To>
              <Assign.Value>
                <InArgument x:TypeArguments="x:String">[Microsoft.RemoteDesktopServices.Common.CommonUtility.GetDomainNameFromLiveComputer(RDMSServer)]</InArgument>
              </Assign.Value>
            </Assign>
            <If Condition="[RDMSServerDomain.Length = 0]" sap:VirtualizedContainerService.HintSize="464,208">
              <If.Then>
                <TerminateWorkflow Exception="[New System.ArgumentException(&quot;Invalid Input&quot;)]" sap:VirtualizedContainerService.HintSize="200,22" Reason="[RDManagementResources.InvalidFqdnManagementServer]" />
              </If.Then>
            </If>
          </Sequence>
        </If.Else>
      </If>
      <If Condition="[RDSHServers.Length &gt; 0]" sap:VirtualizedContainerService.HintSize="910,1004">
        <If.Then>
          <Sequence sap:VirtualizedContainerService.HintSize="785,896">
            <ForEach x:TypeArguments="x:String" DisplayName="ForEach&lt;String&gt;" sap:VirtualizedContainerService.HintSize="763,772" Values="[RDSHServers]">
              <ActivityAction x:TypeArguments="x:String">
                <ActivityAction.Argument>
                  <DelegateInArgument x:TypeArguments="x:String" Name="Server" />
                </ActivityAction.Argument>
                <Sequence sap:VirtualizedContainerService.HintSize="733,664">
                  <If Condition="[Server.Length = 0 Or (Not Server.Contains(&quot;.&quot;))]" sap:VirtualizedContainerService.HintSize="711,540">
                    <If.Then>
                      <TerminateWorkflow Exception="[New System.ArgumentException(&quot;Invalid Input&quot;)]" sap:VirtualizedContainerService.HintSize="200,432" Reason="[RDManagementResources.InvalidFqdnSessionHost]" />
                    </If.Then>
                    <If.Else>
                      <Sequence sap:VirtualizedContainerService.HintSize="486,432">
                        <Sequence.Variables>
                          <Variable x:TypeArguments="x:String" Name="RDSHServerdomain">
                            <Variable.Default>
                              <Literal x:TypeArguments="x:String" Value="" />
                            </Variable.Default>
                          </Variable>
                        </Sequence.Variables>
                        <Assign sap:VirtualizedContainerService.HintSize="464,60">
                          <Assign.To>
                            <OutArgument x:TypeArguments="x:String">[RDSHServerdomain]</OutArgument>
                          </Assign.To>
                          <Assign.Value>
                            <InArgument x:TypeArguments="x:String">[Microsoft.RemoteDesktopServices.Common.CommonUtility.GetDomainNameFromLiveComputer(Server)]</InArgument>
                          </Assign.Value>
                        </Assign>
                        <If Condition="[RDSHServerdomain.Length = 0]" sap:VirtualizedContainerService.HintSize="464,208">
                          <If.Then>
                            <TerminateWorkflow Exception="[New System.ArgumentException(&quot;Invalid Input&quot;)]" sap:VirtualizedContainerService.HintSize="269,100" Reason="[RDManagementResources.InvalidFqdnSessionHost]" />
                          </If.Then>
                        </If>
                      </Sequence>
                    </If.Else>
                  </If>
                </Sequence>
              </ActivityAction>
            </ForEach>
          </Sequence>
        </If.Then>
      </If>
      <If Condition="[RDWebAccessServers.Length = 0]" sap:VirtualizedContainerService.HintSize="910,648">
        <If.Else>
          <If Condition="[Not RDWebAccessServers.Contains(&quot;.&quot;)]" sap:VirtualizedContainerService.HintSize="711,540">
            <If.Then>
              <TerminateWorkflow Exception="[New System.ArgumentException(&quot;Invalid Input&quot;)]" sap:VirtualizedContainerService.HintSize="200,432" Reason="[RDManagementResources.InvalidFqdnManagementServer]" />
            </If.Then>
            <If.Else>
              <Sequence sap:VirtualizedContainerService.HintSize="486,432">
                <Assign sap:VirtualizedContainerService.HintSize="464,60">
                  <Assign.To>
                    <OutArgument x:TypeArguments="x:String">[RDWebAccessDomain]</OutArgument>
                  </Assign.To>
                  <Assign.Value>
                    <InArgument x:TypeArguments="x:String">[Microsoft.RemoteDesktopServices.Common.CommonUtility.GetDomainNameFromLiveComputer(RDWebAccessServers)]</InArgument>
                  </Assign.Value>
                </Assign>
                <If Condition="[RDWebAccessDomain.Length = 0]" sap:VirtualizedContainerService.HintSize="464,208">
                  <If.Then>
                    <TerminateWorkflow Exception="[New System.ArgumentException(&quot;Invalid Input&quot;)]" sap:VirtualizedContainerService.HintSize="269,100" Reason="[RDManagementResources.InvalidFqdnWebAccess]" />
                  </If.Then>
                </If>
              </Sequence>
            </If.Else>
          </If>
        </If.Else>
      </If>
      <mpua:WriteDebug DisplayName="Write-Debug" sap:VirtualizedContainerService.HintSize="836,22" Message="Input Validation Done ...." />
    </Sequence>
    <Sequence DisplayName="Initialization" sap:VirtualizedContainerService.HintSize="222,51">
      <mpua:WriteDebug DisplayName="Write-Debug" sap:VirtualizedContainerService.HintSize="242,22" Message="Initialization Started ...." />
      <Assign sap:VirtualizedContainerService.HintSize="242,60">
        <Assign.To>
          <OutArgument x:TypeArguments="sma:PSDataCollection(x:String)">[ErrorLog]</OutArgument>
        </Assign.To>
        <Assign.Value>
          <InArgument x:TypeArguments="sma:PSDataCollection(x:String)">[New PSDataCollection(Of String)]</InArgument>
        </Assign.Value>
      </Assign>
      <Assign sap:VirtualizedContainerService.HintSize="242,60">
        <Assign.To>
          <OutArgument x:TypeArguments="sma:PSDataCollection(sma:PSObject)">[Results]</OutArgument>
        </Assign.To>
        <Assign.Value>
          <InArgument x:TypeArguments="sma:PSDataCollection(sma:PSObject)">[New PSDataCollection(Of PSObject)]</InArgument>
        </Assign.Value>
      </Assign>
      <Assign sap:VirtualizedContainerService.HintSize="242,60">
        <Assign.To>
          <OutArgument x:TypeArguments="x:String">[ShortRDMSServerName]</OutArgument>
        </Assign.To>
        <Assign.Value>
          <InArgument x:TypeArguments="x:String">[Microsoft.RemoteDesktopServices.Common.CommonUtility.GetNetbiosNameFromLiveComputer(RDMSServer)]</InArgument>
        </Assign.Value>
      </Assign>
      <Assign sap:VirtualizedContainerService.HintSize="242,60">
        <Assign.To>
          <OutArgument x:TypeArguments="x:String">[RDMSServerDomain]</OutArgument>
        </Assign.To>
        <Assign.Value>
          <InArgument x:TypeArguments="x:String">[Microsoft.RemoteDesktopServices.Common.CommonUtility.GetDomainNameFromLiveComputer(RDMSServer)]</InArgument>
        </Assign.Value>
      </Assign>
      <Assign sap:VirtualizedContainerService.HintSize="242,60">
        <Assign.To>
          <OutArgument x:TypeArguments="scg3:List(x:String)">[SucceededRDSHServers]</OutArgument>
        </Assign.To>
        <Assign.Value>
          <InArgument x:TypeArguments="scg3:List(x:String)">[New List(Of String)()]</InArgument>
        </Assign.Value>
      </Assign>
      <Sequence DisplayName="Find Localhost RDSH server" sap:VirtualizedContainerService.HintSize="242,51">
        <Sequence.Variables>
          <Variable x:TypeArguments="x:Int32" Default="0" Name="TotalServerCount" />
          <Variable x:TypeArguments="sma:PSDataCollection(sma:PSObject)" Name="ServerNameResult" />
        </Sequence.Variables>
        <mpa:InlineScript PSRemotingBehavior="{x:Null}" Command="import-module $env:windir\System32\ServerManagerInternal\rdmanagement; Get-LocalMachineFqdn" sap:VirtualizedContainerService.HintSize="242,51" Result="[ServerNameResult]">
        </mpa:InlineScript>
        <Assign sap:VirtualizedContainerService.HintSize="242,60">
          <Assign.To>
            <OutArgument x:TypeArguments="x:String">[LocalServer]</OutArgument>
          </Assign.To>
          <Assign.Value>
            <InArgument x:TypeArguments="x:String">[ServerNameResult(0).ToString()]</InArgument>
          </Assign.Value>
        </Assign>
        <Assign sap:VirtualizedContainerService.HintSize="242,60">
          <Assign.To>
            <OutArgument x:TypeArguments="x:Int32">[TotalServerCount]</OutArgument>
          </Assign.To>
          <Assign.Value>
            <InArgument x:TypeArguments="x:Int32">[RDSHServers.Length]</InArgument>
          </Assign.Value>
        </Assign>
        <Assign sap:VirtualizedContainerService.HintSize="242,60">
          <Assign.To>
            <OutArgument x:TypeArguments="x:Int32">[ServerIndex]</OutArgument>
          </Assign.To>
          <Assign.Value>
            <InArgument x:TypeArguments="x:Int32">0</InArgument>
          </Assign.Value>
        </Assign>
        <While sap:VirtualizedContainerService.HintSize="242,51">
          <While.Condition>[ServerIndex &lt; TotalServerCount]</While.Condition>
          <Sequence DisplayName="&quot;RDSH Configuration Sequence&quot;" sap:VirtualizedContainerService.HintSize="575,590">
            <Sequence.Variables>
              <Variable x:TypeArguments="x:String" Name="ServerShortName">
                <Variable.Default>
                  <Literal x:TypeArguments="x:String" Value="" />
                </Variable.Default>
              </Variable>
              <Variable x:TypeArguments="x:Boolean" Default="False" Name="IsSuccess" />
              <Variable x:TypeArguments="x:String" Name="ExceptionString" />
              <Variable x:TypeArguments="x:Boolean" Default="True" Name="Success" />
            </Sequence.Variables>
            <If Condition="[(LocalServer &lt;&gt; Nothing) and (RDSHServers(ServerIndex).equals(LocalServer, StringComparison.OrdinalIgnoreCase))]" sap:VirtualizedContainerService.HintSize="553,466">
              <If.Then>
                <Sequence sap:VirtualizedContainerService.HintSize="264,284">
                  <Assign sap:VirtualizedContainerService.HintSize="242,60">
                    <Assign.To>
                      <OutArgument x:TypeArguments="x:Boolean">[IsLocalServerPresent]</OutArgument>
                    </Assign.To>
                    <Assign.Value>
                      <InArgument x:TypeArguments="x:Boolean">True</InArgument>
                    </Assign.Value>
                  </Assign>
                  <Assign sap:VirtualizedContainerService.HintSize="242,60">
                    <Assign.To>
                      <OutArgument x:TypeArguments="x:Int32">[ServerIndex]</OutArgument>
                    </Assign.To>
                    <Assign.Value>
                      <InArgument x:TypeArguments="x:Int32">[ServerIndex + 1]</InArgument>
                    </Assign.Value>
                  </Assign>
                </Sequence>
              </If.Then>
              <If.Else>
                <Sequence sap:VirtualizedContainerService.HintSize="264,358">
                  <InvokeMethod DisplayName="Add RDSHServer to Dictionary" sap:VirtualizedContainerService.HintSize="242,134" MethodName="Add">
                    <InvokeMethod.TargetObject>
                      <InArgument x:TypeArguments="scg3:List(x:String)">[SucceededRDSHServers]</InArgument>
                    </InvokeMethod.TargetObject>
                    <InArgument x:TypeArguments="x:String">[RDSHServers(ServerIndex)]</InArgument>
                  </InvokeMethod>
                  <Assign sap:VirtualizedContainerService.HintSize="242,60">
                    <Assign.To>
                      <OutArgument x:TypeArguments="x:Int32">[ServerIndex]</OutArgument>
                    </Assign.To>
                    <Assign.Value>
                      <InArgument x:TypeArguments="x:Int32">[ServerIndex + 1]</InArgument>
                    </Assign.Value>
                  </Assign>
                </Sequence>
              </If.Else>
            </If>
          </Sequence>
        </While>
      </Sequence>
      <mpua:WriteDebug DisplayName="Write-Debug" sap:VirtualizedContainerService.HintSize="242,22" Message="Initialization Done ...." />
    </Sequence>
    <Sequence DisplayName="Installation" sap:VirtualizedContainerService.HintSize="222,696">
      <mpua:WriteProgress Activity="[RDManagementResources.ResourceManager.GetString(&quot;InstallRDCB&quot;)]" DisplayName="Write-Progress" sap:VirtualizedContainerService.HintSize="200,22" PercentComplete="-1" ProgressId="2001" />
      <Sequence DisplayName="Install RDMS" sap:VirtualizedContainerService.HintSize="200,51">
        <mpa:InlineScript PSRemotingBehavior="{x:Null}" Command="import-module $env:windir\System32\ServerManagerInternal\rdmanagement; Install-RoleService  -RoleFeatureName &quot;rds-connection-broker&quot; -PSComputerName $using:RDMSServer" sap:VirtualizedContainerService.HintSize="508,139" PSActionRunningTimeoutSec="[2000]" PSError="[Errors]" Result="[Results]" />
        <If Condition="[ (Errors.Count &gt; 0) ]" sap:VirtualizedContainerService.HintSize="508,254">
          <If.Then>
            <Sequence sap:VirtualizedContainerService.HintSize="222,146">
              <TerminateWorkflow Exception="[New RDManagementException(String.Format(RDManagementResources.ResourceManager.GetString(&quot;FailedToInstallRDRoleServices&quot;),RDManagementResources.ResourceManager.GetString(&quot;RDCBName&quot;), RDMSServer), RDMSServer, ErrorId.InstallRoleServices, Errors(0).Exception)]" sap:VirtualizedContainerService.HintSize="200,22" />
            </Sequence>
          </If.Then>
          <If.Else>
            <If Condition="[( CType(Results.Item(0).Properties(&quot;Success&quot;).Value, Boolean) &lt;&gt; true )]" sap:VirtualizedContainerService.HintSize="508,254">
              <If.Then>
                <Sequence sap:VirtualizedContainerService.HintSize="222,146">
                  <TerminateWorkflow Exception="[New RDManagementException(String.Format(RDManagementResources.ResourceManager.GetString(&quot;FailedToInstallRDRoleServices&quot;),RDManagementResources.ResourceManager.GetString(&quot;RDCBName&quot;), RDMSServer), RDMSServer, ErrorId.InstallRoleServices)]" sap:VirtualizedContainerService.HintSize="200,22" />
                </Sequence>
              </If.Then>
            </If>
          </If.Else>
        </If>
      </Sequence>
      <If Condition="[RDWebAccessServers.Length &gt; 0]" sap:VirtualizedContainerService.HintSize="200,146">
        <If.Then>
          <Sequence DisplayName="Install RDWA" sap:VirtualizedContainerService.HintSize="200,51">
            <mpua:WriteProgress Activity="[RDManagementResources.ResourceManager.GetString(&quot;InstallRDWA&quot;)]" DisplayName="Write-Progress" sap:VirtualizedContainerService.HintSize="200,22" PercentComplete="-1" ProgressId="2002" />
            <mpa:InlineScript PSRemotingBehavior="{x:Null}" Command="import-module $env:windir\System32\ServerManagerInternal\rdmanagement; Install-RoleService  -RoleFeatureName &quot;rds-web-access&quot; -PSComputerName $using:RDWebAccessServers" sap:VirtualizedContainerService.HintSize="508,139" PSActionRunningTimeoutSec="[2000]" PSError="[Errors]" Result="[Results]" />
            <If Condition="[ (Errors.Count &gt; 0) ]" sap:VirtualizedContainerService.HintSize="508,254">
              <If.Then>
                <Sequence sap:VirtualizedContainerService.HintSize="222,146">
                  <TerminateWorkflow Exception="[New RDManagementException(String.Format(RDManagementResources.ResourceManager.GetString(&quot;FailedToInstallRDRoleServices&quot;),RDManagementResources.ResourceManager.GetString(&quot;RDWAName&quot;), RDWebAccessServers), RDWebAccessServers, ErrorId.InstallRoleServices, Errors(0).Exception)]" sap:VirtualizedContainerService.HintSize="200,22" />
                </Sequence>
              </If.Then>
              <If.Else>
                <If Condition="[( CType(Results.Item(0).Properties(&quot;Success&quot;).Value, Boolean) &lt;&gt; true )]" sap:VirtualizedContainerService.HintSize="508,254">
                  <If.Then>
                    <Sequence sap:VirtualizedContainerService.HintSize="222,146">
                      <TerminateWorkflow Exception="[New RDManagementException(String.Format(RDManagementResources.ResourceManager.GetString(&quot;FailedToInstallRDRoleServices&quot;),RDManagementResources.ResourceManager.GetString(&quot;RDWAName&quot;), RDWebAccessServers), RDWebAccessServers, ErrorId.InstallRoleServices)]" sap:VirtualizedContainerService.HintSize="200,22" />
                    </Sequence>
                  </If.Then>
                </If>
              </If.Else>
            </If>
          </Sequence>
        </If.Then>
      </If>
      <mpua:WriteProgress Activity="[RDManagementResources.ResourceManager.GetString(&quot;InstallRDSHLocal&quot;)]" DisplayName="Write-Progress" sap:VirtualizedContainerService.HintSize="200,22" PercentComplete="-1" ProgressId="2003" />
      <Sequence DisplayName="Install RDSH on localhost" sap:VirtualizedContainerService.HintSize="200,51">
        <If Condition="[IsLocalServerPresent &lt;&gt; False]" sap:VirtualizedContainerService.HintSize="633,1478">
          <If.Then>
            <Sequence DisplayName="&quot;Install RDSH on Localhost&quot;" sap:VirtualizedContainerService.HintSize="508,1370">
              <Sequence.Variables>
                <Variable x:TypeArguments="x:String" Name="ServerShortName">
                  <Variable.Default>
                    <Literal x:TypeArguments="x:String" Value="" />
                  </Variable.Default>
                </Variable>
                <Variable x:TypeArguments="x:Boolean" Default="False" Name="IsSuccess" />
                <Variable x:TypeArguments="x:String" Name="ExceptionString" />
                <Variable x:TypeArguments="x:Boolean" Default="True" Name="Success" />
              </Sequence.Variables>
              <Assign sap:VirtualizedContainerService.HintSize="486,60">
                <Assign.To>
                  <OutArgument x:TypeArguments="sma:PSObject">[ResultSet]</OutArgument>
                </Assign.To>
                <Assign.Value>
                  <InArgument x:TypeArguments="sma:PSObject">[new PSObject()]</InArgument>
                </Assign.Value>
              </Assign>
              <Assign sap:VirtualizedContainerService.HintSize="486,60">
                <Assign.To>
                  <OutArgument x:TypeArguments="sma:PSDataCollection(sma:PSObject)">[Results]</OutArgument>
                </Assign.To>
                <Assign.Value>
                  <InArgument x:TypeArguments="sma:PSDataCollection(sma:PSObject)">[new PSDataCollection(of PSObject)()]</InArgument>
                </Assign.Value>
              </Assign>
              <Assign sap:VirtualizedContainerService.HintSize="486,60">
                <Assign.To>
                  <OutArgument x:TypeArguments="sma:PSDataCollection(sma:ErrorRecord)">[Errors]</OutArgument>
                </Assign.To>
                <Assign.Value>
                  <InArgument x:TypeArguments="sma:PSDataCollection(sma:ErrorRecord)">[New PSDataCollection(Of ErrorRecord)]</InArgument>
                </Assign.Value>
              </Assign>
              <Sequence sap:VirtualizedContainerService.HintSize="486,946">
                <mpa:InlineScript PSRemotingBehavior="{x:Null}" Command="import-Module servermanager;&#xD;&#xA;Add-WindowsFeature rds-rd-server -IncludeManagementTools " sap:VirtualizedContainerService.HintSize="464,51" PSComputerName="[{LocalServer}]" PSError="[Errors]" Result="[Results]">
                </mpa:InlineScript>
                <If Condition="[Errors.Count &gt; 0]" sap:VirtualizedContainerService.HintSize="1047,354">
                  <If.Then>
                    <Sequence DisplayName="Write Error" sap:VirtualizedContainerService.HintSize="264,246">
                      <Sequence.Variables>
                        <Variable x:TypeArguments="sma:ErrorRecord" Name="errorRecord" />
                      </Sequence.Variables>
                      <Assign sap:VirtualizedContainerService.HintSize="242,60">
                        <Assign.To>
                          <OutArgument x:TypeArguments="sma:ErrorRecord">[errorRecord]</OutArgument>
                        </Assign.To>
                        <Assign.Value>
                          <InArgument x:TypeArguments="sma:ErrorRecord">[ErrorUtility.GetErrorRecord(String.Format(RDManagementResources.ResourceManager.GetString(&quot;FailedToInstallRDRoleServices&quot;),RDManagementResources.ResourceManager.GetString(&quot;RDSHName&quot;), LocalServer), LocalServer, ErrorId.InstallRoleServices, Errors(0).Exception)]</InArgument>
                        </Assign.Value>
                      </Assign>
                      <mpua:WriteError DisplayName="Write-Error" ErrorRecord="[errorRecord]" sap:VirtualizedContainerService.HintSize="242,22" />
                    </Sequence>
                  </If.Then>
                </If>
                <If Condition="[Results.Count &gt; 0]" sap:VirtualizedContainerService.HintSize="464,51">
                  <If.Then>
                    <Sequence sap:VirtualizedContainerService.HintSize="240,606">
                      <InvokeMethod sap:VirtualizedContainerService.HintSize="218,134" MethodName="Add">
                        <InvokeMethod.TargetObject>
                          <InArgument x:TypeArguments="sma:PSMemberInfoCollection(sma:PSPropertyInfo)">[ResultSet.Properties]</InArgument>
                        </InvokeMethod.TargetObject>
                        <InArgument x:TypeArguments="sma:PSNoteProperty">[New PSNoteProperty("Success", CType(Results.Item(0).Properties("Success").Value, Boolean))]</InArgument>
                      </InvokeMethod>
                      <InvokeMethod sap:VirtualizedContainerService.HintSize="218,134" MethodName="Add">
                        <InvokeMethod.TargetObject>
                          <InArgument x:TypeArguments="sma:PSMemberInfoCollection(sma:PSPropertyInfo)">[ResultSet.Properties]</InArgument>
                        </InvokeMethod.TargetObject>
                        <InArgument x:TypeArguments="sma:PSNoteProperty">[New PSNoteProperty("RestartNeeded", Results.Item(0).Properties("RestartNeeded").Value.ToString())]</InArgument>
                      </InvokeMethod>
                      <InvokeMethod DisplayName="InvokeMethod" sap:VirtualizedContainerService.HintSize="218,134" MethodName="Add">
                        <InvokeMethod.TargetObject>
                          <InArgument x:TypeArguments="sma:PSMemberInfoCollection(sma:PSPropertyInfo)">[ResultSet.Properties]</InArgument>
                        </InvokeMethod.TargetObject>
                        <InArgument x:TypeArguments="sma:PSNoteProperty">[New PSNoteProperty("FeatureResult", Results.Item(0).Properties("FeatureResult").Value.ToString())]</InArgument>
                      </InvokeMethod>
                      <If Condition="[Boolean.Parse(ResultSet.Properties(&quot;Success&quot;).Value.ToString()) And (ResultSet.Properties(&quot;RestartNeeded&quot;).Value.ToString().Equals(&quot;Yes&quot;, StringComparison.InvariantCultureIgnoreCase))]" sap:VirtualizedContainerService.HintSize="800,802">
                        <If.Then>
                          <Sequence sap:VirtualizedContainerService.HintSize="286,694">
                            <Sequence.Variables>
                              <Variable x:TypeArguments="sma:PSDataCollection(sma:PSObject)" Name="RestartError" />
                            </Sequence.Variables>
                            <mpua:WriteProgress Activity="[RDManagementResources.ResourceManager.GetString(&quot;RestartPending&quot;)]" DisplayName="Write-Progress" sap:VirtualizedContainerService.HintSize="264,22" PercentComplete="0" ProgressId="1" />
                            <Assign sap:VirtualizedContainerService.HintSize="264,60">
                              <Assign.To>
                                <OutArgument x:TypeArguments="sma:PSDataCollection(sma:PSObject)">[RestartError]</OutArgument>
                              </Assign.To>
                              <Assign.Value>
                                <InArgument x:TypeArguments="sma:PSDataCollection(sma:PSObject)">[New PSDataCollection(Of PSObject)]</InArgument>
                              </Assign.Value>
                            </Assign>
                            <mpma:RestartComputer DisplayName="Restart local computer" Force="[true]" sap:VirtualizedContainerService.HintSize="264,22" PSComputerName="[{}]" />
                            <Assign sap:VirtualizedContainerService.HintSize="264,60">
                              <Assign.To>
                                <OutArgument x:TypeArguments="x:Int32">[ServerIndex]</OutArgument>
                              </Assign.To>
                              <Assign.Value>
                                <InArgument x:TypeArguments="x:Int32">0</InArgument>
                              </Assign.Value>
                            </Assign>
                            <Delay Duration="[New TimeSpan(0, 0, 15)]" sap:VirtualizedContainerService.HintSize="264,22" />
                            <Sequence DisplayName="Set AddToServerCollection" sap:VirtualizedContainerService.HintSize="264,184">
                              <Assign sap:VirtualizedContainerService.HintSize="242,60">
                                <Assign.To>
                                  <OutArgument x:TypeArguments="x:Boolean">[AddLocalServerToCollection]</OutArgument>
                                </Assign.To>
                                <Assign.Value>
                                  <InArgument x:TypeArguments="x:Boolean">True</InArgument>
                                </Assign.Value>
                              </Assign>
                            </Sequence>
                          </Sequence>
                  </If.Then>
                  <If.Else>
                    <If Condition="[Boolean.Parse(ResultSet.Properties(&quot;Success&quot;).Value.ToString()) And (ResultSet.Properties(&quot;RestartNeeded&quot;).Value.ToString().Equals(&quot;No&quot;, StringComparison.InvariantCultureIgnoreCase))]" sap:VirtualizedContainerService.HintSize="489,292">
                      <If.Then>
                        <Sequence DisplayName="Set AddToServerCollection" sap:VirtualizedContainerService.HintSize="264,184">
                          <Assign sap:VirtualizedContainerService.HintSize="242,60">
                            <Assign.To>
                              <OutArgument x:TypeArguments="x:Boolean">[AddLocalServerToCollection]</OutArgument>
                            </Assign.To>
                            <Assign.Value>
                              <InArgument x:TypeArguments="x:Boolean">True</InArgument>
                            </Assign.Value>
                          </Assign>
                        </Sequence>
                      </If.Then>
                      <If.Else>
                        <mpua:WriteError DisplayName="Write-Error" ErrorRecord="[Microsoft.RemoteDesktopServices.Management.Cmdlets.ErrorUtility.GetErrorRecord(String.Format(Microsoft.RemoteDesktopServices.Management.Activities.RDManagementResources.ResourceManager.GetString(&quot;FailedToInstallRDRoleServices&quot;), RDManagementResources.ResourceManager.GetString(&quot;RDSHName&quot;), LocalServer), LocalServer, Microsoft.RemoteDesktopServices.Common.ErrorId.InstallRoleServices, New Exception())]" sap:VirtualizedContainerService.HintSize="200,22" />
                      </If.Else>
                    </If>
                  </If.Else>
                  </If>
                </Sequence>
              </If.Then>
              <If.Else>
                <mpua:WriteError DisplayName="Write-Error" ErrorRecord="[Microsoft.RemoteDesktopServices.Management.Cmdlets.ErrorUtility.GetErrorRecord(String.Format(Microsoft.RemoteDesktopServices.Management.Activities.RDManagementResources.ResourceManager.GetString(&quot;FailedToInstallRDRoleServices&quot;), RDManagementResources.ResourceManager.GetString(&quot;RDSHName&quot;), LocalServer), LocalServer, Microsoft.RemoteDesktopServices.Common.ErrorId.InstallRoleServices, New Exception())]" sap:VirtualizedContainerService.HintSize="200,22" />
              </If.Else>
            </If>
          </Sequence>
          </Sequence>
        </If.Then>
      </If>
      </Sequence>
      <mpua:WriteProgress Activity="[RDManagementResources.ResourceManager.GetString(&quot;InstallRDSHRemote&quot;)]" DisplayName="Write-Progress" sap:VirtualizedContainerService.HintSize="200,22" PercentComplete="-1" ProgressId="2004" />
      <If Condition="[SucceededRDSHServers.Count &gt; 0]" sap:VirtualizedContainerService.HintSize="464,208">
        <If.Then>
      <Sequence DisplayName="Install RDSH on Remote servers" sap:VirtualizedContainerService.HintSize="200,51">
        <Sequence.Variables>
          <Variable x:TypeArguments="x:String" Name="ServerShortName">
            <Variable.Default>
              <Literal x:TypeArguments="x:String" Value="" />
            </Variable.Default>
          </Variable>
          <Variable x:TypeArguments="x:Boolean" Default="False" Name="IsSuccess" />
          <Variable x:TypeArguments="x:String" Name="ExceptionString" />
          <Variable x:TypeArguments="x:Boolean" Default="True" Name="Success" />
          <Variable x:TypeArguments="s:String[]" Name="InstallRDSHServers" />
        </Sequence.Variables>
        <Assign sap:VirtualizedContainerService.HintSize="796,60">
          <Assign.To>
            <OutArgument x:TypeArguments="sma:PSDataCollection(sma:ErrorRecord)">[Errors]</OutArgument>
          </Assign.To>
          <Assign.Value>
            <InArgument x:TypeArguments="sma:PSDataCollection(sma:ErrorRecord)">[New PSDataCollection(Of ErrorRecord)]</InArgument>
          </Assign.Value>
        </Assign>
        <Assign sap:VirtualizedContainerService.HintSize="796,60">
          <Assign.To>
            <OutArgument x:TypeArguments="sma:PSDataCollection(sma:PSObject)">[Results]</OutArgument>
          </Assign.To>
          <Assign.Value>
            <InArgument x:TypeArguments="sma:PSDataCollection(sma:PSObject)">[New PSDataCollection(Of PSObject)]</InArgument>
          </Assign.Value>
        </Assign>
        <Assign sap:VirtualizedContainerService.HintSize="244,60">
          <Assign.To>
            <OutArgument x:TypeArguments="s:String[]">[InstallRDSHServers]</OutArgument>
          </Assign.To>
          <Assign.Value>
            <InArgument x:TypeArguments="s:String[]">[CType(SucceededRDSHServers.ToArray(), String())]</InArgument>
          </Assign.Value>
        </Assign>
        <Sequence sap:VirtualizedContainerService.HintSize="796,2258">
          <mpa:InlineScript PSRemotingBehavior="[RemotingBehavior.Custom]" Command="import-module $env:windir\System32\ServerManagerInternal\rdmanagement; Install-RoleService -RoleFeatureName &quot;rds-rd-server&quot; -RestartIfNeeded $true -PSComputerName $pscomputername" sap:VirtualizedContainerService.HintSize="774,139" PSComputerName="[InstallRDSHServers]" PSActionRunningTimeoutSec="[3000]" PSError="[Errors]" Result="[Results]">
          </mpa:InlineScript>
          <Sequence DisplayName="Add the installed servers to collection" sap:VirtualizedContainerService.HintSize="774,1955">
            <If Condition="[Errors.Count &gt; 0]" sap:VirtualizedContainerService.HintSize="752,51">
              <If.Then>
                <Sequence sap:VirtualizedContainerService.HintSize="309,378">
                  <ForEach x:TypeArguments="sma:ErrorRecord" DisplayName="ForEach&lt;ErrorRecord&gt;" sap:VirtualizedContainerService.HintSize="287,254" Values="[Errors]">
                    <ActivityAction x:TypeArguments="sma:ErrorRecord">
                      <ActivityAction.Argument>
                        <DelegateInArgument x:TypeArguments="sma:ErrorRecord" Name="ErrorItem" />
                      </ActivityAction.Argument>
                      <Sequence sap:VirtualizedContainerService.HintSize="222,146">
                        <Sequence.Variables>
                          <Variable x:TypeArguments="x:Boolean" Name="IsRestartRequired" />
                          <Variable x:TypeArguments="x:Boolean" Name="IsRestartNotRequired" />
                        </Sequence.Variables>
                        <mpua:WriteError DisplayName="Write-Error" ErrorRecord="[ErrorItem]" sap:VirtualizedContainerService.HintSize="200,22" />
                      </Sequence>
                    </ActivityAction>
                  </ForEach>
                </Sequence>
              </If.Then>
            </If>
            <If Condition="[Results.Count &gt; 0]" sap:VirtualizedContainerService.HintSize="752,1740">
              <If.Then>
                <Sequence sap:VirtualizedContainerService.HintSize="627,1632">
                  <Assign sap:VirtualizedContainerService.HintSize="605,60">
                    <Assign.To>
                      <OutArgument x:TypeArguments="x:Int32">[ServerIndex]</OutArgument>
                    </Assign.To>
                    <Assign.Value>
                      <InArgument x:TypeArguments="x:Int32">0</InArgument>
                    </Assign.Value>
                  </Assign>
                  <Assign sap:VirtualizedContainerService.HintSize="605,60">
                    <Assign.To>
                      <OutArgument x:TypeArguments="scg3:List(x:String)">[SucceededRDSHServers]</OutArgument>
                    </Assign.To>
                    <Assign.Value>
                      <InArgument x:TypeArguments="scg3:List(x:String)">[New List(Of String)]</InArgument>
                    </Assign.Value>
                  </Assign>
                  <ForEach x:TypeArguments="sma:PSObject" DisplayName="ForEach&lt;PSObject&gt;" sap:VirtualizedContainerService.HintSize="605,1308" Values="[Results]">
                    <ActivityAction x:TypeArguments="sma:PSObject">
                      <ActivityAction.Argument>
                        <DelegateInArgument x:TypeArguments="sma:PSObject" Name="ResultItem" />
                      </ActivityAction.Argument>
                      <Sequence sap:VirtualizedContainerService.HintSize="575,1200">
                        <Sequence.Variables>
                          <Variable x:TypeArguments="x:String" Name="ResultServer" />
                          <Variable x:TypeArguments="x:Boolean" Name="IsRestartRequired" />
                          <Variable x:TypeArguments="x:Boolean" Name="IsRestartNotRequired" />
                        </Sequence.Variables>
                        <Assign sap:VirtualizedContainerService.HintSize="553,60">
                          <Assign.To>
                            <OutArgument x:TypeArguments="x:Boolean">[IsRestartRequired]</OutArgument>
                          </Assign.To>
                          <Assign.Value>
                            <InArgument x:TypeArguments="x:Boolean">False</InArgument>
                          </Assign.Value>
                        </Assign>
                        <Assign sap:VirtualizedContainerService.HintSize="553,60">
                          <Assign.To>
                            <OutArgument x:TypeArguments="x:Boolean">[IsRestartNotRequired]</OutArgument>
                          </Assign.To>
                          <Assign.Value>
                            <InArgument x:TypeArguments="x:Boolean">False</InArgument>
                          </Assign.Value>
                        </Assign>
                        <Assign sap:VirtualizedContainerService.HintSize="553,60">
                          <Assign.To>
                            <OutArgument x:TypeArguments="x:String">[ResultServer]</OutArgument>
                          </Assign.To>
                          <Assign.Value>
                            <InArgument x:TypeArguments="x:String">[ResultItem.Properties("ServerName").Value.ToString()]</InArgument>
                          </Assign.Value>
                        </Assign>
                        <Assign sap:VirtualizedContainerService.HintSize="553,60">
                          <Assign.To>
                            <OutArgument x:TypeArguments="x:Boolean">[IsRestartNotRequired]</OutArgument>
                          </Assign.To>
                          <Assign.Value>
                            <InArgument x:TypeArguments="x:Boolean">[Boolean.Parse(ResultItem.Properties("Success").Value.ToString()) And (ResultItem.Properties("RestartNeeded").Value.ToString().Equals("No", StringComparison.InvariantCultureIgnoreCase))]</InArgument>
                          </Assign.Value>
                        </Assign>
                        <If Condition="[(Boolean.Parse(ResultItem.Properties(&quot;Success&quot;).Value.ToString())) And (IsRestartNotRequired &lt;&gt; True)]" sap:VirtualizedContainerService.HintSize="553,208">
                          <If.Then>
                            <Assign sap:VirtualizedContainerService.HintSize="242,60">
                              <Assign.To>
                                <OutArgument x:TypeArguments="x:Boolean">[IsRestartRequired]</OutArgument>
                              </Assign.To>
                              <Assign.Value>
                                <InArgument x:TypeArguments="x:Boolean">[Boolean.Parse(ResultItem.Properties("Success").Value.ToString()) And (ResultItem.Properties("RestartNeeded").Value.ToString().Equals("Yes", StringComparison.InvariantCultureIgnoreCase)) And Boolean.Parse(ResultItem.Properties("RestartSuccess").Value.ToString())]</InArgument>
                              </Assign.Value>
                            </Assign>
                          </If.Then>
                        </If>
                        <If Condition="[((ResultServer &lt;&gt; Nothing) And (ResultServer.Length > 0)) And (IsRestartRequired Or IsRestartNotRequired)]" sap:VirtualizedContainerService.HintSize="553,528">
                          <If.Then>
                            <Sequence sap:VirtualizedContainerService.HintSize="264,420">
                              <InvokeMethod DisplayName="InvokeMethod" sap:VirtualizedContainerService.HintSize="242,134" MethodName="Add">
                                <InvokeMethod.TargetObject>
                                  <InArgument x:TypeArguments="scg3:List(x:String)">[SucceededRDSHServers]</InArgument>
                                </InvokeMethod.TargetObject>
                                <InArgument x:TypeArguments="x:String">[ResultServer]</InArgument>
                              </InvokeMethod>
                              <mpua:WriteProgress Activity="[ResultServer]" DisplayName="Write-Progress" sap:VirtualizedContainerService.HintSize="242,22" PercentComplete="-1" />
                              <Assign sap:VirtualizedContainerService.HintSize="242,60">
                                <Assign.To>
                                  <OutArgument x:TypeArguments="x:Int32">[ServerIndex]</OutArgument>
                                </Assign.To>
                                <Assign.Value>
                                  <InArgument x:TypeArguments="x:Int32">[ServerIndex + 1]</InArgument>
                                </Assign.Value>
                              </Assign>
                            </Sequence>
                          </If.Then>
                          <If.Else>
                            <Sequence sap:VirtualizedContainerService.HintSize="264,184">
                              <If Condition="[( CType(ResultItem.Properties(&quot;Success&quot;).Value, Boolean) &lt;&gt; true ) ]" sap:VirtualizedContainerService.HintSize="508,254">
                                <If.Then>
                                  <Sequence sap:VirtualizedContainerService.HintSize="264,246">
                                    <Sequence.Variables>
                                      <Variable x:TypeArguments="sma:ErrorRecord" Name="localErrorRecord" />
                                    </Sequence.Variables>
                                    <Assign sap:VirtualizedContainerService.HintSize="242,60">
                                      <Assign.To>
                                        <OutArgument x:TypeArguments="sma:ErrorRecord">[localErrorRecord]</OutArgument>
                                      </Assign.To>
                                      <Assign.Value>
                                        <InArgument x:TypeArguments="sma:ErrorRecord">[ErrorUtility.GetErrorRecord(string.Format(RDManagementResources.ResourceManager.GetString(&quot;FailedToInstallRDRoleServices&quot;), RDManagementResources.ResourceManager.GetString(&quot;RDSHName&quot;), ResultServer), ResultServer, ErrorId.InstallRoleServices)]</InArgument>
                                      </Assign.Value>
                                    </Assign>
                                    <mpua:WriteError DisplayName="Write consolidated errors" ErrorRecord="[localErrorRecord]" sap:VirtualizedContainerService.HintSize="242,22" />
                                  </Sequence>
                                </If.Then>
                              </If>
                              <Assign sap:VirtualizedContainerService.HintSize="242,60">
                                <Assign.To>
                                  <OutArgument x:TypeArguments="x:Int32">[ServerIndex]</OutArgument>
                                </Assign.To>
                                <Assign.Value>
                                  <InArgument x:TypeArguments="x:Int32">[ServerIndex + 1]</InArgument>
                                </Assign.Value>
                              </Assign>
                            </Sequence>
                          </If.Else>
                        </If>
                      </Sequence>
                    </ActivityAction>
                  </ForEach>
                </Sequence>
              </If.Then>
            </If>
          </Sequence>
        </Sequence>
      </Sequence>
        </If.Then>
      </If>
      <If Condition="[AddLocalServerToCollection]" sap:VirtualizedContainerService.HintSize="1238,51">
        <If.Then>
          <Sequence DisplayName="Add Localhost to installed Servers" sap:VirtualizedContainerService.HintSize="240,494">
            <Sequence.Variables>
              <Variable x:TypeArguments="sma:PSObject" Name="ResultSet" />
            </Sequence.Variables>
            <InvokeMethod DisplayName="InvokeMethod" sap:VirtualizedContainerService.HintSize="218,134" MethodName="Add">
              <InvokeMethod.TargetObject>
                <InArgument x:TypeArguments="scg3:List(x:String)">[SucceededRDSHServers]</InArgument>
              </InvokeMethod.TargetObject>
              <InArgument x:TypeArguments="x:String">[LocalServer]</InArgument>
            </InvokeMethod>
            <mpua:WriteProgress Activity="[LocalServer]" DisplayName="Write-Progress" sap:VirtualizedContainerService.HintSize="218,22" PercentComplete="-1" />
          </Sequence>
        </If.Then>
      </If>
    </Sequence>
    <Sequence DisplayName="Configure RDSH deployment" sap:VirtualizedContainerService.HintSize="222,605">
      <Sequence.Variables>
        <Variable x:TypeArguments="x:String" Name="temp" />
      </Sequence.Variables>
      <mpua:WriteProgress Activity="[RDManagementResources.ResourceManager.GetString(&quot;ConfigureRDMS&quot;)]" DisplayName="Write-Progress" sap:VirtualizedContainerService.HintSize="200,22" PercentComplete="-1" ProgressId="2005" />
      <Sequence DisplayName="Configure RDMS Server" sap:VirtualizedContainerService.HintSize="200,51">
        <Assign sap:VirtualizedContainerService.HintSize="242,60">
          <Assign.To>
            <OutArgument x:TypeArguments="sma:PSDataCollection(sma:ErrorRecord)">[Errors]</OutArgument>
          </Assign.To>
          <Assign.Value>
            <InArgument x:TypeArguments="sma:PSDataCollection(sma:ErrorRecord)">[New PSDataCollection(Of ErrorRecord)]</InArgument>
          </Assign.Value>
        </Assign>
        <mpa:InlineScript PSRemotingBehavior="{x:Null}" Command="import-module $env:windir\System32\ServerManagerInternal\rdmanagement\Add-RDManagementServer.Xaml;&#xD;&#xA;Add-RDManagementServer -RDMSServer $using:RDMSServer -DeploymentType 1" DisplayName="Configure RDMS Server" sap:VirtualizedContainerService.HintSize="242,51" PSError="[Errors]" Result="[Results]">
        </mpa:InlineScript>
        <If Condition="[Errors.Count &gt; 0]" sap:VirtualizedContainerService.HintSize="242,51">
          <If.Then>
            <Sequence sap:VirtualizedContainerService.HintSize="309,378">
              <ForEach x:TypeArguments="sma:ErrorRecord" DisplayName="ForEach&lt;ErrorRecord&gt;" sap:VirtualizedContainerService.HintSize="287,254" Values="[Errors]">
                <ActivityAction x:TypeArguments="sma:ErrorRecord">
                  <ActivityAction.Argument>
                    <DelegateInArgument x:TypeArguments="sma:ErrorRecord" Name="ErrorItem" />
                  </ActivityAction.Argument>
                  <Sequence sap:VirtualizedContainerService.HintSize="222,146">
                    <Sequence.Variables>
                      <Variable x:TypeArguments="x:Boolean" Name="IsRestartRequired" />
                      <Variable x:TypeArguments="x:Boolean" Name="IsRestartNotRequired" />
                    </Sequence.Variables>
                    <mpua:WriteError DisplayName="Write-Error" ErrorRecord="[ErrorItem]" sap:VirtualizedContainerService.HintSize="200,22" />
                  </Sequence>
                </ActivityAction>
              </ForEach>
            </Sequence>
          </If.Then>
        </If>
      </Sequence>
      <If Condition="[RDWebAccessServers.Length &gt; 0]" sap:VirtualizedContainerService.HintSize="200,486">
        <If.Then>
          <Sequence DisplayName="Configure RDWA Server" sap:VirtualizedContainerService.HintSize="200,51">
            <mpua:WriteProgress Activity="[RDManagementResources.ResourceManager.GetString(&quot;ConfigureRDWA&quot;)]" DisplayName="Write-Progress" sap:VirtualizedContainerService.HintSize="200,22" PercentComplete="-1" ProgressId="2006" />
            <Assign sap:VirtualizedContainerService.HintSize="242,60">
              <Assign.To>
                <OutArgument x:TypeArguments="sma:PSDataCollection(sma:ErrorRecord)">[Errors]</OutArgument>
              </Assign.To>
              <Assign.Value>
                <InArgument x:TypeArguments="sma:PSDataCollection(sma:ErrorRecord)">[New PSDataCollection(Of ErrorRecord)]</InArgument>
              </Assign.Value>
            </Assign>
            <mpa:InlineScript PSRemotingBehavior="{x:Null}" Command="import-module $env:windir\System32\ServerManagerInternal\rdmanagement\Add-RDWebAccessServer.Xaml;&#xD;&#xA;Add-RDWebAccessServer -RDMSServer $using:RDMSServer -RDWebAccessServers $using:RDWebAccessServers" DisplayName="Configure RDWA Server" sap:VirtualizedContainerService.HintSize="242,51" PSError="[Errors]" Result="[Results]">
            </mpa:InlineScript>
            <If Condition="[Errors.Count &gt; 0]" sap:VirtualizedContainerService.HintSize="242,51">
              <If.Then>
                <Sequence sap:VirtualizedContainerService.HintSize="309,378">
                  <ForEach x:TypeArguments="sma:ErrorRecord" DisplayName="ForEach&lt;ErrorRecord&gt;" sap:VirtualizedContainerService.HintSize="287,254" Values="[Errors]">
                    <ActivityAction x:TypeArguments="sma:ErrorRecord">
                      <ActivityAction.Argument>
                        <DelegateInArgument x:TypeArguments="sma:ErrorRecord" Name="ErrorItem" />
                      </ActivityAction.Argument>
                      <Sequence sap:VirtualizedContainerService.HintSize="222,146">
                        <Sequence.Variables>
                          <Variable x:TypeArguments="x:Boolean" Name="IsRestartRequired" />
                          <Variable x:TypeArguments="x:Boolean" Name="IsRestartNotRequired" />
                        </Sequence.Variables>
                        <mpua:WriteError DisplayName="Write-Error" ErrorRecord="[ErrorItem]" sap:VirtualizedContainerService.HintSize="200,22" />
                      </Sequence>
                    </ActivityAction>
                  </ForEach>
                </Sequence>
              </If.Then>
            </If>
          </Sequence>
        </If.Then>
      </If>
      <mpua:WriteProgress Activity="[RDManagementResources.ResourceManager.GetString(&quot;ConfigureRDSH&quot;)]" DisplayName="Write-Progress" sap:VirtualizedContainerService.HintSize="200,22" PercentComplete="-1" ProgressId="2007" />
      <Sequence DisplayName="Configure RDSH Server" sap:VirtualizedContainerService.HintSize="200,51">
        <Sequence.Variables>
          <Variable x:TypeArguments="s:String[]" Name="ConfigureRDSHServer" />
        </Sequence.Variables>
        <Assign sap:VirtualizedContainerService.HintSize="242,60">
          <Assign.To>
            <OutArgument x:TypeArguments="sma:PSDataCollection(sma:ErrorRecord)">[Errors]</OutArgument>
          </Assign.To>
          <Assign.Value>
            <InArgument x:TypeArguments="sma:PSDataCollection(sma:ErrorRecord)">[New PSDataCollection(Of ErrorRecord)]</InArgument>
          </Assign.Value>
        </Assign>
        <Assign sap:VirtualizedContainerService.HintSize="242,60">
          <Assign.To>
            <OutArgument x:TypeArguments="s:String[]">[ConfigureRDSHServer]</OutArgument>
          </Assign.To>
          <Assign.Value>
            <InArgument x:TypeArguments="s:String[]">[CType(SucceededRDSHServers.ToArray(), String())]</InArgument>
          </Assign.Value>
        </Assign>
        <mpa:InlineScript PSRemotingBehavior="{x:Null}" Command="import-module $env:windir\System32\ServerManagerInternal\rdmanagement\Add-RDSessionHostServer.Xaml; &#xD;&#xA;Add-RDSessionHostServer -RDMSServer $using:RDMSServer -RDSHServers $using:ConfigureRDSHServer" DisplayName="Configure RDSH Servers" sap:VirtualizedContainerService.HintSize="242,51" PSError="[Errors]" Result="[Results]">
        </mpa:InlineScript>
        <If Condition="[Errors.Count &gt; 0]" sap:VirtualizedContainerService.HintSize="242,51">
          <If.Then>
            <Sequence sap:VirtualizedContainerService.HintSize="309,378">
              <ForEach x:TypeArguments="sma:ErrorRecord" DisplayName="ForEach&lt;ErrorRecord&gt;" sap:VirtualizedContainerService.HintSize="287,254" Values="[Errors]">
                <ActivityAction x:TypeArguments="sma:ErrorRecord">
                  <ActivityAction.Argument>
                    <DelegateInArgument x:TypeArguments="sma:ErrorRecord" Name="ErrorItem" />
                  </ActivityAction.Argument>
                  <Sequence sap:VirtualizedContainerService.HintSize="222,146">
                    <Sequence.Variables>
                      <Variable x:TypeArguments="x:Boolean" Name="IsRestartRequired" />
                      <Variable x:TypeArguments="x:Boolean" Name="IsRestartNotRequired" />
                    </Sequence.Variables>
                    <mpua:WriteError DisplayName="Write-Error" ErrorRecord="[ErrorItem]" sap:VirtualizedContainerService.HintSize="200,22" />
                  </Sequence>
                </ActivityAction>
              </ForEach>
            </Sequence>
          </If.Then>
        </If>
      </Sequence>
      <mpua:WriteProgress Activity="[RDManagementResources.ResourceManager.GetString(&quot;FinishRDSHDeployment&quot;)]" DisplayName="Write-Progress" sap:VirtualizedContainerService.HintSize="200,22" PercentComplete="-1" ProgressId="2009" />
    </Sequence>
  </Sequence>
</Activity>
