locked
Invalid class problem RRS feed

  • Question

  • I am having a problem with this.

    PS C:\Users\administrator> new-vhd fu.vhdx -SizeBytes 10gb -Dynamic
    new-vhd : The operation on computer 'WIN10' failed: Invalid class
    At line:1 char:1
    + new-vhd fu.vhdx -SizeBytes 10gb -Dynamic
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [New-VHD], VirtualizationException
        + FullyQualifiedErrorId : Unspecified,Microsoft.Vhd.PowerShell.Cmdlets.NewVhd
    

    The 'invalid class' error happens on any cmdlet found in the Hyper-V module.  I have tried uninstalling/reinstalling the Hyper-V PowerShell and management features.  This is a Windows 10 VM, so I am not installing/uninstalling Hyper-V itself, just the PowerShell and management.  I use this system for a lot of scripting, and this is the only module that is giving me a problem.

    I don't know what I might try next.  Appreciate any guidance.


    . : | : . : | : . tim

    Wednesday, April 13, 2016 8:57 PM

Answers

  • Do a Get-Service and verify all the Hyper-V services are running
    • Marked as answer by Tim CerlingMVP Wednesday, April 13, 2016 10:42 PM
    Wednesday, April 13, 2016 9:12 PM
  • This is my outcome on a brand W10 box:

    Get-WindowsOptionalFeature -FeatureName *hyper* -Online|select featurename,state
    
    FeatureName                                State
    -----------                                -----
    Microsoft-Hyper-V-All                    Enabled
    Microsoft-Hyper-V-Tools-All              Enabled
    Microsoft-Hyper-V-Management-Clients     Enabled
    Microsoft-Hyper-V-Management-PowerShell  Enabled
    Microsoft-Hyper-V                        Enabled
    Microsoft-Hyper-V-Hypervisor            Disabled
    Microsoft-Hyper-V-Services               Enabled
    



    \_(ツ)_/


    • Edited by jrv Wednesday, April 13, 2016 10:24 PM
    • Marked as answer by Tim CerlingMVP Wednesday, April 13, 2016 10:42 PM
    Wednesday, April 13, 2016 10:23 PM

