-
Notifications
You must be signed in to change notification settings - Fork 520
Description
Prerequisites
- I have written a descriptive issue title.
- I have searched all open and closed issues to ensure it has not already been reported.
- I have read the troubleshooting guide.
- I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
- I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
- If this is a security issue, I have read the security issue reporting guidance.
Summary
When I create a minimal test script and set the powerShellDefaultVersion to "Windows Powershell (x64)" and run the script with a breakpoint, 6 errors are introduced prior to the launch of the script related to PowerShellGet and PackageMangement.
PowerShell Version
Name Value
---- -----
PSVersion 5.1.22621.4391
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.4391
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1Visual Studio Code Version
1.99.0-insider
x64Extension Version
ms-vscode.powershell@2025.3.0Steps to Reproduce
Open a new folder in VS Code, add "powershell.powerShellDefaultVersion": "Windows Powershell (x64)" to .vscode/settings.json.
Create a test script TestEarlyErrors.ps1 with the following:
Write-Host "We haven't done anything yet! Errors: $($Error.Count)"
Write-Host "We haven't done anything yet! Errors: $($Error.Count)"
'done'Hit F5 to debug the test script.
Note there are no errors.
Add a breakpoint to line 2.
Hit F5 to debug the script with the break point
Note that there are 6 errors prior to the script launching.
Running $Error | clip produces the output below to the clipboard:
ImportCimAndScriptKeywordsFromModule : A second CIM class definition for 'MSFT_PSRepository' was found while processing the schema file 'C:\Program
Files\WindowsPowerShell\Modules\PowerShellGet\2.2.1\DSCResources\MSFT_PSRepository\MSFT_PSRepository.Schema.mof'. This class was already defined in the file(s) 'C:\Users\dbailey\OneDrive - The University of Texas at
Austin\Documents\WindowsPowerShell\Modules\PowerShellGet\2.2.1\DSCResources\MSFT_PSRepository\MSFT_PSRepository.Schema.mof,C:\Program
Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\DSCResources\MSFT_PSRepository\MSFT_PSRepository.Schema.mof'. Remove the redundant definition, and then try again.
At C:\windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:4143 char:29
+ ... $null = ImportCimAndScriptKeywordsFromModule -Module $mod -Resour ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], PSInvalidOperationException
+ FullyQualifiedErrorId : System.Management.Automation.PSInvalidOperationException,ImportCimAndScriptKeywordsFromModule
ImportCimAndScriptKeywordsFromModule : A second CIM class definition for 'MSFT_PSModule' was found while processing the schema file 'C:\Program
Files\WindowsPowerShell\Modules\PowerShellGet\2.2.1\DSCResources\MSFT_PSModule\MSFT_PSModule.Schema.mof'. This class was already defined in the file(s) 'C:\Users\dbailey\OneDrive - The University of Texas at
Austin\Documents\WindowsPowerShell\Modules\PowerShellGet\2.2.1\DSCResources\MSFT_PSModule\MSFT_PSModule.Schema.mof,C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\DSCResources\MSFT_PSModule\MSFT_PSModule.Schema.mof'. Remove the
redundant definition, and then try again.
At C:\windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:4143 char:29
+ ... $null = ImportCimAndScriptKeywordsFromModule -Module $mod -Resour ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], PSInvalidOperationException
+ FullyQualifiedErrorId : System.Management.Automation.PSInvalidOperationException,ImportCimAndScriptKeywordsFromModule
ImportCimAndScriptKeywordsFromModule : A second CIM class definition for 'MSFT_PackageManagementSource' was found while processing the schema file 'C:\Program
Files\WindowsPowerShell\Modules\PackageManagement\1.0.0.1\DSCResources\MSFT_PackageManagementSource\MSFT_PackageManagementSource.schema.mof'. This class was already defined in the file(s) 'C:\Users\dbailey\OneDrive - The University of Texas
at Austin\Documents\WindowsPowerShell\Modules\PackageManagement\1.4.4\DSCResources\MSFT_PackageManagementSource\MSFT_PackageManagementSource.Schema.mof,C:\Program Files
(x86)\WindowsPowerShell\Modules\PackageManagement\1.0.0.1\DSCResources\MSFT_PackageManagementSource\MSFT_PackageManagementSource.schema.mof,C:\Program
Files\WindowsPowerShell\Modules\PackageManagement\1.4.8.1\DSCResources\MSFT_PackageManagementSource\MSFT_PackageManagementSource.Schema.mof,C:\Program
Files\WindowsPowerShell\Modules\PackageManagement\1.4.4\DSCResources\MSFT_PackageManagementSource\MSFT_PackageManagementSource.Schema.mof'. Remove the redundant definition, and then try again.
At C:\windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:4143 char:29
+ ... $null = ImportCimAndScriptKeywordsFromModule -Module $mod -Resour ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], PSInvalidOperationException
+ FullyQualifiedErrorId : System.Management.Automation.PSInvalidOperationException,ImportCimAndScriptKeywordsFromModule
ImportCimAndScriptKeywordsFromModule : A second CIM class definition for 'MSFT_PackageManagement' was found while processing the schema file 'C:\Program
Files\WindowsPowerShell\Modules\PackageManagement\1.0.0.1\DSCResources\MSFT_PackageManagement\MSFT_PackageManagement.schema.mof'. This class was already defined in the file(s) 'C:\Users\dbailey\OneDrive - The University of Texas at
Austin\Documents\WindowsPowerShell\Modules\PackageManagement\1.4.4\DSCResources\MSFT_PackageManagement\MSFT_PackageManagement.Schema.mof,C:\Program Files
(x86)\WindowsPowerShell\Modules\PackageManagement\1.0.0.1\DSCResources\MSFT_PackageManagement\MSFT_PackageManagement.schema.mof,C:\Program
Files\WindowsPowerShell\Modules\PackageManagement\1.4.8.1\DSCResources\MSFT_PackageManagement\MSFT_PackageManagement.Schema.mof,C:\Program
Files\WindowsPowerShell\Modules\PackageManagement\1.4.4\DSCResources\MSFT_PackageManagement\MSFT_PackageManagement.Schema.mof'. Remove the redundant definition, and then try again.
At C:\windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:4143 char:29
+ ... $null = ImportCimAndScriptKeywordsFromModule -Module $mod -Resour ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], PSInvalidOperationException
+ FullyQualifiedErrorId : System.Management.Automation.PSInvalidOperationException,ImportCimAndScriptKeywordsFromModule
ImportCimAndScriptKeywordsFromModule : A second CIM class definition for 'MSFT_PackageManagementSource' was found while processing the schema file 'C:\Program
Files\WindowsPowerShell\Modules\PackageManagement\1.4.4\DSCResources\MSFT_PackageManagementSource\MSFT_PackageManagementSource.Schema.mof'. This class was already defined in the file(s) 'C:\Users\dbailey\OneDrive - The University of Texas at
Austin\Documents\WindowsPowerShell\Modules\PackageManagement\1.4.4\DSCResources\MSFT_PackageManagementSource\MSFT_PackageManagementSource.Schema.mof,C:\Program Files
(x86)\WindowsPowerShell\Modules\PackageManagement\1.0.0.1\DSCResources\MSFT_PackageManagementSource\MSFT_PackageManagementSource.schema.mof,C:\Program
Files\WindowsPowerShell\Modules\PackageManagement\1.4.8.1\DSCResources\MSFT_PackageManagementSource\MSFT_PackageManagementSource.Schema.mof'. Remove the redundant definition, and then try again.
At C:\windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:4143 char:29
+ ... $null = ImportCimAndScriptKeywordsFromModule -Module $mod -Resour ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], PSInvalidOperationException
+ FullyQualifiedErrorId : System.Management.Automation.PSInvalidOperationException,ImportCimAndScriptKeywordsFromModule
ImportCimAndScriptKeywordsFromModule : A second CIM class definition for 'MSFT_PackageManagement' was found while processing the schema file 'C:\Program
Files\WindowsPowerShell\Modules\PackageManagement\1.4.4\DSCResources\MSFT_PackageManagement\MSFT_PackageManagement.Schema.mof'. This class was already defined in the file(s) 'C:\Users\dbailey\OneDrive - The University of Texas at
Austin\Documents\WindowsPowerShell\Modules\PackageManagement\1.4.4\DSCResources\MSFT_PackageManagement\MSFT_PackageManagement.Schema.mof,C:\Program Files
(x86)\WindowsPowerShell\Modules\PackageManagement\1.0.0.1\DSCResources\MSFT_PackageManagement\MSFT_PackageManagement.schema.mof,C:\Program
Files\WindowsPowerShell\Modules\PackageManagement\1.4.8.1\DSCResources\MSFT_PackageManagement\MSFT_PackageManagement.Schema.mof'. Remove the redundant definition, and then try again.
At C:\windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:4143 char:29
+ ... $null = ImportCimAndScriptKeywordsFromModule -Module $mod -Resour ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], PSInvalidOperationException
+ FullyQualifiedErrorId : System.Management.Automation.PSInvalidOperationException,ImportCimAndScriptKeywordsFromModule
Visuals
VSCodeWindowsPowerShellDebugIssue-20250328.zip
Logs
PowerShell: Trace LSP output
2025-03-28 13:42:21.556 [info] No result returned.
2025-03-28 13:42:23.331 [info] No parameters provided.
2025-03-28 13:42:26.461 [info] No parameters provided.
2025-03-28 13:42:26.462 [info] No parameters provided.
2025-03-28 13:42:28.668 [info] No result returned.
2025-03-28 13:43:01.239 [info] No parameters provided.