locked
How to do Powershell remoting to windows VM in Azure RRS feed

  • Question

  • Hello,

    I have a problem for connecting via Powershell to Windows VM in my Azure account.

    I did below steps :

    -Enable-PSRemoting -Force
    -Set-Item wsman:\localhost\client\trustedhosts * -Force

    -Enter-PSSession –ComputerName  MyComputerName  –Credential Administrator

    and I get below error :

    "failed with the following error message : WinRM cannot complete the operation. Verify that the
    specified computer name is valid, that the computer is accessible over the network, and that a
    firewall exception for the WinRM service is enabled and allows access from this computer. By
    default, the WinRM firewall exception for public profiles limits access to remote computers
    within the same local subnet. For more information, see the about_Remote_Troubleshooting Help
    topic."

    The point is that with normal Remote Desktop I can connect to the VM, but I can not do the same with powershell. I saw in the Azure portal, that Public Port for remote desktop is :62722, so I tried to change the port but still I get the same error.

    Please help me and explain how to do it. Thank you

    Thursday, March 21, 2013 12:10 PM

Answers

  • I think you have to set a different endpoint for remote management.

    Try this:

    # Add an endpoint for PowerShell Remoting (Windows Remote Management)
    Get-AzureVM "VMName" | Add-AzureEndpoint -Name "WinRM" -PublicPort 5985 -LocalPort 5985 -Protocol tcp | Update-AzureVM

    Kind regards,

    Eelco Koster

    Thursday, March 21, 2013 12:58 PM

All replies

  • I think you have to set a different endpoint for remote management.

    Try this:

    # Add an endpoint for PowerShell Remoting (Windows Remote Management)
    Get-AzureVM "VMName" | Add-AzureEndpoint -Name "WinRM" -PublicPort 5985 -LocalPort 5985 -Protocol tcp | Update-AzureVM

    Kind regards,

    Eelco Koster

    Thursday, March 21, 2013 12:58 PM
  • Solved, Thank you so much Eelco :)

    Best Regards

    Majid

    Thursday, March 21, 2013 1:12 PM
  • I made another VM, and I added the Endpoint 5985 to it, now the problem is that I can do Powershell remoting to the VM I had before, but I can not do Powershell Remoting to the new one, everything is the same, the same endpoints and the same configuration, but I don't know why with the new one I get below error :

    "failed with the following error message : WinRM cannot complete the operation. Verify that the
    specified computer name is valid, that the computer is accessible over the network, and that a
    firewall exception for the WinRM service is enabled and allows access from this computer. By
    default, the WinRM firewall exception for public profiles limits access to remote computers
    within the same local subnet. For more information, see the about_Remote_Troubleshooting Help
    topic."

    Any help is highly appreciated

    Friday, April 5, 2013 12:39 PM