VMware Cloud Community
mvelezwhiteSBS
Contributor
Contributor

Using PowerCLI from within PowerShell

Sorry for such a noob question, but I'm trying to determine the best way to implement PowerCLI on my workstation.  I currently use Sapien PowerShell Studio 2019 and since PowerCLI is (as I understand it) a module that can used in PowerShell, I wanted to install it from within PowerShell.  I saw the Get-Module and Update-Module commands, but I don't believe those would work since there's no VMware.PowerCLI in my module inventory.  Can someone please guide me with the best way to get this installed?  I feel a bit lost; especially since it's been a while since I've used either PowerShell or PowerCLI.

Thank you in advance to anyone who can kindly provide some enlightenment.

3 Replies
LucD
Leadership
Leadership

We all started at the beginning, no worries :smileygrin:

For a fresh install you can use the Install-Module -Name VMware.PowerCLI command.

See also Welcome PowerCLI to the PowerShell Gallery – Install Process Updates


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

mvelezwhiteSBS
Contributor
Contributor

Hello LucD:

Thank you for your help.  I still haven't been able to get PowerCLI added, but your information helped me to learn  where the error is in my system.  I believe that PowerShell Studio, combined with my incompetence, has proliferated a total of five (5) different paths for where modules may be located.  I was trying to keep everything in just one location so that I could easily verify when a module was properly installed or not.  I believe that I have some cleanup to try and do; although I'm not certain yet where to start.  I suppose that I could just wipe everything out and start from scratch.  Unfortunately, that would also wipe out all the scripting work that I did last week in preparing queries for SCCM.  I need to decide if i want to either lose it all or take some additional time and back that stuff up.  I'll most likely go with the latter, but that still doesn't help me to decide how to get 5 paths down to one and simplified my PowerShell file structure and profile so that this doesn't happen again.

Well, as the quote goes, 'back to the drawing board', in this case the whiteboard *LOL*.

Thanks again LucD, you ROCK as always!!

tenor.gif

LucD
Leadership
Leadership

PS gets modules from multiple places.
You can check which folders those are by doing

$env:PSModulePath.Split(';')

I'm not sure if Studio adds anything to that.

But those are locations for modules, not necessarily where you store your own scripts.

Unless of course, you have packaged your functions into one or more modules.

These locations also reflects in which 'Scope' a module was installed.


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