Citrix Virtual Apps and Desktops SDK

Schedule-ProvVMUpdate

Schedules a property update on provisioned virtual machines.

Syntax


Schedule-ProvVMUpdate -ProvisioningSchemeName <String> [-StartTimeInUTC <String>] [-StartsNow] [-DurationInMinutes <Int32>] [-LoggingId <Guid>] [-BearerToken <String>] [-TraceParent <String>] [-TraceState <String>] [-VirtualSiteId <String>] [-AdminAddress <String>] [<CommonParameters>]

Schedule-ProvVMUpdate -ProvisioningSchemeName <String> -VMName <String[]> [-StartTimeInUTC <String>] [-StartsNow] [-DurationInMinutes <Int32>] [-LoggingId <Guid>] [-BearerToken <String>] [-TraceParent <String>] [-TraceState <String>] [-VirtualSiteId <String>] [-AdminAddress <String>] [<CommonParameters>]

Schedule-ProvVMUpdate -ProvisioningSchemeUid <Guid> [-StartTimeInUTC <String>] [-StartsNow] [-DurationInMinutes <Int32>] [-LoggingId <Guid>] [-BearerToken <String>] [-TraceParent <String>] [-TraceState <String>] [-VirtualSiteId <String>] [-AdminAddress <String>] [<CommonParameters>]

Schedule-ProvVMUpdate -ProvisioningSchemeUid <Guid> -VMName <String[]> [-StartTimeInUTC <String>] [-StartsNow] [-DurationInMinutes <Int32>] [-LoggingId <Guid>] [-BearerToken <String>] [-TraceParent <String>] [-TraceState <String>] [-VirtualSiteId <String>] [-AdminAddress <String>] [<CommonParameters>]

<!--NeedCopy-->

Detailed Description

Provides the ability to synchronize the properties of existing virtual machines with any changes occurred on the provisioning scheme.

This cmdlet defines a time window where a provisioning scheme update will take place against either specific machines in a catalog or an entire catalog. The update will take place when the machine is next booted within the time window. On each VM an update is scheduled, ProvisioningSchemeUpdateRequested defines the start of the time window and ProvisioningSchemeUpdateUntil defines the end of the time window. These fields will be cleared upon a successful provisioning scheme update or if the time window has expired when the machine has booted

Parameters

Name Description Required? Pipeline Input Default Value
ProvisioningSchemeName The name of the provisioning scheme true true (ByValue, ByPropertyName)  
VMName List of VM names to schedule an update for. If not specified, all VMs in the machine catalog associated with the specified provisioning scheme will be scheduled for a property update true true (ByValue, ByPropertyName)  
ProvisioningSchemeUid The unique identifier of the provisioning scheme true false  
StartTimeInUTC The start time in UTC format of the time window the schedule is active for. Mutually exclusive with StartsNow switch. Must be no more than 5 seconds in the past. The string will be converted into a DateTime using parsing rules defined by the DateTime.Parse method, which allows for a timezone offset to specify time in any timezone. If no timezone offset is specified, UTC will be assumed. See the example usages of Schedule-ProvVMupdate or this link for more details https://docs.microsoft.com/en-us/dotnet/api/system.datetime.parse?view=net-6.0#the-string-to-parse false false  
StartsNow Whether this schedule should start right away. Mutually exclusive with specific StartTimeInUTC. Implied to be set if StartTimeInUTC is not specified false false  
DurationInMinutes The duration in minutes of the time window the schedule is active for. If less than 0, indicates the schedule has no end time false false 120 minutes
LoggingId Specifies the identifier of the high-level operation this cmdlet call forms a part of. Citrix Studio and Director typically create high-level operations. PowerShell scripts can also wrap a series of cmdlet calls in a high-level operation by way of the Start-LogHighLevelOperation and Stop-LogHighLevelOperation cmdlets. false false  
BearerToken Specifies the bearer token assigned to the calling user false false  
TraceParent Specifies the trace parent assigned for internal diagnostic tracing use false false  
TraceState Specifies the trace state assigned for internal diagnostic tracing user false false  
VirtualSiteId Specifies the virtual site the PowerShell snap-in will connect to. false false  
AdminAddress The address of a Citrix Virtual Apps and Desktops controller the PowerShell snap-in will connect to. You can provide this as a host name or an IP address. false false Localhost. Once a value is provided by any cmdlet, this value becomes the default.

Input Type

Citrix.Machinecreation.Sdk.Provisionedvirtualmachine

You can pipe an object containing parameters called ‘VMId’ and ‘ProvisioningSchemeName’ to Schedule-ProvVMUpdate.

