VMware Horizon Community
Rotoi
Contributor
Contributor

Error while importing pool in json

Hi,

When importing a pool with powershell in json format, this error appears :

Exception lors de l'appel de « Desktop_Create » avec « 2 » argument(s) : « ExceptionType : VMware.Hv.InvalidArgument
ErrorMessage : A null value is invalid.
ParameterName : automatedDesktopSpec.virtualCenterProvisioningSettings.virtualCenterStorageSettings.viewStorageAcceleratorSettings.viewComposerDiskTypes »
 C:\Program Files\WindowsPowerShell\Modules\VMware.Hv.Helper\VMware.Hv.Helper.psm1:5008 : 7
+ $id = $desktop_helper.Desktop_create($services,$desktopSpecObj)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : VimException

This seems related to a null value in the json file ?

The property automatedDesktopSpec.virtualCenterProvisioningSettings.virtualCenterStorageSettings.viewStorageAcceleratorSettings.viewComposerDiskTypes is not null for this pool.

Reply
0 Kudos
12 Replies
RetouwNL
Enthusiast
Enthusiast

can you share the json ?


Previously known as Magneet or Magneet_NL, does things with Horizon api's, see www.retouw.nl
Reply
0 Kudos
Rotoi
Contributor
Contributor

I added it in attached file as the post is removed when the content is posted in a message.

Reply
0 Kudos
RetouwNL
Enthusiast
Enthusiast

that's annoying, did you also ask on the github page as thats where the people are who work on the module. 



Previously known as Magneet or Magneet_NL, does things with Horizon api's, see www.retouw.nl
Tags (1)
Reply
0 Kudos
Rotoi
Contributor
Contributor

You mean here ? https://github.com/vmware/PowerCLI-Example-Scripts/issues

Yes I did. Still no reply yet.

Reply
0 Kudos
RetouwNL
Enthusiast
Enthusiast

there indeed, I stopped supporting the module years ago but there are some folks that still keep improving it. Imho the best way is to switch completely to the rest api's



Previously known as Magneet or Magneet_NL, does things with Horizon api's, see www.retouw.nl
Reply
0 Kudos
Rotoi
Contributor
Contributor

What do you mean by switching to the rest api's ?

I'm looking for a way to export pools from a connection server then import them in another one. Hence the use of the hv.helper module. That could be done with that rest api ?

Reply
0 Kudos
RetouwNL
Enthusiast
Enthusiast

absolutely it's what I did here: https://www.retouw.nl/2021/12/08/creating-desktop-pools-using-the-horizon-rest-api-with-powershell/

You might need to play a bit with things but this is how I created my example.



Previously known as Magneet or Magneet_NL, does things with Horizon api's, see www.retouw.nl
Reply
0 Kudos
Rotoi
Contributor
Contributor

When executing get command on the desktop pools inventory, this gives the error :

401

Error: Unauthorized

 

{
  "status": "UNAUTHORIZED",
  "timestamp": 1693848140815,
  "error_message": "Authentication token not found"
}

There is no log in section on that page

Reply
0 Kudos
RetouwNL
Enthusiast
Enthusiast

there is a way to do that by using the api call (top most section) but I made a short script that logs in for you and puts a login token on your clipboard https://www.retouw.nl/2020/08/26/using-the-horizon-8-swagger-page/



Previously known as Magneet or Magneet_NL, does things with Horizon api's, see www.retouw.nl
Reply
0 Kudos
Rotoi
Contributor
Contributor

Thanks.

I got the export of the desktop pools in a json file from the get command, when using POST to import it in another connection server, this gives this error.

Error 400 : bad request.

 

400

Error: Bad Request

Response body
Download
 
{  "timestamp": "2023-09-04T16:08:17.734+00:00",  "status": 400,  "error": "Bad Request",  "path": "/rest/inventory/v1/desktop-pools"
}
Response headers
 access-control-allow-credentials: true  access-control-allow-origin: https://**********  cache-control: no-cache,no-store,max-age=0,must-revalidate  content-security-policy: default-src 'self';connect-src 'self' https:;font-src 'self' data:;img-src 'self' data:;script-src 'self';style-src 'self' 'unsafe-inline';frame-ancestors 'none'  content-type: application/json  expires: 0  pragma: no-cache  strict-transport-security: max-age=31536000 ; includeSubDomains  transfer-encoding: chunked  vary: Origin  x-content-type-options: nosniff  x-frame-options: DENY  x-xss-protection: 1; mode=block 
Reply
0 Kudos
Rotoi
Contributor
Contributor

So by default, when using the get command from the web page, there is only minimal information that is extracted from the pools ?

Reply
0 Kudos
RetouwNL
Enthusiast
Enthusiast

it has all the info from the pool in the json but some parts you will need to remove as they are unneeded. In my blog post I only went for the bare essentials for my pools but you have to play with what is required in your environment.



Previously known as Magneet or Magneet_NL, does things with Horizon api's, see www.retouw.nl
Reply
0 Kudos