vmware-archive / webcommander

Powerful, flexible, intuitive and most importantly simple. That is what a real automation solution should be. No matter how complicated the task is, we'd like to turn it into a single click. Is that possible? Not without webcommander :)
MIT License
165 stars 47 forks source link

The term 'Connect-VIServer' is not recognized as the name of a cmdlet #183

Open BTHP opened 6 years ago

BTHP commented 6 years ago

Hi, everytime i run a powershell-script by using webCommander i get this error:

The term 'Connect-VIServer' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Apparently the PowerCLI Modules are not registered properly. So I changed my "C:\Windows\SysWOW64\WindowsPowerShell\v1.0\profile.ps1" from the recommended:

[Reflection.Assembly]::LoadWithPartialName('system.web') | out-null add-pssnapin vmware* -ea SilentlyContinue $env:defaultPassword = 'replace this with a real password'

to this

[Reflection.Assembly]::LoadWithPartialName('system.web') | out-null Get-Module -Name VMware* -ListAvailable | Import-Module -ea SilentlyContinue $env:defaultPassword = 'test1234!'

Now the Modules are registered properly at least when running PowerCLI directly on the Sserver where webCommander is installed on. Before the change I got this error:

Out-Null : A positional parameter cannot be found that accepts argument 'add-pssnapin'. At C:\Windows\SysWOW64\WindowsPowerShell\v1.0\profile.ps1:1 char:60

But on the Webcommander page i still get the message that the modules are not recognized. Webpage and all the other stuff are running correctly as far as I can see so far.

What can i change to get this going?

Many thanks in advance!

Best

Ben

9whirls commented 6 years ago

Please try the walnut version (http://github.com/9whirls/webcommander_walnut) to see if it works for you.

BTHP commented 6 years ago

I downloaded Powercli Modules by using the Save-Module command and copied the downloaded modules on my Server. That did the trick. I took a look at Walnut Edition as well. Thank you for your support.

9whirls commented 6 years ago

Cool, have fun

bvi1998 commented 5 years ago

Hi, I am having the problem, connect-viserver not recognized. I have added this to the various Powershell profiles but it the command is still not recognized...

[Reflection.Assembly]::LoadWithPartialName('system.web') | out-null Get-Module -Name VMware* -ListAvailable | Import-Module -ea SilentlyContinue $env:defaultPassword = 'whatever'

I had to do as above, save the powercli modules and copy them to C:\Program Files\WindowsPowerShell\Modules