Jump to content
Welcome to our new Citrix community!

Can anyone provide a Powershell example to create machine catalog with DaaS rest API?


Recommended Posts

# Create New MC

function CreateMachineCatalog {

  param (

    [Parameter(Mandatory=$true)]

    [string] $customerid,

    [Parameter(Mandatory=$true)]

    [string] $siteid,

    [Parameter(Mandatory=$true)]

    [string] $bearerToken,

#    [Parameter(Mandatory=$true)]

#    [string] $adminCredential,

    [Parameter(Mandatory=$true)]

    [string] $body

  )

  $requestUri = "https://api-eu.cloud.com/cvad/manage/MachineCatalogs"

  $headers = @{

    "Accept" = "application/json";

    "Content-Type"="application/json";

    "Authorization" = "CWSAuth Bearer=$bearerToken";

    "Citrix-CustomerId" = $customerid;

    "Citrix-InstanceId" = $siteid;

    # "X-AdminCredential" = "Basic $adminCredential";

  }

 $response = Invoke-RestMethod -Uri $requestUri -Method POST -Headers $headers -Body $body 

 return $response

}

$adminCredential = ""

$body = @"

{

  "MachineType": "Virtual",

  "Name": "MOBIZ-TEST-MC-001",

  "AllocationType": "Static",

  "IsRemotePC": false,

  "MinimumFunctionalLevel": "L7_9",

  "ProvisioningScheme": {

    "MasterImagePath": "image.folder/........",

  },

  "PersistUserChanges": "Discard",

  "ProvisioningType": "MCS",

  "SessionSupport": "MultiSession"

}

"@

$response = CreateMachineCatalog $Customer_id $SiteID $BearerToken $body

The response shows an error:Invoke-RestMethod : {"ErrorMessage":"The required parameter is not specified.rnParameter name: 

MachineType","SdkErrorId":"UnknownError","ErrorType":"ArgumentException","ErrorDetails"....

But I have MachineType parameter there as you can see above. Any help would be appreciated.

Link to comment
Share on other sites

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...