Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<#
.SYNOPSIS
Creates an MCS catalog with MCS/IO using WriteBackCache Disk. Applicable for Citrix DaaS and on-prem.
.DESCRIPTION
Create-MCSIO-ProvScheme creates an MCS Provisioning Scheme with Write-back cache enabled and enables persisting the write-back cache disk between power cycles.
The original version of this script is compatible with Citrix Virtual Apps and Desktops 7 2507 Long Term Service Release (LTSR).
#>

# /*************************************************************************
# * Copyright © 2025. Cloud Software Group, Inc. All Rights Reserved.
# * This file is subject to the license terms contained
# * in the license file that is distributed with this file.
# *************************************************************************/

##########################
# Step 0: Set parameters #
##########################
# Add Citrix snap-ins
Add-PSSnapin -Name "Citrix.Host.Admin.V2","Citrix.MachineCreation.Admin.V2"

# [User Input Required] Setup the parameters for New-ProvScheme
$isCleanOnBoot = $true
$provisioningSchemeName = "demo-provScheme"
$availabilityZone = "us-east-1a.availabilityzone"
$subnet = "0.0.0.0``/0 (vpc-12345678910).network"
$identityPoolName = $provisioningSchemeName
$hostingUnitName = "demo-hostingunit"
$machineProfile = "XDHyp:\HostingUnits\$hostingUnitName\$availabilityZone\Demo Machine Profile VM (i-012345678910).vm"
$networkMapping = @{"0"="XDHyp:\HostingUnits\$hostingUnitName\$availabilityZone\$subnet"}
$numberOfVms = 1
$serviceOffering = "XDHyp:\HostingUnits\$hostingUnitName\T2 Medium Instance.serviceoffering"
$masterImageVm = "XDHyp:\HostingUnits\$hostingUnitName\demo-master-image (ami-12345678910).template"

#Setting WriteBackCache properties
$usesWritebackCache = $true
$writeBackCacheDiskSize = 16
$writeBackCacheMemorySize = 128

# Setting custom properties to optimize storage for MCS/IO Persistent Write Back Cache Disk Properties, Persistent WBC and Persistent OS Disk
# PersistOsDisk: True - Persist the OS disk between reboots
# PersistWBC: True - Persist the Write Back Cache disk between reboots
# WBCDiskStorageType: gp3:3000:135 - Use gp3 storage with 3000 IOPS and 135 MB/s throughput for the Write Back Cache disk
$customProperties = "AwsCaptureInstanceProperties,false;AwsOperationalResourcesTagging,True;PersistOsDisk,True;PersistWBC,True;WBCDiskStorageType,gp3:3000:135;"

# [User Input Required] Setup the parameters for New-BrokerCatalog
$allocationType = "Random"
$description = "This is meant to be use as placeholders"
$persistUserChanges = "Discard"
$sessionSupport = "MultiSession"

######################################
# Step 1: Create Provisioning Scheme #
######################################
# Create Provisioning Scheme
$createdProvScheme = New-ProvScheme -ProvisioningSchemeName $provisioningSchemeName `
-CleanOnBoot:$isCleanOnBoot `
-CustomProperties $customProperties `
-HostingUnitName $hostingUnitName `
-IdentityPoolName $identityPoolName `
-InitialBatchSizeHint $numberOfVms `
-MachineProfile $machineProfile `
-MasterImageVm $masterImageVm `
-NetworkMapping $networkMapping `
-ServiceOffering $serviceOffering `
-UseWriteBackCache:$usesWritebackCache `
-WriteBackCacheDiskSize $writeBackCacheDiskSize `
-WriteBackCacheMemorySize $writeBackCacheMemorySize

#################################
# Step 2: Create Broker Catalog #
#################################
# Create the Broker Catalog. This allows you to see the catalog in Studio
New-BrokerCatalog -Name $provisioningSchemeName `
-ProvisioningSchemeId $createdProvScheme.ProvisioningSchemeUid `
-AllocationType $allocationType `
-Description $description `
-IsRemotePC $False `
-PersistUserChanges $persistUserChanges `
-ProvisioningType "MCS" `
-Scope @() `
-SessionSupport $sessionSupport
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<#
.SYNOPSIS
Creates an MCS catalog with MCS/IO using WriteBackCache Disk. Applicable for Citrix DaaS and on-prem.
.DESCRIPTION
Create-MCSIO-ProvScheme.ps1 creates an MCS Provisioning Scheme with Write-back cache enabled.
VMs created from this provisioning scheme have a Write-back cache disk.
The original version of this script is compatible with Citrix Virtual Apps and Desktops 7 2507 Long Term Service Release (LTSR).
#>

# /*************************************************************************
# * Copyright © 2025. Cloud Software Group, Inc. All Rights Reserved.
# * This file is subject to the license terms contained
# * in the license file that is distributed with this file.
# *************************************************************************/

##########################
# Step 0: Set parameters #
##########################
# Add Citrix snap-ins
Add-PSSnapin -Name "Citrix.Host.Admin.V2","Citrix.MachineCreation.Admin.V2"

# [User Input Required] Setup the parameters for New-ProvScheme
$isCleanOnBoot = $true
$provisioningSchemeName = "demo-provScheme"
$availabilityZone = "us-east-1a.availabilityzone"
$subnet = "0.0.0.0``/0 (vpc-12345678910).network"
$identityPoolName = $provisioningSchemeName
$hostingUnitName = "demo-hostingunit"
$machineProfile = "XDHyp:\HostingUnits\$hostingUnitName\$availabilityZone\Demo Machine Profile VM (i-012345678910).vm"
$networkMapping = @{"0"="XDHyp:\HostingUnits\$hostingUnitName\$availabilityZone\$subnet"}
$numberOfVms = 1
$serviceOffering = "XDHyp:\HostingUnits\$hostingUnitName\T2 Medium Instance.serviceoffering"
$masterImageVm = "XDHyp:\HostingUnits\$hostingUnitName\demo-master-image (ami-12345678910).template"

#Setting WriteBackCache properties
$usesWritebackCache = $true
$writeBackCacheDiskSize = 16
$writeBackCacheMemorySize = 128

# Setting custom properties to optimize storage for MCS/IO Persistent Write Back Cache Disk Properties, Persistent WBC and Persistent OS Disk
# PersistOsDisk: False - Do not persist the OS disk between reboots
# PersistWBC: False - Do not persist the Write Back Cache disk between reboots
# WBCDiskStorageType: gp3:3000:135 - Use gp3 storage with 3000 IOPS and 135 MB/s throughput for the Write Back Cache disk
$customProperties = "AwsCaptureInstanceProperties,false;AwsOperationalResourcesTagging,True;PersistOsDisk,False;PersistWBC,False;WBCDiskStorageType,gp3:3000:135;"

# [User Input Required] Setup the parameters for New-BrokerCatalog
$allocationType = "Random"
$description = "This is meant to be use as placeholders"
$persistUserChanges = "Discard"
$sessionSupport = "MultiSession"

######################################
# Step 1: Create Provisioning Scheme #
######################################
# Create Provisioning Scheme
$createdProvScheme = New-ProvScheme -ProvisioningSchemeName $provisioningSchemeName `
-CleanOnBoot:$isCleanOnBoot `
-CustomProperties $customProperties `
-HostingUnitName $hostingUnitName `
-IdentityPoolName $identityPoolName `
-InitialBatchSizeHint $numberOfVms `
-MachineProfile $machineProfile `
-MasterImageVm $masterImageVm `
-NetworkMapping $networkMapping `
-ServiceOffering $serviceOffering `
-UseWriteBackCache:$usesWritebackCache `
-WriteBackCacheDiskSize $writeBackCacheDiskSize `
-WriteBackCacheMemorySize $writeBackCacheMemorySize

#################################
# Step 2: Create Broker Catalog #
#################################
# Create the Broker Catalog. This allows you to see the catalog in Studio
New-BrokerCatalog -Name $provisioningSchemeName `
-ProvisioningSchemeId $createdProvScheme.ProvisioningSchemeUid `
-AllocationType $allocationType `
-Description $description `
-IsRemotePC $False `
-PersistUserChanges $persistUserChanges `
-ProvisioningType "MCS" `
-Scope @() `
-SessionSupport $sessionSupport
50 changes: 50 additions & 0 deletions AWS/ProvScheme/MCS Storage Optimization/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# MCS Storage Optimization
## Overview
When using MCS to manage random non-persistent machines in a catalog, you can enable write-back cache for machines to improve I/O performance.
Write-back cache is referred to as MCSIO. For more information, see these blog articles:

https://www.citrix.com/blogs/2016/08/03/introducing-mcs-storage-optimisation

## Leading Practices
We suggest using MCS Storage Optimization for non-persistent catalogs that are ready/write-heavy.

The required write-back cache disk storage depends on the use case. As a starting point, consider the following configuration for a medium workload:
* Desktop: 15 GB
* Server: 40-60 GB

Similarly, the RAM cache usage depends on the use case as well. As a starting point, consider the following configuration for a medium workload:
* Desktop: 512 MB
* Server: 4-8 GB

You can start with these settings and test to find the ideal configuration based on your workload. For more information on leading practices, refer to the "Disk Cache" and "RAM Cache" sections of the Citrix VDI Handbook: https://docs.citrix.com/en-us/xenapp-and-xendesktop/7-15-ltsr/downloads/Citrix%20VDI%20Handbook%207.15%20LTSR.pdf

## How to use Write-Back Cache
You can use write-back cache by using the `UseWriteBackCache` parameter along with a required parameters `WriteBackCacheDiskSize` parameter and `WriteBackCacheMemorySize`. Temporary data is initially written to the memory cache. When the memory cache reaches its configured limit, the oldest data is moved to the temporary data cache disk.
Parameter `WriteBackCacheDriveLetter` is optional and is a customized drive letter of write-back cache disk which can be any character between ‘E’ and ‘Z’. If not specified, the drive letter is auto assigned by operating system.
For details on how to configure the write-back cache to suit your solutions, check out the [Configure cache for temporary data](https://docs.citrix.com/en-us/citrix-daas/install-configure/machine-catalogs-create.html#configure-cache-for-temporary-data) page.

[Create-MCSIO-ProvScheme.ps1](Create-MCSIO-ProvScheme.ps1) gives a simple example on how to enable write-cache on your catalog.

There are other customizations that can be done on a catalog that has write-back cache enabled.

**Persisting Write-Back Cache disk**: Persist the write back cache disk for the non-persistent provisioned virtual machine between power cycles. Specify either True or False. If this property is not specified or set to False, the write back cache disk is deleted when the virtual machine is shut down, and is re-created when the virtual machine is powered on.
For example:
```powershell
$customProperties = "PersistWBC,True;"
```
**Persisting OS disk**: Persist the OS disk for the non-persistent provisioned virtual machine between power cycles. Specify either True or False. If this property is not specified or set to False, the OS Disk is deleted when the virtual machine is shut down, and is re-created when the virtual machine is powered on.
For example:
```powershell
$customProperties = "PersistOSDisk,True;"
```

**Write Back Cache Disk Volume Properties**: WBC Disk Storage Type controls the AWS Volume Type and settings for the Write Back Cache Disk. It defines the volume type which is used for the temporary disk in AWS. This parameter takes a string argument in the following format: ``` volume-type[:iops][:throughput] ```

For example:
```powershell
$customProperties = "WBCDiskStorageType,gp3:3000:135;"
```

[Create-MCSIO-ProvScheme-PersistWbc.ps1](Create-MCSIO-ProvScheme-.ps1) has an example script on how to persist write-back cache and os disk on a vm shutdown. It also defines WBC storage type.

Documentation: https://docs.citrix.com/en-us/citrix-daas/install-configure/machine-catalogs-create.html#machine-creation-services-mcs-storage-optimization
8 changes: 2 additions & 6 deletions AWS/ProvScheme/MachineProfile/Create-MachineProfile-Vm.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ $hostingUnitName = "demo-hostingunit"
$machineProfile = "XDHyp:\HostingUnits\$hostingUnitName\$availabilityZone\Demo Machine Profile VM (i-012345678910).vm"
$networkMapping = @{"0"="XDHyp:\HostingUnits\$hostingUnitName\$availabilityZone\$subnet"}
$numberOfVms = 1
$serviceOffering = "XDHyp:\HostingUnits\$hostingUnitName\T2 Medium Instance.serviceoffering"
$customProperties = "AwsCaptureInstanceProperties,false;AwsOperationalResourcesTagging,True"
$masterImageVm = "XDHyp:\HostingUnits\$hostingUnitName\demo-master-image (ami-12345678910).template"
$securityGroupPath = "XDHyp:\HostingUnits\$hostingUnitName\default.securitygroup"

# [User Input Required] Setup the parameters for New-BrokerCatalog
$allocationType = "Random"
Expand All @@ -52,10 +50,8 @@ $createdProvScheme = New-ProvScheme -ProvisioningSchemeName $provisioningSchemeN
-InitialBatchSizeHint $numberOfVms `
-MachineProfile $machineProfile `
-MasterImageVm $masterImageVm `
-NetworkMapping $networkMapping `
-SecurityGroup $securityGroupPath `
-ServiceOffering $serviceOffering

-NetworkMapping $networkMapping

#################################
# Step 2: Create Broker Catalog #
#################################
Expand Down
1 change: 1 addition & 0 deletions AWS/ProvScheme/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Get-ChildItem -Path "XDHyp:\HostingUnits\[hosting unit name]\[availability zone

There are also feature specific parameters. Check out the following links to learn more
- [MachineProfile](MachineProfile/README.md)
- [MCS Storage Optimization](MCS%20Storage%20Optimization/README.md)

Once you have the values, create the provisioning scheme with `New-ProvScheme`
```powershell
Expand Down
1 change: 1 addition & 0 deletions AWS/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Note: Unless otherwise specified, these scripts are written with Citrix DaaS in
## Features
This repository contains examples of several AWS & MCS features. Note that this is not an exhaustive list; there are many AWS & MCS features that are not listed here. The features listed below are those that currently have examples in this repository:
- [Machine Profile](ProvScheme/MachineProfile)
- [MCS Storage Optimization](ProvScheme/MCS%20Storage%20Optimization)
- [Reset Disk](ProvVM/Reset%20Disk/)
- [Image Management](Image%20Management/)

Expand Down