Automation

 View Only
  • 1.  Trouble finding PowerCLI in new install of vscode

    Posted Nov 01, 2018 02:52 PM

    Hi all,

    I'm new to vscode (heard about it yesterday in fact) and am having a configuration issue. I have successfully installed vs code, and I was able to add the powershell extenison to it. I als added LucD's Microsoft.VSCode_Profile.ps1 to the install which I found on his blog here: http://www.lucd.info/2016/04/23/visual-studio-code-powercli/

    When I ran and install-module command to connect powercli It looked successful but when I open a ps1 file I see this error:

    PowerShell Integrated Console

    Can not find a PowerCLI installation!

    At \\fs-55-ah\vmgr$\home05\dscotti\Documents\WindowsPowerShell\Microsoft.VSCode_profile.ps1:78 char:13

    +             Throw 'Can not find a PowerCLI installation!'

    +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : OperationStopped: (Can not find a PowerCLI installation!:String) [], RuntimeException

        + FullyQualifiedErrorId : Can not find a PowerCLI installation!

    Also Seeing this error:

    cd : Cannot find path 'Microsoft.PowerShell.Core\FileSystem::' because it does not exist.

    At C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1:134 char:1

    + cd \

    + ~~~~

        + CategoryInfo          : ObjectNotFound: (Microsoft.PowerShell.Core\FileSystem:::String) [Set-Location], ItemNotFoundException

     

        + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand

     

    I am running this version of powershell:

     

     $psversiontable.psversion

    Major  Minor  Build  Revision

    -----  -----  -----  --------

    5      1      17134  228

     

    This is my version of powercli:

    PowerCLI Version

    ----------------

       VMware PowerCLI 11.0.0 build 10380590

    ---------------

    Component Versions

    ---------------

       VMware Cis Core PowerCLI Component PowerCLI Component 11.0 build 10335701

       VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 11.0 build 10336080

    An interesting side note is that the commands I run (like connect-viserver) can tab complete. so that tellse me something is finding powercli.

    Has anyone seen this before? And how do I clear the error? 

     

    Thanks 

    Dan

    PowerShell Integrated Console
     
    Can not find a PowerCLI installation!
    At \\fs-55-ah\vmgr$\home05\dscotti\Documents\WindowsPowerShell\Microsoft.VSCode_profile.ps1:78 char:13
    +             Throw 'Can not find a PowerCLI installation!'
    +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : OperationStopped: (Can not find a PowerCLI installation!:String) [], RuntimeException
        + FullyQualifiedErrorId : Can not find a PowerCLI installation!


  • 2.  RE: Trouble finding PowerCLI in new install of vscode

    Posted Nov 01, 2018 02:58 PM

    That profile you installed from my blog is not usable for for newer VSC versions I'm afraid.

    And yes, I have to update that post.

    Just remove the file “%UserProfile%\Documents\WindowsPowerShell\Microsoft.VSCode_profile.ps1“ and all should be ok.