Jump to content
Welcome to our new Citrix community!
  • 0

Citrix Cloud - REST API - Machine Catalog - $UpdateProvisioningScheme


Mariusz Gal

Question

Hi, Has anyone experimented with Updating Machine Catalog's image using the $UpdateProvisioningScheme call?

I found the function below online, but i noticed in the RequestURI portion someone was referencing old links, so below you can see what I was trying to use. 


function Update-CCMachineCatalog {
    param (
        [Parameter(Mandatory=$true)]
        [string] $CustomerID,
        [Parameter(Mandatory=$true)]
        [string] $SiteId,
        [Parameter(Mandatory=$true)]
        [string] $AccessToken,        
           [string]$MachineCatalogId,        
        [string]$SnapShot
    )
    ##$RequestUri = https://api-us.cloud.com/cvadapis/$SiteId/MachineCatalogs/$MachineCatalogId/`$UpdateProvisioningScheme    
    
    $RequestUri = https://api-us.cloud.com/cvad/manage/MachineCatalogs/$MachineCatalogId/`$UpdateProvisioningScheme
    $Headers = @{
        "Accept" = "application/json";
        "Authorization" = "CWSAuth Bearer=$AccessToken";
        "Citrix-CustomerId" = $CustomerID;
        "Citrix-InstanceId" = $siteid;
        "Content-type"  = "application/json";
    }
$body = @"
{
   "MasterImagePath":"$SnapShot",
   "StoreOldImage":true,
    "RebootOptions":{
      "RebootDuration":0,
      "WarningDuration":0,
      "SendMessage":false
    }
  }
"@  
    write-host $RequestUri
    $Response = Invoke-WebRequest -Uri $requestUri -Method Post -Headers $headers -Body $body
    #-ContentType "application/json"
    return $Response
}

we host in Azure.

First, I want to make sure I use proper path reference for Snapshot:

     $SnapshotPath = “US_East.resourcegroup\xd_vdi21H2_AZ_1.snapshot”

... this could be a problem however I cant find any references anywhere how the path should be defined.

 

I have another function already to get all the machine catalogs, and get an ID of a catalog that I want to update. That part was already confirmed and i get the right data.

 

My call of the function is as follows:

 Update-CCMachineCatalog -CustomerID $customerid -SiteID $CCSiteID -AccessToken $CCAccessToken -MachineCatalogId $catalogID -SnapShot $SnapshotPath

 

error at the moment is along the lines of:

Quote

 

 Invoke-WebRequest : {"ErrorMessage":"Invalid arguments specified.\r\nParameter name: nameOrId

    request.MasterImagePath","SdkErrorId":"UnknownError","ErrorType":"ArgumentException....

 

 

 

any ideas what could be a problem?, by looking at the code? thanks

 

I stripped down $body parameters a bit, just to see if anything helps, as there was some extra values that based on documentation were depreciated. 

Link to comment

3 answers to this question

Recommended Posts

  • 0

Well..... I resolved it.

I initiated the wizard  Catalog Update thru the web interface ... and I noticed in path of snapshot: "image.folder/"

so the path reference is like this:

 

 $SnapshotPath = “image.folder/US_East.resourcegroup/xd_vdi21H2_AZ_1.snapshot”

 

hope it helps someone! ?

  • Like 1
Link to comment
  • 0

a side related question I actually got is (I guess I will need to test myself different scenarios)...

Maybe someone can help with RebootOptions in the $body definition:

 

 $body = @"

{

   "MasterImagePath":"$SnapShot",

   "StoreOldImage":true,

   "RebootOptions":{

     "RebootDuration":0,

     "WarningDuration":0,

     "SendMessage":false

    }

  }

"@

 

I want to make sure that after the image is applied…. The machines that are being used by users are not reboot.  I guess the simplest way to test this is to connect to the Desktop in my catalog and initiate the image update on a catalog and see what happens.... but... if someone has proven values then let me know.

I will test as well with just the following values:

  $body = @"

  {

     "MasterImagePath":"$SnapShot",

     "StoreOldImage":true

    }

  "@

 

 

I see here:

https://developer.cloud.com/citrixworkspace/citrix-daas/citrix-daas-rest-apis/apis/MachineCatalogs-APIs/MachineCatalogs_UpdateMachineCatalogProvisioningScheme#operations-20-MachineCatalogs_UpdateMachineCatalogProvisioningScheme-querySection

 

RebootOptions          {

description:   

Reboot options for machines in the catalog.

 

oneOf ->      

RebootMachinesRequestModel{

description:   

Options for triggering a reboot of all machines in a machine catalog.

 

RebootDuration        Type: integer ($int32)

title: Int32

default: -1

nullable: true

Description: Approximate maximum duration over which the reboot cycle runs, in minutes.

 

WarningDuration       Type: integer ($int32)

title: Int32

default: 0

nullable: true

Description: Time in minutes prior to a machine reboot at which a warning message is displayed in all user sessions on that machine.

 

WarningTitle   Type: string

title: String

nullable: true

example: For example, help desk message

Description: The window title used when showing the warning message in user sessions on a machine scheduled for reboot.

 

WarningMessage       Type: string

title: String

nullable: true

example: For example, help desk message

Description: Warning message displayed in user sessions on a machine scheduled for a reboot. The optional pattern '%m%' is replaced by the number of minutes until the reboot.

 

WarningRepeatInterval        Type: integer ($int32)

title: Int32

default: 0

nullable: true

Description: Number of minutes to wait before showing the reboot warning message again.

 

}

}

 

... but it does not seem to have all options explained fully.

Link to comment
  • 0

I think I again figured my own second question about Reboot Options....

I connected to my Desktop in the Catalog, initiated the update catalog with just $body defined  as showed below:

 $body = @"

  {

     "MasterImagePath":"$SnapShot",

     "StoreOldImage":true

    }

  "@

 

and the catalog was updated with the new image and my session is still active and it did not shutdown/reboot, so I think I got it ?

Whoever thinks of/knows of any problems with that.... let me know ?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...