You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Hyper-V extension requires that the Hyper-V PowerShell module be loaded into the PowerShell runspace before attempting to perform any Hyper-V functionality. If it is not loaded attempting to perform any operation will return an error.
When the Hyper-V PowerShell windows feature is enabled, it will be loaded into a users PowerShell runspace by default. In a However, for some machines it is not getting loaded into the runspace resulting in a similar error as below. The issue is only observed when interacting with PowerShell via the .Net PowerShellSDK in .Net 8. The issue does not happen on the same machine in a terminal powershell window. (Note: the below error occurred when navigating to the environment page for the first time after launching Dev Home):
System.Management.Automation.CommandNotFoundException: The 'Get-VM' command was found in the module 'Hyper-V', but the module could not be loaded. For more information, run 'Import-Module Hyper-V'.
at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection1 input, PSDataCollection1 output, PSInvocationSettings settings)
at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection1 input, PSDataCollection1 output, PSInvocationSettings settings)
at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
at HyperVExtension.Services.PowerShellService.ExecuteIndividualStatements(IEnumerable1 commandLineStatements, PipeType pipeType) at HyperVExtension.Services.PowerShellService.Execute(IEnumerable1 commandLineStatements, PipeType pipeType)
Another Note: Attempting to import the module results in the following error: The module to process 'Microsoft.HyperV.PowerShell.Cmdlets.dll', listed in field 'NestedModules' of module manifest 'C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\Hyper-V\2.0.0.0\Hyper-V.psd1' was not processed because no valid module was found in any module directory.
In the past I noticed this issue and added a workaround where we use the Get-Module -ListAvailable command as a way to force the the Hyper-V module to be loaded into the runspace, however this negatively affect perf. After reimaging my machine and enabling Hyper-V this error went away, so we removed the workaround. However, we have received at least one report for another user that they are encountering this error.
There are two things we can attempt to do to fix this:
Re-add the work around that we know will work on most if not all PCs
Find a different work around that does not negatively impact the perf of loading the Hyper-V VMs
Expected result
Hyper-V VMs load without errors
Actual result
Hyper-V VMs do not load and the user recieves the following error after navigating to the environments page without doing anything:
Included System Information
No response
Included Extensions Information
No response
The text was updated successfully, but these errors were encountered:
Dev Home version
No response
Windows build number
No response
Other software
No response
Steps to reproduce the bug
The Hyper-V extension requires that the Hyper-V PowerShell module be loaded into the PowerShell runspace before attempting to perform any Hyper-V functionality. If it is not loaded attempting to perform any operation will return an error.
When the Hyper-V PowerShell windows feature is enabled, it will be loaded into a users PowerShell runspace by default. In a However, for some machines it is not getting loaded into the runspace resulting in a similar error as below. The issue is only observed when interacting with PowerShell via the .Net PowerShellSDK in .Net 8. The issue does not happen on the same machine in a terminal powershell window. (Note: the below error occurred when navigating to the environment page for the first time after launching Dev Home):
System.Management.Automation.CommandNotFoundException: The 'Get-VM' command was found in the module 'Hyper-V', but the module could not be loaded. For more information, run 'Import-Module Hyper-V'.
at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection
1 input, PSDataCollection
1 output, PSInvocationSettings settings)at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection
1 input, PSDataCollection
1 output, PSInvocationSettings settings)at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
at HyperVExtension.Services.PowerShellService.ExecuteIndividualStatements(IEnumerable
1 commandLineStatements, PipeType pipeType) at HyperVExtension.Services.PowerShellService.Execute(IEnumerable
1 commandLineStatements, PipeType pipeType)Another Note: Attempting to import the module results in the following error:
The module to process 'Microsoft.HyperV.PowerShell.Cmdlets.dll', listed in field 'NestedModules' of module manifest 'C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\Hyper-V\2.0.0.0\Hyper-V.psd1' was not processed because no valid module was found in any module directory.
In the past I noticed this issue and added a workaround where we use the
Get-Module -ListAvailable
command as a way to force the the Hyper-V module to be loaded into the runspace, however this negatively affect perf. After reimaging my machine and enabling Hyper-V this error went away, so we removed the workaround. However, we have received at least one report for another user that they are encountering this error.There are two things we can attempt to do to fix this:
Expected result
Hyper-V VMs load without errors
Actual result
Hyper-V VMs do not load and the user recieves the following error after navigating to the environments page without doing anything:
Included System Information
No response
Included Extensions Information
No response
The text was updated successfully, but these errors were encountered: