question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Powershell Debugger Not Loading all Modules : Get-StartApps is not recognized as the name of a cmdlet, function, script file, or operable program

See original GitHub issue

System Details Output

### Operating System:
Windows 10 Home, 64bit, Verson 1809, OSbuild 17763.475

### VSCODE version:
1.33.1
51b0b28134d51361cf996d2f0a1c698247aeabd8
x64

### PSES version: 1.12.1.0
### PowerShell version:

Name                           Value
----                           -----
PSVersion                      5.1.17763.316
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.316
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1


### VSCode extensions:
Atishay-Jain.All-Autocomplete@0.0.18
christian-kohler.path-intellisense@1.4.2
codezombiech.gitignore@0.6.0
CoenraadS.bracket-pair-colorizer-2@0.0.28
dbaeumer.vscode-eslint@1.8.2
eamodio.gitlens@9.7.3
EditorConfig.EditorConfig@0.13.0
formulahendry.auto-close-tag@0.5.6
formulahendry.auto-rename-tag@0.0.15
formulahendry.code-runner@0.9.9
ghmcadams.lintlens@2.3.0
karigari.chat@0.15.4
max-SS.Cyberpunk@1.2.3
mechatroner.rainbow-csv@1.0.0
ms-vscode.atom-keybindings@3.0.6
ms-vscode.cpptools@0.23.0
ms-vscode.powershell@1.12.1
ms-vscode.vscode-typescript-tslint-plugin@1.0.0
ms-vsliveshare.vsliveshare@1.0.181
ms-vsliveshare.vsliveshare-audio@0.1.50
ms-vsliveshare.vsliveshare-pack@0.2.12
msjsdiag.debugger-for-chrome@4.11.3
Orta.vscode-jest@2.9.2
pflannery.vscode-versionlens@0.23.0
vscode-icons-team.vscode-icons@8.6.0
wix.vscode-import-cost@2.12.0
yahya-gilany.vscode-clock@1.0.1

Issue Description

When running the powershell debugger with this one line script:

Get-StartApps

I get the following error message:

Get-StartApps : The term 'Get-StartApps' 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.
At C:\Users\clifford\Desktop\powershell-scripts\cato-scripts\test.ps1:1 char:1
+ Get-StartApps
+ ~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-StartApps:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

debugger-error

However, when I run Get-StartApps inside my Powershell GUI (Windows Powershell or Windows Powershell ISE), it works fine.

Interestingly, running Get-StartApps through the code runner extension works fine, as I’m able to get the result output shown below:

Name                                             AppID
----                                             -----
Narrator                                         {1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\narrator.exe
Notepad                                          {1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\notepad.exe
ODBC Data Sources (64-bit)                       {1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\odbcad32.exe

code-runnder

I’m thinking it has to do a difference in environment, since when I run code runner on the file with this, I get back 30 results (which include Get-StartApps, Also the output of Code runner shows that the file is being run like this powershell -ExecutionPolicy ByPass -File "c:\Users\clifford\Desktop\powershell-scripts\cato-scripts\tempCodeRunnerFile.ps1"

(Get-Command Get-St*).length #30

But when I run the VScode debugger, I get 29 as my result:

(Get-Command Get-St*).length #29 (the collection is missing `Get-StartApps`)

Expected Behaviour

  • should load all cmd-lets
  • should autocomplete command

Actual Behaviour

VS Code poweshell debugger is not loading all the cmd-lets VS Code powershell is not autocompleting/loading the cmd-let Get-StartApps when I start typing it out, despite it showing up as automcompleting in Powershell.ise GUI program.

Attached Logs

1557790997-0da62f65-1607-40b3-af0e-5f62626b25811557790144671.zip

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

4reactions
rjmholtcommented, May 14, 2019

I notice the second set of modules lists from the x86 module path. I think you might be running in 32-bit Windows PowerShell in VSCode.

You need to use the PowerShell picker in the bottom right to select x64 PowerShell. If you click on it, a menu will appear at the top of the Window. You then need to select Switch to: Windows PowerShell (x64)

0reactions
cliffordfajardocommented, May 14, 2019
  1. Output of ipomo StartLayout inside Powershell ISE is no output so it works there
  2. Output of ipmo StartLayout inside VScode:
ipmo : The specified module 'StartLayout' was not loaded because no valid module file was found in any module directory.
At line:1 char:1
+ ipmo StartLayout
+ ~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (StartLayout:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

SOLUTION:

Poweshell was running in 32bit mode (x86) instead of 64bit (x64). Once I changed it to x64 everything worked!

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Powershell modules not loading - TechNet - Microsoft
Some of the modules load, but not all of them. In particular I am trying to get the module loaded. From explorer, I...
Read more >
Having trouble installing Power Cli - VMware Communities
Get-PowerCLIVersion : The term 'Get-PowerCLIVersion' is not recognized as the name of a cmdlet, function, script file,. or operable program.
Read more >
WINDOWS POWERSHELL ALL THE GET-CMDLETS FOR ...
install-module : The term 'install-module' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the ...
Read more >
https://edu-josephine.proebiz.com/cs/tender/2543/s...
Replace('T','_'))' is not recognized as the name of a cmdlet, function, script file, or operable program. Check th e spelling of the name,...
Read more >
PowerShell Transcript - DESKTOP-0CJKUOO.956Qlykq ...
Configuration Name: Machine: DESKTOP-0CJKUOO (Microsoft Windows NT 10.0.18363.0) Host Application: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found