VMware Horizon Community
bridrod
Enthusiast
Enthusiast
Jump to solution

Powershell Module VMware.Hv.Helper for Linux

Is there a linux version? I tried copying from the original ZIP file and also from a Windows machine, but it does not work under linux.

I can load up the module VMware.VimAutomation.HorizonView, so Connect-HVServer command works.

I get this error on Linux (openSUSE : Leap v15.2) when trying commands from module VMware.Hv.Helper:

Get-HVMachineSummary : The term 'Get-HVMachineSummary' is not recognized as the name of a cmdlet, function, script file, or operable program.

Thanks, Rod

Reply
0 Kudos
1 Solution

Accepted Solutions
fabio1975
Commander
Commander
Jump to solution

Hello me it works,

did you follow the instructions on this site

Run Example Horizon PowerCLI Scripts (vmware.com)

and then imported the modules?

import module in linux · Issue #2399 · PowerShell/PowerShell · GitHub

If you can't, I'll send you the configuration details

Bye 

Fabio 

Fabio

Visit vmvirtual.blog
If you're satisfied give me a kudos

View solution in original post

11 Replies
fabio1975
Commander
Commander
Jump to solution

Hello me it works,

did you follow the instructions on this site

Run Example Horizon PowerCLI Scripts (vmware.com)

and then imported the modules?

import module in linux · Issue #2399 · PowerShell/PowerShell · GitHub

If you can't, I'll send you the configuration details

Bye 

Fabio 

Fabio

Visit vmvirtual.blog
If you're satisfied give me a kudos

sjesse
Leadership
Leadership
Jump to solution

Shouldn't have to import modules anymore, they should autoload. Where did you  place VMware.Hv.Helper, it should go in location that powershell will check like

 

/usr/local/share/powershell/Modules

 

You can also check the path looking at this variable

 

$env:PSModulePath

fabio1975
Commander
Commander
Jump to solution

@sjesse  I had to import them by hand otherwise it wouldn't work

Fabio

Visit vmvirtual.blog
If you're satisfied give me a kudos

Reply
0 Kudos
sjesse
Leadership
Leadership
Jump to solution

Anything past PowerShell 3.0 is supposed to autoload modules that are in the correct folder, that should include the core versions of powershell.

 

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_modules?vie...

 

I'm going to move this to powercli since I think it may get more people familiar with Linux Powershell issues, this doesn't seem to be directly related to the helper module since we know that works.

bridrod
Enthusiast
Enthusiast
Jump to solution

This actually worked for me! Thanks.

I had to do this prior to importing it (inside the script):

cd /usr/local/share/powershell/Modules/VMware.Hv.Helper
./VMware.HV.Helper.psm1
Import-Module ./VMware.HV.Helper.psm1

Then my script worked! Weird only this module (so far) is doing this.

Reply
0 Kudos
bridrod
Enthusiast
Enthusiast
Jump to solution

Not sure why it's not auto-loading, but the manual process offered resolved my situation.

Reply
0 Kudos
sjesse
Leadership
Leadership
Jump to solution

Yeah it looks like your have it in the correct location, so I'm not sure, I do most of my powershell stuff on windows they only recently added the horizon commands to linux.

Reply
0 Kudos
bridrod
Enthusiast
Enthusiast
Jump to solution

All good! Really appreciate the help from you guys! Your answer also helped me learn a something about the paths! And at the end I got the fix needed to make it work! 👏🤝😁

Reply
0 Kudos
Magneet
Hot Shot
Hot Shot
Jump to solution

You need the latest powercli and it will only work with Horizon 8 2012, it doesn't work for older versions. If you're on Linux I would recommend looking at the python module I am creating. https://www.retouw.nl/2021/01/23/using-the-horizon-rest-apis-with-python/

Reply
0 Kudos
bridrod
Enthusiast
Enthusiast
Jump to solution

After making sure the module=VMware.Hv.Helper  was saved to /usr/local/share/powershell/Modules/, I had to do this (inside the script), prior to importing it:

cd /usr/local/share/powershell/Modules/VMware.Hv.Helper
./VMware.HV.Helper.psm1 (after farther testing, not actually needed in my case!)
Import-Module ./VMware.HV.Helper.psm1

Only after the above, everything worked fine.

I currently have linux: openSUSE Leap v15.2 running:

PSVersion=6.1.3
PSEdition=Core

 

Very cool you are providing python solution as well! Thanks! 🙂🙂

Reply
0 Kudos
Magneet
Hot Shot
Hot Shot
Jump to solution

you're welcome, it isn't feature complete yet but we're slowly getting on par with at least the available rest methods. Sadly the rest api's ain't feature complete yet in the beginning

Reply
0 Kudos