<Activity mc:Ignorable="sads sap" x:Class="Microsoft.RemoteDesktopServices.Workflow.SetUserDataVhdSetting" this:SetUserDataVhdSetting.UserVhdShare="[Nothing]" this:SetUserDataVhdSetting.RemapMode="-1" this:SetUserDataVhdSetting.IncludeFileLocation="[Nothing]" this:SetUserDataVhdSetting.ExcludeFileLocation="[Nothing]" this:SetUserDataVhdSetting.IncludeFolderLocation="[Nothing]" this:SetUserDataVhdSetting.ExcludeFolderLocation="[Nothing]"
 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:mrc="clr-namespace:Microsoft.RemoteDesktopServices.Common;assembly=Microsoft.RemoteDesktopServices.Management.Activities"
 xmlns:mpua="clr-namespace:Microsoft.PowerShell.Utility.Activities;assembly=Microsoft.PowerShell.Utility.Activities"
 xmlns:mrma="clr-namespace:Microsoft.RemoteDesktopServices.Management.Activities;assembly=Microsoft.RemoteDesktopServices.Management.Activities"
 xmlns:mv="clr-namespace:Microsoft.VisualBasic;assembly=System"
 xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities"
 xmlns:s="clr-namespace:System;assembly=mscorlib"
 xmlns:s1="clr-namespace:System;assembly=System.Core"
 xmlns:s2="clr-namespace:System;assembly=System"
 xmlns:s3="clr-namespace:System;assembly=System.ServiceModel"
 xmlns:s4="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:sc="clr-namespace:System.Collections;assembly=mscorlib"
 xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
 xmlns:sd="clr-namespace:System.Diagnostics;assembly=System"
 xmlns:sg="clr-namespace:System.Globalization;assembly=mscorlib"
 xmlns:sm="clr-namespace:System.Management;assembly=System.Management"
 xmlns:sma="clr-namespace:System.Management.Automation;assembly=System.Management.Automation"
 xmlns:st="clr-namespace:System.Threading;assembly=mscorlib"
 xmlns:this="clr-namespace:Microsoft.RemoteDesktopServices.Workflow"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <x:Members>
    <x:Property Name="CollectionAlias" Type="InArgument(x:String)">
      <x:Property.Attributes>
        <RequiredArgumentAttribute />
      </x:Property.Attributes>
    </x:Property>
    <x:Property Name="UserVhdShare" Type="InArgument(x:String)" />
    <x:Property Name="RemapMode" Type="InArgument(x:Int32)" />
    <x:Property Name="RDMSServer" Type="InArgument(x:String)">
      <x:Property.Attributes>
        <RequiredArgumentAttribute />
      </x:Property.Attributes>
    </x:Property>
    <x:Property Name="IncludeFileLocation" Type="InArgument(s:String[])" />
    <x:Property Name="ExcludeFileLocation" Type="InArgument(s:String[])" />
    <x:Property Name="IncludeFolderLocation" Type="InArgument(s:String[])" />
    <x:Property Name="ExcludeFolderLocation" Type="InArgument(s:String[])" />
  </x:Members>
  <sap:VirtualizedContainerService.HintSize>798,2336</sap:VirtualizedContainerService.HintSize>
  <mva:VisualBasic.Settings>Assembly references and imported namespaces for internal implementation</mva:VisualBasic.Settings>
  <sap:WorkflowViewStateService.ViewState>
    <scg:Dictionary x:TypeArguments="x:String, x:Object">
      <x:Boolean x:Key="ShouldExpandAll">False</x:Boolean>
      <x:Boolean x:Key="ShouldCollapseAll">True</x:Boolean>
    </scg:Dictionary>
  </sap:WorkflowViewStateService.ViewState>
  <Sequence DisplayName="SetRDSHUserDataVhdSetting" sap:VirtualizedContainerService.HintSize="758,2296">
    <Sequence.Variables>
      <Variable x:TypeArguments="sma:PSDataCollection(sma:PSObject)" Name="vmPool" />
      <Variable x:TypeArguments="x:String" Name="vmFarmSetting" />
      <Variable x:TypeArguments="x:String" Name="userVhdSetting" />
      <Variable x:TypeArguments="mrma:UserDataVhdSetting" Name="userDataVhdSetting" />
      <Variable x:TypeArguments="sc:Hashtable" Default="[New Hashtable()]" Name="vmFarmProperties" />
      <Variable x:TypeArguments="sma:PSDataCollection(sma:PSObject)" Default="[New PSDataCollection(Of PSObject)]" Name="null" />
      <Variable x:TypeArguments="sma:PSDataCollection(sma:PSObject)" Name="cmdResult" />
      <Variable x:TypeArguments="x:String" Default="[Nothing]" Name="tempUserVHDShare" />
      <Variable x:TypeArguments="x:Boolean" Default="False" Name="UserVHDExists" />
      <Variable x:TypeArguments="sma:PSDataCollection(sma:PSObject)" Name="shareEntries" />
      <Variable x:TypeArguments="x:String" Name="shareMachine" />
      <Variable x:TypeArguments="x:String" Name="shareName" />
      <Variable x:TypeArguments="sma:PSDataCollection(sma:ErrorRecord)" Name="TemplateCreationError" />
      <Variable x:TypeArguments="x:Int64" Default="1073741824" Name="BytesInGB" />
    </Sequence.Variables>
    <sap:WorkflowViewStateService.ViewState>
      <scg:Dictionary x:TypeArguments="x:String, x:Object">
        <x:Boolean x:Key="IsExpanded">True</x:Boolean>
      </scg:Dictionary>
    </sap:WorkflowViewStateService.ViewState>
    <mpua:WriteVerbose DisplayName="Verbose: Input" sap:VirtualizedContainerService.HintSize="736,22" Message="[&quot;Alias: &quot; &amp; CollectionAlias]" />
    <Sequence DisplayName="Validate" sap:VirtualizedContainerService.HintSize="736,892">
      <Sequence.Variables>
        <Variable x:TypeArguments="x:Boolean" Default="False" Name="includeLocationSpecified" />
        <Variable x:TypeArguments="x:Boolean" Default="False" Name="remapModeNonZero" />
      </Sequence.Variables>
      <sap:WorkflowViewStateService.ViewState>
        <scg:Dictionary x:TypeArguments="x:String, x:Object">
          <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          <x:Boolean x:Key="IsPinned">True</x:Boolean>
        </scg:Dictionary>
      </sap:WorkflowViewStateService.ViewState>
      <mpa:GetWmiObject Amended="False" Class="Win32_RDSHCollection" DirectRead="False" DisplayName="GWMI: Pool" EnableAllPrivileges="False" Filter="[&quot;Alias = '&quot; &amp; CollectionAlias &amp; &quot;'&quot;]" sap:VirtualizedContainerService.HintSize="242,22" Impersonation="Impersonate" Namespace="ROOT\cimv2\rdms" PSAuthenticationLevel="PacketPrivacy" PSComputerName="[{RDMSServer}]" Result="[vmPool]" />
      <If Condition="[vmPool.Count &lt;&gt; 1]" DisplayName="CheckIfPoolExists" sap:VirtualizedContainerService.HintSize="242,51">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">False</x:Boolean>
            <x:Boolean x:Key="IsPinned">False</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
        <If.Then>
          <TerminateWorkflow sap:VirtualizedContainerService.HintSize="200,22" Reason="[String.Format(System.Globalization.CultureInfo.CurrentCulture, RDManagementResources.SpecifiedCollectionDoesNotExist, CollectionAlias)]" />
        </If.Then>
      </If>
      <Assign sap:VirtualizedContainerService.HintSize="242,60">
        <Assign.To>
          <OutArgument x:TypeArguments="mrma:UserDataVhdSetting">[userDataVhdSetting]</OutArgument>
        </Assign.To>
        <Assign.Value>
          <InArgument x:TypeArguments="mrma:UserDataVhdSetting">[RDSessionHostUserDataVhdUtility.GetUserDataVhdSetting(RDMSServer, CollectionAlias)]</InArgument>
        </Assign.Value>
      </Assign>
      <If Condition="[Not userDataVhdSetting.UserVhdEnabled]" DisplayName="CheckIfUvhdIsEnabled" sap:VirtualizedContainerService.HintSize="242,51">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">False</x:Boolean>
            <x:Boolean x:Key="IsPinned">False</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
        <If.Then>
          <TerminateWorkflow sap:VirtualizedContainerService.HintSize="200,22" Reason="[String.Format(System.Globalization.CultureInfo.CurrentCulture, RDManagementResources.UserDataVhdIsNotEnabled, CollectionAlias)]" />
        </If.Then>
      </If>
      <If Condition="[(IncludeFileLocation Is Nothing) And (IncludeFolderLocation Is Nothing)]" DisplayName="IncludeLocationSpecified" sap:VirtualizedContainerService.HintSize="242,51">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">False</x:Boolean>
            <x:Boolean x:Key="IsPinned">False</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
        <If.Then>
          <Assign sap:VirtualizedContainerService.HintSize="242,60">
            <Assign.To>
              <OutArgument x:TypeArguments="x:Boolean">[includeLocationSpecified]</OutArgument>
            </Assign.To>
            <Assign.Value>
              <InArgument x:TypeArguments="x:Boolean">[(userDataVhdSetting.IncludeFileLocation.Count + userDataVhdSetting.IncludeFolderLocation.Count) &gt; 0]</InArgument>
            </Assign.Value>
          </Assign>
        </If.Then>
        <If.Else>
          <Assign sap:VirtualizedContainerService.HintSize="242,60">
            <Assign.To>
              <OutArgument x:TypeArguments="x:Boolean">[includeLocationSpecified]</OutArgument>
            </Assign.To>
            <Assign.Value>
              <InArgument x:TypeArguments="x:Boolean">[(IncludeFileLocation.Length + IncludeFolderLocation.Length) &gt; 0]</InArgument>
            </Assign.Value>
          </Assign>
        </If.Else>
      </If>
      <If Condition="[RemapMode = -1]" DisplayName="NonZeroRemapMode" sap:VirtualizedContainerService.HintSize="242,51">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">False</x:Boolean>
            <x:Boolean x:Key="IsPinned">False</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
        <If.Then>
          <Assign sap:VirtualizedContainerService.HintSize="242,60">
            <Assign.To>
              <OutArgument x:TypeArguments="x:Boolean">[remapModeNonZero]</OutArgument>
            </Assign.To>
            <Assign.Value>
              <InArgument x:TypeArguments="x:Boolean">[userDataVhdSetting.RemapMode &lt;&gt; 0]</InArgument>
            </Assign.Value>
          </Assign>
        </If.Then>
        <If.Else>
          <Assign sap:VirtualizedContainerService.HintSize="242,60">
            <Assign.To>
              <OutArgument x:TypeArguments="x:Boolean">[remapModeNonZero]</OutArgument>
            </Assign.To>
            <Assign.Value>
              <InArgument x:TypeArguments="x:Boolean">[RemapMode &lt;&gt; 0]</InArgument>
            </Assign.Value>
          </Assign>
        </If.Else>
      </If>
      <If Condition="[remapModeNonZero And (Not includeLocationSpecified)]" DisplayName="CheckIfIncludeFolderIsSpecified" sap:VirtualizedContainerService.HintSize="242,51">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">False</x:Boolean>
            <x:Boolean x:Key="IsPinned">False</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
        <If.Then>
          <TerminateWorkflow sap:VirtualizedContainerService.HintSize="200,22" Reason="[RDManagementResources.IncludeLocationNotSpecified]" />
        </If.Then>
      </If>
      <If Condition="[Not (UserVhdShare Is Nothing)]" DisplayName="UserVhdShare" sap:VirtualizedContainerService.HintSize="242,51">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">False</x:Boolean>
            <x:Boolean x:Key="IsPinned">False</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
        <If.Then>
          <Sequence DisplayName="UVHDShare" sap:VirtualizedContainerService.HintSize="688,1111">
            <Sequence.Variables>
              <Variable x:TypeArguments="sma:PSDataCollection(sma:PSObject)" Name="vmPoolList" />
              <Variable x:TypeArguments="sma:PSDataCollection(sma:PSObject)" Name="shareAccessible" />
            </Sequence.Variables>
            <sap:WorkflowViewStateService.ViewState>
              <scg:Dictionary x:TypeArguments="x:String, x:Object">
                <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                <x:Boolean x:Key="IsPinned">True</x:Boolean>
              </scg:Dictionary>
            </sap:WorkflowViewStateService.ViewState>
            <mpa:GetWmiObject Amended="False" Class="Win32_RDSHCollection" DirectRead="False" DisplayName="GWMI: Pool" EnableAllPrivileges="False" sap:VirtualizedContainerService.HintSize="666,22" Impersonation="Impersonate" Namespace="ROOT\cimv2\rdms" PSAuthenticationLevel="PacketPrivacy" PSComputerName="[{RDMSServer}]" Result="[vmPoolList]" />
            <ForEach x:TypeArguments="sma:PSObject" DisplayName="ForEach&lt;PSObject&gt;" sap:VirtualizedContainerService.HintSize="666,772" Values="[vmPoolList]">
              <sap:WorkflowViewStateService.ViewState>
                <scg:Dictionary x:TypeArguments="x:String, x:Object">
                  <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                  <x:Boolean x:Key="IsPinned">True</x:Boolean>
                </scg:Dictionary>
              </sap:WorkflowViewStateService.ViewState>
              <ActivityAction x:TypeArguments="sma:PSObject">
                <ActivityAction.Argument>
                  <DelegateInArgument x:TypeArguments="sma:PSObject" Name="pool" />
                </ActivityAction.Argument>
                <Sequence DisplayName="UVHDShareCheck" sap:VirtualizedContainerService.HintSize="636,664">
                  <Sequence.Variables>
                    <Variable x:TypeArguments="x:String" Name="tempFarmSetting" />
                    <Variable x:TypeArguments="mrma:UserDataVhdSetting" Name="tempUvhdSetting" />
                  </Sequence.Variables>
                  <sap:WorkflowViewStateService.ViewState>
                    <scg:Dictionary x:TypeArguments="x:String, x:Object">
                      <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                      <x:Boolean x:Key="IsPinned">True</x:Boolean>
                    </scg:Dictionary>
                  </sap:WorkflowViewStateService.ViewState>
                  <Assign sap:VirtualizedContainerService.HintSize="614,60">
                    <Assign.To>
                      <OutArgument x:TypeArguments="mrma:UserDataVhdSetting">[tempUvhdSetting]</OutArgument>
                    </Assign.To>
                    <Assign.Value>
                      <InArgument x:TypeArguments="mrma:UserDataVhdSetting">[RDSessionHostUserDataVhdUtility.GetUserDataVhdSetting(RDMSServer, CType(pool.Properties("Alias").Value, String))]</InArgument>
                    </Assign.Value>
                  </Assign>
                  <If Condition="[String.Compare(tempUvhdSetting.UserVhdShare, UserVhdShare, True, System.Globalization.CultureInfo.InvariantCulture) = 0]" DisplayName="Check if uservhd share is already configured for another pool" sap:VirtualizedContainerService.HintSize="614,440">
                    <sap:WorkflowViewStateService.ViewState>
                      <scg:Dictionary x:TypeArguments="x:String, x:Object">
                        <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                        <x:Boolean x:Key="IsPinned">True</x:Boolean>
                      </scg:Dictionary>
                    </sap:WorkflowViewStateService.ViewState>
                    <If.Then>
                      <Sequence sap:VirtualizedContainerService.HintSize="489,332">
                        <sap:WorkflowViewStateService.ViewState>
                          <scg:Dictionary x:TypeArguments="x:String, x:Object">
                            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                            <x:Boolean x:Key="IsPinned">True</x:Boolean>
                          </scg:Dictionary>
                        </sap:WorkflowViewStateService.ViewState>
                        <If Condition="[String.Compare(CollectionAlias, CType(pool.Properties(&quot;Alias&quot;).Value, String), True, System.Globalization.CultureInfo.InvariantCulture) &lt;&gt; 0]" sap:VirtualizedContainerService.HintSize="467,208">
                          <sap:WorkflowViewStateService.ViewState>
                            <scg:Dictionary x:TypeArguments="x:String, x:Object">
                              <x:Boolean x:Key="IsPinned">True</x:Boolean>
                              <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                            </scg:Dictionary>
                          </sap:WorkflowViewStateService.ViewState>
                          <If.Then>
                            <TerminateWorkflow sap:VirtualizedContainerService.HintSize="200,22" Reason="[RDManagementResources.UserVhdShareIsAlreadyConfigured]" />
                          </If.Then>
                          <If.Else>
                            <Assign sap:VirtualizedContainerService.HintSize="242,60">
                              <Assign.To>
                                <OutArgument x:TypeArguments="x:Boolean">[UserVHDExists]</OutArgument>
                              </Assign.To>
                              <Assign.Value>
                                <InArgument x:TypeArguments="x:Boolean">True</InArgument>
                              </Assign.Value>
                            </Assign>
                          </If.Else>
                        </If>
                      </Sequence>
                    </If.Then>
                  </If>
                </Sequence>
              </ActivityAction>
            </ForEach>
          </Sequence>
        </If.Then>
        <If.Else>
          <Assign sap:VirtualizedContainerService.HintSize="242,60">
            <Assign.To>
              <OutArgument x:TypeArguments="x:String">[UserVhdShare]</OutArgument>
            </Assign.To>
            <Assign.Value>
              <InArgument x:TypeArguments="x:String">[userDataVhdSetting.UserVhdShare]</InArgument>
            </Assign.Value>
          </Assign>
        </If.Else>
      </If>
      <Assign sap:VirtualizedContainerService.HintSize="242,60">
        <Assign.To>
          <OutArgument x:TypeArguments="x:String">[tempUserVHDShare]</OutArgument>
        </Assign.To>
        <Assign.Value>
          <InArgument x:TypeArguments="x:String">[UserVhdShare]</InArgument>
        </Assign.Value>
      </Assign>
    </Sequence>
    <mpua:WriteVerbose DisplayName="Verbose: Validation done" sap:VirtualizedContainerService.HintSize="736,22" Message="Validation Done" />
    <If Condition="[Not UserVHDExists]" sap:VirtualizedContainerService.HintSize="736,901">
      <sap:WorkflowViewStateService.ViewState>
        <scg:Dictionary x:TypeArguments="x:String, x:Object">
          <x:Boolean x:Key="IsPinned">True</x:Boolean>
          <x:Boolean x:Key="IsExpanded">True</x:Boolean>
        </scg:Dictionary>
      </sap:WorkflowViewStateService.ViewState>
      <If.Then>
        <If Condition="[Not (UserVhdShare Is Nothing)]" DisplayName="CreateTemplateVhd" sap:VirtualizedContainerService.HintSize="611,793">
          <sap:WorkflowViewStateService.ViewState>
            <scg:Dictionary x:TypeArguments="x:String, x:Object">
              <x:Boolean x:Key="IsExpanded">True</x:Boolean>
              <x:Boolean x:Key="IsPinned">True</x:Boolean>
            </scg:Dictionary>
          </sap:WorkflowViewStateService.ViewState>
          <If.Then>
            <Sequence DisplayName="Create" sap:VirtualizedContainerService.HintSize="486,685">
              <Sequence.Variables>
                <Variable x:TypeArguments="x:String" Name="templateVhdPath" />
                <Variable x:TypeArguments="x:String" Name="scriptPath" />
                <Variable x:TypeArguments="x:Int64" Name="scriptDiskSize" />
                <Variable x:TypeArguments="x:String" Name="scriptDiskType" />
                <Variable x:TypeArguments="x:Int32" Default="0" Name="uvhdTemplateResult" />
              </Sequence.Variables>
              <sap:WorkflowViewStateService.ViewState>
                <scg:Dictionary x:TypeArguments="x:String, x:Object">
                  <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                  <x:Boolean x:Key="IsPinned">True</x:Boolean>
                </scg:Dictionary>
              </sap:WorkflowViewStateService.ViewState>
              <Assign sap:VirtualizedContainerService.HintSize="464,60">
                <Assign.To>
                  <OutArgument x:TypeArguments="x:String">[templateVhdPath]</OutArgument>
                </Assign.To>
                <Assign.Value>
                  <InArgument x:TypeArguments="x:String">[UserVhdShare &amp; "\UVHD-Template.vhdx"]</InArgument>
                </Assign.Value>
              </Assign>
              <Assign sap:VirtualizedContainerService.HintSize="464,60">
                <Assign.To>
                  <OutArgument x:TypeArguments="x:Int64">[scriptDiskSize]</OutArgument>
                </Assign.To>
                <Assign.Value>
                  <InArgument x:TypeArguments="x:Int64">[userDataVhdSetting.DiskSize \ BytesInGB]</InArgument>
                </Assign.Value>
              </Assign>
              <TryCatch sap:VirtualizedContainerService.HintSize="1147,1216">
                <TryCatch.Try>
                  <Assign sap:VirtualizedContainerService.HintSize="242,60">
                    <Assign.To>
                      <OutArgument x:TypeArguments="x:Int32">[uvhdTemplateResult]</OutArgument>
                    </Assign.To>
                    <Assign.Value>
                      <InArgument x:TypeArguments="x:Int32">[RDSessionHostUserDataVhdUtility.CreateUserDiskTemplate(RDMSServer, CollectionAlias, UserVhdShare, scriptDiskSize)]</InArgument>
                    </Assign.Value>
                  </Assign>
                </TryCatch.Try>
                <TryCatch.Catches>
                  <Catch x:TypeArguments="s:Exception" sap:VirtualizedContainerService.HintSize="490,21">
                    <ActivityAction x:TypeArguments="s:Exception">
                      <ActivityAction.Argument>
                        <DelegateInArgument x:TypeArguments="s:Exception" Name="exception" />
                      </ActivityAction.Argument>
                      <TerminateWorkflow sap:VirtualizedContainerService.HintSize="200,22" Reason="[exception.Message]" />
                    </ActivityAction>
                  </Catch>
                </TryCatch.Catches>
              </TryCatch>
            </Sequence>
          </If.Then>
        </If>
      </If.Then>
    </If>
    <mpua:WriteVerbose DisplayName="Verbose: Template VHD Created" sap:VirtualizedContainerService.HintSize="736,22" Message="Template VHD Created" />
    <Sequence DisplayName="UpdateUvhdSetting" sap:VirtualizedContainerService.HintSize="736,51">
      <Sequence.Variables>
        <Variable x:TypeArguments="x:Boolean" Default="False" Name="tempResult" />
        <Variable x:TypeArguments="sma:PSDataCollection(sma:PSObject)" Name="rdshServerList" />
        <Variable x:TypeArguments="x:String" Name="policyXML" />
      </Sequence.Variables>
      <sap:WorkflowViewStateService.ViewState>
        <scg:Dictionary x:TypeArguments="x:String, x:Object">
          <x:Boolean x:Key="IsExpanded">False</x:Boolean>
          <x:Boolean x:Key="IsPinned">False</x:Boolean>
        </scg:Dictionary>
      </sap:WorkflowViewStateService.ViewState>
      <Assign sap:VirtualizedContainerService.HintSize="538,60">
        <Assign.To>
          <OutArgument x:TypeArguments="x:String">[policyXML]</OutArgument>
        </Assign.To>
        <Assign.Value>
          <InArgument x:TypeArguments="x:String">[RDSessionHostUserDataVhdUtility.BuildPolicyXml(RemapMode, IncludeFileLocation, IncludeFolderLocation, ExcludeFileLocation, ExcludeFolderLocation)]</InArgument>
        </Assign.Value>
      </Assign>
      <Assign sap:VirtualizedContainerService.HintSize="538,60">
        <Assign.To>
          <OutArgument x:TypeArguments="x:Boolean">[tempResult]</OutArgument>
        </Assign.To>
        <Assign.Value>
          <InArgument x:TypeArguments="x:Boolean">[RDSessionHostUserDataVhdUtility.SetUserDataVhdSetting(RDMSServer, CollectionAlias, True, tempUserVHDShare, policyXML, -1, -1)]</InArgument>
        </Assign.Value>
      </Assign>
      <If Condition="[tempResult = False]" sap:VirtualizedContainerService.HintSize="538,51">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsPinned">False</x:Boolean>
            <x:Boolean x:Key="IsExpanded">False</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
        <If.Then>
          <TerminateWorkflow sap:VirtualizedContainerService.HintSize="200,22" Reason="[RDManagementResources.UnableToSetUVHDSettings]" />
        </If.Then>
      </If>
      <mpua:WriteVerbose DisplayName="Verbose: Updated Collection Level settings" sap:VirtualizedContainerService.HintSize="538,22" Message="Updated settings for RDSH Collection" />
      <Sequence DisplayName="Update Settings on RDSH servers" sap:VirtualizedContainerService.HintSize="538,1117">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
            <x:Boolean x:Key="IsPinned">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
        <mpa:GetWmiObject Amended="False" Class="Win32_RDSHServer" DirectRead="False" DisplayName="GWMI: RDSHServers" EnableAllPrivileges="False" Filter="[&quot;CollectionAlias = '&quot; &amp; CollectionAlias &amp; &quot;'&quot;]" sap:VirtualizedContainerService.HintSize="516,22" Impersonation="Impersonate" Namespace="ROOT\cimv2\rdms" PSAuthenticationLevel="PacketPrivacy" PSComputerName="[{RDMSServer}]" Result="[rdshServerList]" />
        <ParallelForEach x:TypeArguments="sma:PSObject" DisplayName="ParallelForEach&lt;PSObject&gt;" sap:VirtualizedContainerService.HintSize="516,931" Values="[rdshServerList]">
          <sap:WorkflowViewStateService.ViewState>
            <scg:Dictionary x:TypeArguments="x:String, x:Object">
              <x:Boolean x:Key="IsPinned">True</x:Boolean>
              <x:Boolean x:Key="IsExpanded">True</x:Boolean>
            </scg:Dictionary>
          </sap:WorkflowViewStateService.ViewState>
          <ActivityAction x:TypeArguments="sma:PSObject">
            <ActivityAction.Argument>
              <DelegateInArgument x:TypeArguments="sma:PSObject" Name="rdshServer" />
            </ActivityAction.Argument>
            <Sequence sap:VirtualizedContainerService.HintSize="486,823">
              <Sequence.Variables>
                <Variable x:TypeArguments="x:String" Name="ServerName" />
                <Variable x:TypeArguments="sma:PSDataCollection(sma:ErrorRecord)" Name="Errors" />
                <Variable x:TypeArguments="x:String" Name="ShortServerName" />
                <Variable x:TypeArguments="x:String" Name="ShortShareMachineName" />
                <Variable x:TypeArguments="x:String" Name="variable1" />
                <Variable x:TypeArguments="x:String" Name="LocalSharePath" />
              </Sequence.Variables>
              <sap:WorkflowViewStateService.ViewState>
                <scg:Dictionary x:TypeArguments="x:String, x:Object">
                  <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                  <x:Boolean x:Key="IsPinned">True</x:Boolean>
                </scg:Dictionary>
              </sap:WorkflowViewStateService.ViewState>
              <Assign sap:VirtualizedContainerService.HintSize="464,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="464,60">
                <Assign.To>
                  <OutArgument x:TypeArguments="x:String">[ServerName]</OutArgument>
                </Assign.To>
                <Assign.Value>
                  <InArgument x:TypeArguments="x:String">[CType(rdshServer.Properties("Name").Value, String)]</InArgument>
                </Assign.Value>
              </Assign>
              <Assign sap:VirtualizedContainerService.HintSize="464,60">
                <Assign.To>
                  <OutArgument x:TypeArguments="x:String">[ShortServerName]</OutArgument>
                </Assign.To>
                <Assign.Value>
                  <InArgument x:TypeArguments="x:String">[Microsoft.RemoteDesktopServices.Common.CommonUtility.GetNetbiosNameFromJoinedNode(RDMSServer, ServerName)]</InArgument>
                </Assign.Value>
              </Assign>
              <Assign sap:VirtualizedContainerService.HintSize="464,60">
                <Assign.To>
                  <OutArgument x:TypeArguments="x:String">[ShortShareMachineName]</OutArgument>
                </Assign.To>
                <Assign.Value>
                  <InArgument x:TypeArguments="x:String">[Microsoft.RemoteDesktopServices.Common.CommonUtility.GetNetbiosNameFromLiveComputer(shareMachine)]</InArgument>
                </Assign.Value>
              </Assign>
              <If Condition="[String.Compare(ShortServerName, ShortShareMachineName, StringComparison.OrdinalIgnoreCase) = 0]" sap:VirtualizedContainerService.HintSize="464,208">
                <sap:WorkflowViewStateService.ViewState>
                  <scg:Dictionary x:TypeArguments="x:String, x:Object">
                    <x:Boolean x:Key="IsPinned">True</x:Boolean>
                    <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                  </scg:Dictionary>
                </sap:WorkflowViewStateService.ViewState>
                <If.Then>
                  <mpa:InlineScript Command="import-module $env:windir\System32\ServerManagerInternal\rdmanagement;&#xA;Set-RDSHUserDataVHD -SessionHostServers $using:ServerName -UserVhdShare $using:UserVhdShare -UserPolicyXML $using:policyXML" sap:VirtualizedContainerService.HintSize="200,51" PSError="[Errors]" />
                </If.Then>
                <If.Else>
                  <mpa:InlineScript Command="import-module $env:windir\System32\ServerManagerInternal\rdmanagement;&#xA;Set-RDSHUserDataVHD -SessionHostServers $using:ServerName -UserVhdShare $using:tempUserVHDShare -UserPolicyXML $using:policyXML" sap:VirtualizedContainerService.HintSize="200,51" PSError="[Errors]" />
                </If.Else>
              </If>
              <If Condition="[Errors.Count &gt; 0]" sap:VirtualizedContainerService.HintSize="464,51">
                <sap:WorkflowViewStateService.ViewState>
                  <scg:Dictionary x:TypeArguments="x:String, x:Object">
                    <x:Boolean x:Key="IsPinned">False</x:Boolean>
                    <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                  </scg:Dictionary>
                </sap:WorkflowViewStateService.ViewState>
                <If.Then>
                  <Sequence sap:VirtualizedContainerService.HintSize="222,146">
                    <sap:WorkflowViewStateService.ViewState>
                      <scg:Dictionary x:TypeArguments="x:String, x:Object">
                        <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                        <x:Boolean x:Key="IsPinned">False</x:Boolean>
                      </scg:Dictionary>
                    </sap:WorkflowViewStateService.ViewState>
                    <mpua:WriteError DisplayName="Write-Error" sap:VirtualizedContainerService.HintSize="200,22" Message="[Errors.Item(0).Exception.Message]" />
                  </Sequence>
                </If.Then>
              </If>
            </Sequence>
          </ActivityAction>
        </ParallelForEach>
      </Sequence>
      <mpua:WriteVerbose DisplayName="Verbose: Updated RDSH Servers" sap:VirtualizedContainerService.HintSize="538,22" Message="Updated RDSH Servers" />
    </Sequence>
    <mpua:WriteVerbose DisplayName="Verbose: Done" sap:VirtualizedContainerService.HintSize="736,22" Message="Done!" />
  </Sequence>
</Activity>
