vmware / PowerCLI-Example-Scripts

http://blogs.vmware.com/powercli
Other
746 stars 603 forks source link

Unable to import module as per instruction at vmware #518

Closed journeym closed 2 years ago

journeym commented 2 years ago

Describe the bug

https://docs.vmware.com/en/VMware-Horizon-7/7.13/horizon-integration/GUID-B29EB217-30F0-4C58-9A49-95160392AA9C.html#GUID-B29EB217-30F0-4C58-9A49-95160392AA9C image

Reproduction steps

https://docs.vmware.com/en/VMware-Horizon-7/7.13/horizon-integration/GUID-B29EB217-30F0-4C58-9A49-95160392AA9C.html#GUID-B29EB217-30F0-4C58-9A49-95160392AA9C

Expected behavior

Error as in a picture

Additional context

No response

journeym commented 2 years ago

image

bwuch commented 2 years ago

Thanks for reporting this @journeym. I believe this is a typo in the documentation and is either a missing carriage return or semicolon. The one line provided Get-Module -ListAvailable 'Vmware.Hv.Helper' | Import-Module Get-Command -Module 'VMware.Hv.Helper' should probably be broken into two steps.

The first part would be to import the module with Get-Module -ListAvailable 'Vmware.Hv.Helper' | Import-Module and the second part would be to list the available functions with Get-Command -Module 'VMware.Hv.Helper'.

Can you confirm this works for you? If so I can submit a request to update the docs for both Horizon 7.x and 8.x (the same typo is present in https://docs.vmware.com/en/VMware-Horizon/2111/horizon-console-administration/GUID-B29EB217-30F0-4C58-9A49-95160392AA9C.html as well).

journeym commented 2 years ago

Yes this does work, bun now i cant import module due to it's unsigned, and i have gpo restriced Remote-Signed, so that's another matter, thanks

bwuch commented 2 years ago

Hello @journeym -- I just checked in my lab and my powershell execution policy is set to RemoteSigned and I'm not having a problem with this module. Before you spend too much time troubleshooting group policy, does the error you see show anything related to 'blocked file'? When you download a zip file it'll occasionally have this 'blocked' flag set which can cause problems loading scripts. If you right click on the zip (or any of the extracted files) see if there is an 'Unblock' checkbox in the lower right. If so checking that and clicking ok may clear up the error. Since there are several files included with this module, you could do something like Get-ChildItem C:\Users\igorm\Documents\WindowsPowerShell\Modules -Recurse | Unblock-File and let powershell do the work for you. Hope this helps!