VMware Cloud Community
Trying2Code
Contributor
Contributor

Horizon View and PowerCLI

Hello everyone.

I'm a relatively new coder to the VM PowerCli enviornment.

And I am trying to code for automation the creation of a desktop pool and incorporate it into a Global Desktop Entitlement.

The pool, will be created from a virtual machine hosted in vSphere, and has GRID enabled.

Now, I do know the key to enable renderer3D, and what the value should be.

But, my problem comes along when trying to add this pool to a Global Entitlement.

I'm getting error thrown out that there is a mismatch with the with the 3D rendering setting between the desktop pool and the global entitlement.

Up until now, I have been using the lmvutil command, which is very clunky to use and very limited.

I'm trying to find a way to do this through PowerCLI without having to invoke lmvutil.

I know that I can get the Global Entitlement ID with the Get-HVPool cmdlet, and what it returns is not practical to use.

So I was hoping there was something similar for global entitlements, but I'm not seeing anything.

Hoping someone can point me in the right direction.

Thanks.

Update:

OK, so I was testing a PowerShell script that creates a manual desktop pool from a virtual machine on our vCenter and creates a Global Desktop Entitlement, and assigns a user to that as well as the newly created desktop pool.

The virtual machine does have the NVIDIA GRID GPU enabled.

When I run my script, it throws the following error:

Exception calling "Desktop_Create" with "2" argument(s): "ExceptionType : VMware.Hv.InvalidArgument

ErrorMessage : Machine Machine/NzA2ZjhkYWQtYWU2NC00Yjk4LTkxOGEtZjA1ODg1NGY0NTNj/VW5hc3NpZ25lZFZpcnR1YWxNYWNoaW5l/M2VkYzk3NTctZDcwNS00MWViLWJhODEtN2FlNT

E3ZGYyMDRi/L0RDMSAoQ2xpZnRvbiwgTkopL3ZtL1dvcmtzdGF0aW9ucy9Vc2VyL0lTL05ldE9wcy9NT05HRUxMUDAxREMx/dm0tMjU1 requires GRID, but the desktop is not enabled to support it

ParameterName : manualDesktopSpec.machines"

At C:\Users\*********\Documents\WindowsPowerShell\Modules\VMware.Hv.Helper\VMware.HV.Helper.psm1:3403 char:5

+     $desktop_helper.Desktop_create($services,$desktopSpecObj)

+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

    + FullyQualifiedErrorId : VimException

Now, I see that it is coming from the the New-HVPool cmdlet from the module.

And the reason, because it is not enabled on the desktop, but it is.

So I am not sure where it is looking to determine if GRID is enabled on the desktop.

Through the GUI, on the Horizon Connection server everything works fine.

Thanks again.

Reply
0 Kudos
6 Replies
Magneet
Hot Shot
Hot Shot

what are u using for the new-hvpool? The regular commands or a json file? You might want to dump the json for a pool you configured in the gui , alter that and use it to create a new pool. There's a good chance that the new-hvpool is missing parameters for grid.

Reply
0 Kudos
Trying2Code
Contributor
Contributor

Hi,

I'm using the regular commands.

New-HVPool -poolname something and so forth....

Then when I am ready to modify the pool, I use the Set-HVPool cmdlet.

Reply
0 Kudos
Trying2Code
Contributor
Contributor

I've been looking around and unable to find a means of "dumping the json" of a pool that I setup through the GUI.

How does one get a json from an existing pool?

Reply
0 Kudos
AnthonyTraceyEU
Contributor
Contributor

To export a pool configuration as a json file, execute the following.

$PoolName = Your Pool ID

$FilePath = "C:\$PoolName.json"

Get-HvPool -PoolName $PoolName | ConvertTo-Json -Depth 100 | Out-File $FilePath

Some items, such as Virtual Center objects, will return a unique identifier instead of a name or path, so if you are attempting to create a pool with this JSON file it will only work on the Pod from which the spec was exported. In order to deploy to a different Pod, this spec json file would need modified to reflect the proper paths instead of unique Ids.

Reply
0 Kudos
Magneet
Hot Shot
Hot Shot

for the json use get-hvpool | get-hvpoolspec

Trying2Code
Contributor
Contributor

Anthony,

Thanks for that tip.

I got the json now of a desktop pool that was created through the GUI.

And I have an idea on how to user the New-HVPool cmdlet to create a new pool from that json.

My question is now this...

Im going to need to do this for a number of VMs, and I was going to batch job it by reading from a file with the relevant information I need.

They are all going to be in the same Pod site.

So, what, if anything would I have to change in the json to help with this?

Thanks again.

Reply
0 Kudos