Skip to content
This repository was archived by the owner on Nov 9, 2020. It is now read-only.
This repository was archived by the owner on Nov 9, 2020. It is now read-only.

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

@BTHP

Description

@BTHP

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

  • [Reflection.Assembly]::LoadWithPartialName('system.web') | out-null add-pssnapin ...
  • CategoryInfo : InvalidArgument: (:) [Out-Null], ParameterBindingException
  • FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.OutNullCommand

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions