VMware Cloud Community
fborges555
Enthusiast
Enthusiast
Jump to solution

Horizon View admin

Hi gurus

I am looking to do the following and I need some help

I would like a script that stop the Pool Desktop provisioning and the delete all VM under that Pool

Pool A-> disable provision->remove/delete all VM under Pool A.

where do I start gurus.

Thanks

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

So it does work.

Ok, to get the name of the pool try

Get-HVPool | Select -ExpandProperty Base

The Name field in there should show you the name of the pool


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
12 Replies
LucD
Leadership
Leadership
Jump to solution

Would something like this work for you?
This does require the VMware.HV.Helper module.

Set-HVPool  -PoolName 'MyPool' -Stop

Get-HVMachine -PoolName 'MyPool' | Remove-HVMachine

Set-HVPool  -PoolName 'MyPool' -Start


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
fborges555
Enthusiast
Enthusiast
Jump to solution

L.

Thanks a bunch for jumping in

will this cmdlet disable the pool or disable provisioning?

I never work with module before , so I download the entire module/script

pastedImage_3.png

Thanks in advance

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Unfortunately, that module is not (yet) on the PS Gallery.

So yes, you have to download it from github and copy the folder to one of your PowerShell module folders.

There are instructions in Run Example Horizon PowerCLI Scripts

That command will disable provisioning.
The Set-HVPool cmdlet also has a Disable switch.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
fborges555
Enthusiast
Enthusiast
Jump to solution

L.

I get empty results when running , I am connecting to the connection server

pastedImage_0.png

0 Kudos
LucD
Leadership
Leadership
Jump to solution

What do you mean?

A remote PS session to the Connection Server or did you do a Connect-HVServer?

Have a look at Automating VMware Horizon 7 with VMware PowerCLI.

It explains how to use the module.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
fborges555
Enthusiast
Enthusiast
Jump to solution

L.

I did a connection-hvserver

connect-hvserver -server IP

get-hvpool |select Displayname

I am just looking for a list of all pool in view admin

thanks

0 Kudos
LucD
Leadership
Leadership
Jump to solution

When you do a Get-HVPool by itself, no Select-Object, is there anything returned?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
fborges555
Enthusiast
Enthusiast
Jump to solution

pastedImage_0.png

0 Kudos
LucD
Leadership
Leadership
Jump to solution

So it does work.

Ok, to get the name of the pool try

Get-HVPool | Select -ExpandProperty Base

The Name field in there should show you the name of the pool


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
fborges555
Enthusiast
Enthusiast
Jump to solution

L.

as always thanks a bunch

I guess is a matter of learning all the select and switches for this helper

Thanks a bunch

0 Kudos
fborges555
Enthusiast
Enthusiast
Jump to solution

where do I find all doc on vmware.HV.Helper so I can learn, like the expandproperty base

Thanks

0 Kudos
LucD
Leadership
Leadership
Jump to solution

There is unfortunately not that much information available about that module.

The last link I included is one of the better posts on the module.

The ExpandProperty parameter is in fact a PowerShell thing.

I suggest you start with that blog post.

And then have a look at these 2 roadmaps for PowerShell and PowerCLI.

https://thecrazyconsultant.com/powershell-study-guide-core-concepts/

https://thecrazyconsultant.com/powercli-study-guide-core-concepts/

For more on the VMware.Hv.Helper Wouter's website is a good source.

See https://www.retouw.nl/


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos