VMware Cloud Community
COS
Expert
Expert
Jump to solution

Getting weird error: Get-VM : The Hyper-V Management Tools could not access an expected WMI class on computer

Running the below command...

Get-Folder -Name 'sda' | Get-VM

And I get the error....

Get-VM : The Hyper-V Management Tools could not access an expected WMI class on computer 'vm-somedude'. This may indicate that the

Hyper-V Platform is not installed on the computer or that the version of the Hyper-V Platform is incompatible with these management

tools.

LOL, Hyper-V isn't installed at all.

So I try just this...

Get-VM "rhel8"

And I get the same error.

Any ideas?

Thanks

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You could just delete the folder.
Are you sure it didn't come with another feature?

Or RSAT?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
6 Replies
COS
Expert
Expert
Jump to solution

OK, so I fully qualified the Get-VM commandlet like this and it works....

Get-Folder -Name 'sda' | VMware.VimAutomation.Core\Get-VM

What's the appropriate fix?

Thanks

0 Kudos
LucD
Leadership
Leadership
Jump to solution

With the number of PS modules available, there are bound to be some name collisions going to happen.

There are a number of solutions:

  1. Use the Prefix parameter on the Import-Module cmdlet.
  2. Use the fully qualified name (modulename\cmdletname), as you did
  3. Check if the module comes with a builtin prefix (the DefaultCommandPrefix setting in the module's manifest file). Also present on the object returned from Import-Module
  4. Make sure that one of the modules with the conflicting cmdlet is not loaded. Which might be a bit of a challenge with module autoloading and the cache it uses.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Personally I prefer the Prefix parameter on Import-Module.
You can keep the prefix short.
But it is a problem for your existing scripts.

I tend to move one of the modules (the lesser used) to a folder that is not in $env:PSModulePath.

That solves the module autoloading issue and avoids having to use a fully qualified name on both modules.
When I need the 2nd module, I load it with the Prefix parameter.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
COS
Expert
Expert
Jump to solution

I'm thinking this module is the culprit...

Binary     2.0.0.0    Hyper-V                             {Add-VMAssignableDevice, Add-VMDvdDrive, Add-VMFibreChannelHba, Add-VMGpu...

I ran the command...

Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Tools-All

But the module still exists.

How do I get rid of that Powershell Hyper-V module?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

You could just delete the folder.
Are you sure it didn't come with another feature?

Or RSAT?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
COS
Expert
Expert
Jump to solution

Yup, it came with RSAT.

I uninstalled the hyper-v portion and all works now.

0 Kudos