4 Techniques to Troubleshooting WinRM Errors with VMM - TechGenix .

PowerShell Coding

34 Views

        

Microsoft’s Virtual Machine Manager (VMM) depends on many Windows Server system services. Windows Remote Management is one example that uses the WinRM service for Windows Remote Management. If WinRM isn’t working correctly, VMM will also suffer problems. In this article, I’ll show you some techniques for troubleshooting WinRM.

WinRM Troubleshooting Techniques

WinRM errors commonly stop the VMM from communicating with a Hyper-V host or host cluster. When troubleshooting a suspected WinRM error, use the following 4 techniques.

1. Check the WinRM Service

The first thing you should do when troubleshooting WinRM problems is to make sure that the WinRM service is running on the Hyper-V server. The easiest way to do this is to follow these steps:

  1. Open an elevated PowerShell session on your Hyper-V server.
  2. Enter the following command, but don’t forget to use the -ComputerName parameter if you are running a remote system: Get-Service WinRM.
  3. Check the Status column to see if the service is running.
  4. Supply the -ComputerName parameter, if working remotely: Start-Service WinRM, if the WinRM service has stopped.
  5. Enter the Get-Service WinRM command again to verify the service is running.
Screenshot of Windows Powershell terminal showing Get-Service WinRM returned results.

Check to make sure that the WinRM service is running, and start the service if necessary.

2. Check the Firewall Port

WinRM uses a listener to listen for commands from a remote system. In order for the listener to work, ensure the firewall isn’t blocking the listener port. The default port for WinRM is TCP port 5985. The instructions for opening a firewall port vary widely from one firewall to the next. Make sure you follow your firewall's instructions to change to the default WinRM port.

3. Check WinRM Configuration

You don’t configure WinRM on your Hyper-V hosts normally. That said, you may find the system has an incorrect configuration. To test a server’s WinRM configuration, complete the following steps:

  1. Log in to a managed Hyper-V host as an administrator.
  2. Open an elevated Command Prompt window.
  3. Enter winrm id.
  4. Verify the command doesn’t produce an error message.
Screenshot of a CMD window showing returned results for the winrm id command.

The WinRM ID command should display output similar to this.

If the commands above result in an error, you’ll need to perform a WinRM quick configuration. You also must create a WinRM listener. Fortunately, this is a simple process. To configure WinRM and create the required listener, complete the following steps:

  1. Open an elevated Command Prompt window on your Hyper-V server.
  2. Enter WinRM quickconfig.
  3. Enter the following command to create the WinRM listener: WinRM quickconfig -transport:https.

It’s worth noting that these steps assume the VMM server and Hyper-V host exist in the same domain. If that isn’t the case, you’ll need to create a custom WinRM configuration.

Screenshot of a CMD window showing you cannot configure anything while WinRM is running.

You won’t need to (or be able to) perform a quick configuration if WinRM is already running.

4. Check WinRM Communication with the WMI Providers

At this point, you’ll need to check WinRM can communicate with all the required WMI providers. More specifically, WinRM needs to communicate with the WMI provider for the operating system, Hyper-V, and the VMM agent. To test for this, follow these steps:

  1. Open an elevated Command Prompt window.
  2. Enter the following command to test the OS WMI provider: winrm e wmi/root/cimv2/Win32_ComputerSystem.
  3. Use this command to test the Hyper-V WMI provider: winrm e wmi/root/virtualization/v2/msvm_computersystem.
  4. Test the VMM agent WMI provider with this command: winrm i wmi/root/scvmm/AgentManagement.

If you receive an error, you should remove and reinstall the component. For example, the figure below shows a WMI error related to a faulty VMM agent. If you received an error like this, you would need to uninstall and reinstall the agent.

Screenshot of CMD window showing returned error from the VMM agent. Variables with values are provided in a concise list. This can help you quickly identify what part of the code is not working.

This error indicates a problem with the VMM agent.

Final Thoughts

Troubleshooting WinRM means checking to make sure the WinRM service is running, and firewall ports are open. You should also check the WinRM configuration and that the WinRM listener exists. Finally, check to ensure WinRM is able to communicate with WMI.

FAQs

Is WinRM a part of System Center Virtual Machine Manager?

No, WinRM is part of the Windows Server operating system. VMM depends on the WinRM service and you can’t run your VMM without it. When that happens, check if the WinRM service is running, and that the firewall ports are open. Something could’ve changed, so also check the WinRM configuration. Finally, check WinRM is able to communicate with the target system. Find additional details on these troubleshooting techniques in the article above.

What services does VMM depend on other than WinRM?

VMM depends on the WinRM, WMI, BITS, DCOM, and WCF services. You’re unable to either connect or use VMM without running these. Test these services’s status using the task manager or cmd window. You’ll also need to check both the server and agent systems to see if they’re working correctly.

What is WMI?

WMI stands for Windows Management Instrumentation. It’s Microsoft’s version of the Web-Based Enterprise Management Initiative (WBEM). This acts as an API that allows remote management tools to interact with many Windows components in a standardized way.

Can I use the Service Control Manager to check the status of the WinRM service instead of using PowerShell?

Yes. That said, most Hyper-V servers run a server core configuration. This means the Service Control Manager isn’t locally installed. You’ll either have to run the Service Control Manager remotely or use PowerShell. This is possible only if your VMM agent is running and the firewall ports are open.

Is there a PowerShell shortcut for enabling WinRM?

Yes. Simply use the Enable-PSRemoting cmdlet. You must run this cmdlet from an elevated PowerShell session and usually does a good job fixing WinRM issues.

Resources

Troubleshooting WinRM with PowerShell Basics

Learn how to troubleshoot WinRM with PowerShell here.

Advanced Troubleshooting WinRM with PowerShell

Read more on how to troubleshoot WinRM with PowerShell here.

WinRM Troubleshooting

Find basic WinRM troubleshooting tips here.

Discover WinRM

Read more about how WinRM can help you here.

Troubleshooting VMM tips

Find more VMM Troubleshooting tips here.

Troubleshoot Network Issues

Learn how to troubleshoot network issues like a pro here.

Post Views: 46

More Quick Tips articles



Ezoicreport this ad