Closed cajunitalian closed 7 years ago
Hey Matteo, you might need to load the module into the session before IntelliSense appears. For now the best way to do this is add Import-Module PowerCLI
to your VS Code profile:
$HOME\Documents\WindowsPowerShell\Microsoft.VSCode_profile.ps1
After adding that, restart VS Code and you should get IntelliSense for the module.
That profile doesn't exist - how can I create it? Do I just manually build it?
I know in typical POSH you just run the commands but the integrated terminal in VSC is using my local logged in AD Profile which has it's own POSH Profile.
*Micorsoft.Powershell_profile.ps1
Create it like so:
notepad $home\Documents\WindowsPowerShell\Microsoft.VSCode_profile.ps1
Notepad should ask you if you want to create the file. Then add the one line Import-PowerCLI
and save & exit the file. This profile is specific to the PowerShell extension for VSCode so when you are editing scripts, that profile gets processed which should load this module for you.
That did the trick. Thanks guys, trying to convert from heavy VS2016 over the VSC
Please fill in these details so that we can help you!
System Details
$PSVersionTable
:Issue Description
Unable to use intellisense w/ PowerCLI Module Cmdlets. See my screenshot, you'll see the PowerCLI Module path is clearly in $env:PSModulePath (C:\VMware\Infra\PowerCLI\Modules)*
*Yes, I am writing in a .ps1 file. Powershell is working, just not intellisense for that module.
Attached Logs
Attached Screenshots
Here's an example of the module paths, showing that $env is good
Here's an example of Connect-VIServer, you can see it's not working.