Return Values

Notes

Running Set-ProvScheme to update provisioning scheme properties will only affect future provisioned machines. To schedule existing VMs in a catalog to be brought up to date upon the next power on, use this cmdlet to schedule certain or all VMs created from the provisioning scheme associated with the catalog to be updated.

Examples

Example 1


c:\PS> Set-ProvScheme -ProvisioningSchemeName azure-catalog -MachineProfile "XDHyp:\HostingUnits\azure-unit\machineprofile.folder\new-template.vm"

c:\PS> Get-ProvScheme | select ProvisioningSchemeName, ProvisioningSchemeVersion

ProvisioningSchemeName   ProvisioningSchemeVersion

-----------------------  --------------------------

azure-catalog                                     2

c:\PS> Get-ProvVM | select VMName, ProvisioningSchemeVersion, ProvisioningSchemeUpdateRequested, ProvisioningSchemeUpdateUntil

VMName       ProvisioningSchemeVersion  ProvisioningSchemeUpdateRequested  ProvisioningSchemeUpdateUntil

------       -------------------------  ---------------------------------  -----------------------------

azu01                              1

azu02                              1

azu03                              1

azu04                              1

c:\PS> Schedule-ProvVMUpdate -ProvisioningSchemeName azure-catalog -StartTimeInUTC "3/12/2022 3am" -DurationInMinutes 60

c:\PS> Get-ProvVM | select VMName, ProvisioningSchemeVersion, ProvisioningSchemeUpdateRequested, ProvisioningSchemeUpdateUntil

VMName       ProvisioningSchemeVersion  ProvisioningSchemeUpdateRequested  ProvisioningSchemeUpdateUntil

------       -------------------------  ---------------------------------  -----------------------------

azu01                              1               3/11/2022  11:00:00 PM         3/12/2022  12:00:00 AM

azu02                              1               3/11/2022  11:00:00 PM         3/12/2022  12:00:00 AM

azu03                              1               3/11/2022  11:00:00 PM         3/12/2022  12:00:00 AM

azu04                              1               3/11/2022  11:00:00 PM         3/12/2022  12:00:00 AM

c:\PS> Get-Date

Thursday, March 10, 2022 1:53:41 PM

c:\PS> New-BrokerHostingPowerAction -Action "Restart" -MachineName azu01

c:\PS> Get-ProvVM | select VMName, ProvisioningSchemeVersion, ProvisioningSchemeUpdateRequested, ProvisioningSchemeUpdateUntil

VMName       ProvisioningSchemeVersion  ProvisioningSchemeUpdateRequested  ProvisioningSchemeUpdateUntil

------       -------------------------  ---------------------------------  -----------------------------

azu01                              1               3/11/2022  11:00:00 PM         3/12/2022  12:00:00 AM

azu02                              1               3/11/2022  11:00:00 PM         3/12/2022  12:00:00 AM

azu03                              1               3/11/2022  11:00:00 PM         3/12/2022  12:00:00 AM

azu04                              1               3/11/2022  11:00:00 PM         3/12/2022  12:00:00 AM

c:\PS> Get-Date

Friday, March 11, 2022 11:53:41 PM

c:\PS> New-BrokerHostingPowerAction -Action "Restart" -MachineName azu01

c:\PS> Get-ProvVM | select VMName, ProvisioningSchemeVersion, ProvisioningSchemeUpdateRequested, ProvisioningSchemeUpdateUntil

VMName       ProvisioningSchemeVersion  ProvisioningSchemeUpdateRequested  ProvisioningSchemeUpdateUntil

------       -------------------------  ---------------------------------  -----------------------------

azu01                              2

azu02                              1               3/11/2022  11:00:00 PM         3/12/2022  12:00:00 AM

azu03                              1               3/11/2022  11:00:00 PM         3/12/2022  12:00:00 AM

azu04                              1               3/11/2022  11:00:00 PM         3/12/2022  12:00:00 AM

<!--NeedCopy-->

Description

Change the MachineProfile for the azure-catalog provisioning scheme with Set-ProvScheme, this increments the provisioning scheme version to 2. Schedule all 4 VMs in azure-catalog to have a property update in the time window starting 3/12/2022 at 3am UTC and lasting for 60 minutes. Times for ProvisioningSchemeUpdateRequested and ProvisioningSchemeUpdateUntil are displayed in local time (EST in this case). If the machine is booted in that time window, it will update to the latest provisioning scheme settings. The first restart in this example performs no action since it’s before the time window starts, while the second restart is within the window, so the machine is updated and the schedule is cleared.