All replies

  • Do a Get-Service and verify all the Hyper-V services are running
    • Marked as answer by Tim CerlingMVP Wednesday, April 13, 2016 10:42 PM
    Wednesday, April 13, 2016 9:12 PM
  • Good thought.  It looks like I am missing the vmms service.  All other Hyper-V services are running.  I have a couple physical machines that are running Hyper-V (Windows 10, Windows 8.1) and they show just the vmms service running.  All other Hyper-V services are off.  I have another VM running Windows 8.1 and it has a vmms service running, in addition to several other Hyper-V services.  The non-working instance is completely missing the vmms service.   The \windows\system32\vmms.exe is even missing.  Don't know how that happened.

    Going to see if I can copy it from another working Windows 10 system.


    . : | : . : | : . tim

    Wednesday, April 13, 2016 9:29 PM
  • We do niot install HYper-V modules.  We enable, or disable the feature.  Enabling the feature for PowerShell and management requires checking the Hyper-V Management Tools feature.

    PS C:\scripts> Get-WindowsOptionalFeature -online -FeatureName *hyper*|select FeatureName,State
    
    FeatureName                                State
    -----------                                -----
    Microsoft-Hyper-V-All                    Enabled
    Microsoft-Hyper-V-Tools-All              Enabled
    Microsoft-Hyper-V-Management-Clients     Enabled
    Microsoft-Hyper-V-Management-PowerShell  Enabled
    Microsoft-Hyper-V                       Disabled
    Microsoft-Hyper-V-Hypervisor            Disabled
    Microsoft-Hyper-V-Services              Disabled
    

    Enable-WincdowsOptionalFeature -Feature Microsoft-Hyper-V-Tools-All 


    \_(ツ)_/

    Wednesday, April 13, 2016 9:42 PM
  • I think my system is really hosed. I used the GUI to enable the right features and when that didn't work, I used the GUI to remove them. Then I used DISM to enable them, and when that didn't work, I used DISM to disable them. Now I try the Enable-WindowsOptionalFeature, and I get this error:

    Enable-WindowsOptionalFeature : Parameter set cannot be resolved using the specified named parameters.
    At line:1 char:1
    + Enable-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-Tools-Al ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (:) [Enable-WindowsOptionalFeature], ParameterBindingException
        + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.Dism.Commands.EnableWindowsOptionalFeatureCommand

    I tried the command on a couple other disabled features and get the same message.

    Since the vmms.exe file is not even in existence on \windows\system32, and I am getting this error now on something else that should work without issue, I think it is time for me to re-install.

    Thanks for the help - the guidance pointed me to other issues that should not be there.  Don't know when I'll run into the next messed up thing.


    . : | : . : | : . tim

    Wednesday, April 13, 2016 10:02 PM
  • Like this:

    Enable-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-Tools-all -Online

    As in DISM we need to specify the online system image is the one to be altered.


    \_(ツ)_/

    Wednesday, April 13, 2016 10:17 PM
  • This is my outcome on a brand W10 box:

    Get-WindowsOptionalFeature -FeatureName *hyper* -Online|select featurename,state
    
    FeatureName                                State
    -----------                                -----
    Microsoft-Hyper-V-All                    Enabled
    Microsoft-Hyper-V-Tools-All              Enabled
    Microsoft-Hyper-V-Management-Clients     Enabled
    Microsoft-Hyper-V-Management-PowerShell  Enabled
    Microsoft-Hyper-V                        Enabled
    Microsoft-Hyper-V-Hypervisor            Disabled
    Microsoft-Hyper-V-Services               Enabled
    



    \_(ツ)_/


    • Edited by jrv Wednesday, April 13, 2016 10:24 PM
    • Marked as answer by Tim CerlingMVP Wednesday, April 13, 2016 10:42 PM
    Wednesday, April 13, 2016 10:23 PM
  • Be sure virtualization support Is enabled in the BIOS.


    \_(ツ)_/

    Wednesday, April 13, 2016 10:25 PM
  • Thanks for the help - got it working.

    This is a VM - can't enable virtualization in the BIOS.  Obviously it is configured on the host.

    As I worked through this I realized I had played with running Hyper-V in this VM at one point in time.  Yes, I know it is not supported and that you can't launch VMs, but you can run the Hyper-V console just fine and create VMs and do other things like that.  You simply can't start the VMs because there is no hardware support underneath.  (Windows Server 2016 changes this, as does the equivalent Windows 10 - i.e. they will support nested virtualization).  I must have screwed up something when I removed it.  What keyed me in was when I ran the Get-WindowsOptionalFeature command, it showed the Hypervisor as enabled instead of disabled.  And I checked bcdedit and it showed hypervisorlaunchtype as auto.  Changed that to off and now things are working again.


    . : | : . : | : . tim

    Wednesday, April 13, 2016 10:47 PM
  • Thanks for the help - got it working.

    This is a VM - can't enable virtualization in the BIOS.  Obviously it is configured on the host.

    As I worked through this I realized I had played with running Hyper-V in this VM at one point in time.  Yes, I know it is not supported and that you can't launch VMs, but you can run the Hyper-V console just fine and create VMs and do other things like that.  You simply can't start the VMs because there is no hardware support underneath.  (Windows Server 2016 changes this, as does the equivalent Windows 10 - i.e. they will support nested virtualization).  I must have screwed up something when I removed it.  What keyed me in was when I ran the Get-WindowsOptionalFeature command, it showed the Hypervisor as enabled instead of disabled.  And I checked bcdedit and it showed hypervisorlaunchtype as auto.  Changed that to off and now things are working again.


    . : | : . : | : . tim

    Very interesting and definitely worth knowing.

    I wonder what could have mucked it.

    I just had an odd issue with an HP 15T Envy.  It wouldn't sleep and froze when trying.  The answer was to reset BIOS to defaults and then configure the customization.  After that it works correctly (I think).


    \_(ツ)_/

    Thursday, April 14, 2016 2:36 AM
  • Thanks u so much. working..
    • Edited by K.Muniraj Friday, August 7, 2020 4:02 AM
    Friday, August 7, 2020 4:01 AM
  • Thanks u so much. working..
    Friday, August 7, 2020 4:02 AM