bridrod
Contributor
Contributor

Powershell Module VMware.Hv.Helper for Linux

Jump to solution

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

0 Kudos
1 Solution

Accepted Solutions
fabio1975
Hot Shot
Hot Shot

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
BLOG: https://vmvirtual.blog

if satisfied give me a kudos

View solution in original post

11 Replies
fabio1975
Hot Shot
Hot Shot

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
BLOG: https://vmvirtual.blog

if satisfied give me a kudos

View solution in original post

sjesse
Leadership
Leadership

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
Hot Shot
Hot Shot

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

Fabio
BLOG: https://vmvirtual.blog

if satisfied give me a kudos
0 Kudos
sjesse
Leadership
Leadership

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

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.

0 Kudos
bridrod
Contributor
Contributor

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

0 Kudos
sjesse
Leadership
Leadership

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.

0 Kudos
bridrod
Contributor
Contributor

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! 👏🤝😁

0 Kudos
Magneet
Hot Shot
Hot Shot

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/

0 Kudos
bridrod
Contributor
Contributor

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! 🙂🙂

0 Kudos
Magneet
Hot Shot
Hot Shot

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

0 Kudos