Example 2


c:\PS> Get-ProvVM | select VMName, ProvisioningSchemeVersion, ProvisioningSchemeUpdateRequested, ProvisioningSchemeUpdateUntil

VMName       ProvisioningSchemeVersion  ProvisioningSchemeUpdateRequested  ProvisioningSchemeUpdateUntil

------       -------------------------  ---------------------------------  -----------------------------

azu01                              1

azu02                              1

azu03                              1

azu04                              1

c:\PS> $duration = New-TimeSpan -Days 2

c:\PS> Schedule-ProvVMUpdate -ProvisioningSchemeName azure-catalog -VMName azu01, azu02 -StartTimeInUTC "3/11/2022 11pm -4" -DurationInMinutes $duration.TotalMinutes

c:\PS> Get-ProvVM | select VMName, ProvisioningSchemeVersion, ProvisioningSchemeUpdateRequested, ProvisioningSchemeUpdateUntil

VMName       ProvisioningSchemeVersion  ProvisioningSchemeUpdateRequested  ProvisioningSchemeUpdateUntil

------       -------------------------  ---------------------------------  -----------------------------

azu01                              1               3/11/2022  11:00:00 PM         3/13/2022  11:00:00 PM

azu02                              1               3/11/2022  11:00:00 PM         3/13/2022  11:00:00 PM

azu03                              1

azu04                              1

<!--NeedCopy-->

Description

Schedule azu01 and azu02 in azure-catalog to have a property update anytime from 11pm EST (-4) until 2 days later. The other machines remain having no property update scheduled. Times for ProvisioningSchemeUpdateRequested and ProvisioningSchemeUpdateUntil are displayed in local time (EST in this case). The update will be run next time each machine boots in that window.

Example 3


c:\PS> Get-ProvVM | select VMName, ProvisioningSchemeVersion, ProvisioningSchemeUpdateRequested, ProvisioningSchemeUpdateUntil

VMName       ProvisioningSchemeVersion  ProvisioningSchemeUpdateRequested  ProvisioningSchemeUpdateUntil

------       -------------------------  ---------------------------------  -----------------------------

azu01                              1

azu02                              1

azu03                              1

azu04                              1

c:\PS> $startTime = (Get-Date).AddDays(7).ToUniversalTime()

c:\PS> Schedule-ProvVMUpdate -ProvisioningSchemeName azure-catalog -VMName azu01, azu02 -StartTimeInUTC $startTime -DurationInMinutes -1

c:\PS> Get-ProvVM | select VMName, ProvisioningSchemeVersion, ProvisioningSchemeUpdateRequested, ProvisioningSchemeUpdateUntil

VMName       ProvisioningSchemeVersion  ProvisioningSchemeUpdateRequested  ProvisioningSchemeUpdateUntil

------       -------------------------  ---------------------------------  -----------------------------

azu01                              1               3/18/2022  11:32:51 PM

azu02                              1               3/18/2022  11:32:51 PM

azu03                              1

azu04                              1

<!--NeedCopy-->

Description

Schedule azu01 and azu02 in azure-catalog to have a property update anytime after 7 days from now. The other machines remain having no property update scheduled. The update will be run next time each machine boots after the start time.

Example 4


c:\PS> Get-ProvVM | select VMName, ProvisioningSchemeVersion, ProvisioningSchemeUpdateRequested, ProvisioningSchemeUpdateUntil

VMName       ProvisioningSchemeVersion  ProvisioningSchemeUpdateRequested  ProvisioningSchemeUpdateUntil

------       -------------------------  ---------------------------------  -----------------------------

azu01                              1

azu02                              1

azu03                              1

azu04                              1

c:\PS> Schedule-ProvVMUpdate -ProvisioningSchemeName azure-catalog -VMName azu01, azu02 -StartsNow  -DurationInMinutes -1

c:\PS> Get-ProvVM | select VMName, ProvisioningSchemeVersion, ProvisioningSchemeUpdateRequested, ProvisioningSchemeUpdateUntil

VMName       ProvisioningSchemeVersion  ProvisioningSchemeUpdateRequested  ProvisioningSchemeUpdateUntil

------       -------------------------  ---------------------------------  -----------------------------

azu01                              1               3/11/2022  11:32:51 PM

azu02                              1               3/11/2022  11:32:51 PM

azu03                              1

azu04                              1

<!--NeedCopy-->

Description

Schedule azu01 and azu02 in azure-catalog to have a property update when next booted. The other machines remain having no property update scheduled.

Schedule-ProvVMUpdate