Automation

 View Only
  • 1.  Set-VMGuestNetworkInterface Issue

    Posted Dec 03, 2014 04:29 AM

    Hi All,

    I'm currently having an issue with the Set-VMGuestNetworkInterface using Powershell. Below is the command I'm running...

    Get-VM -Name Server01 -Server DC1-VC1 | Get-VMGuestNetworkInterface -GuestUser ".\administrator" -GuestPassword $Password | Where {$_.Name -like "Local Area Connection*"} | Set-VMGuestNetworkInterface -IPPolicy static -GuestUser ".\administrator" -GuestPassword $password -Ip "10.10.10.1" -Netmask "255.255.255.0" -Gateway "10.10.10.254" -Dns "10.10.10.100","10.10.10.50"

    This is the error I get..

    Set-VMGuestNetworkInterface : 3/12/2014 3:22:29 PM    Set-VMGuestNetworkInterface        "Error occured while configuri

    ng the network:'The RPC server is unavailable.

    '.

    At line:1 char:208

    + Get-VM -Name Server01 -Server DC1-VC1 | Get-VMGuestNetworkInterface -GuestUser ".\administrator" -GuestPasswor

    d $Password | Where {$_.Name -like "Local Area Connection*"} | Set-VMGuestNetworkInterface <<<<  -IPPolicy static -Gues

    tUser ".\administrator" -GuestPassword $password -Ip "10.10.10.1" -Netmask "255.255.255.0" -Gateway "10.10.10.254" -Dns

    "10.10.10.100","10.10.10.50"

        + CategoryInfo          : InvalidArgument: (:) [Set-VMGuestNetworkInterface], ViError

        + FullyQualifiedErrorId : Client20_VmGuestService_SetVmGuestNetworkInterface_Error,VMware.VimAutomation.ViCore.Cmd

       lets.Commands.SetVmGuestNetworkInterface

    The above error message, in particular "The RPC server is unavailable." would lead me to believe that it can't talk to the server at all, and this would make sense... however the above command does update both DNS settings to the ones specified in the script. Has anyone seen this before? I've had a look around and can't see any previous people that have had this issue.

    This is an output of the network adapter list...

    Get-VM Server01 -Server DC1-VC1 | Get-VMGuestNetworkInterface -GuestUser ".\administrator" -GuestPassword $Password | Where {$_.Name -like "Local Area Connection*"}

    VM              Name                      IP              IPPolicy   SubnetMask

    --              ----                      --              --------   ----------

    Server01 Local Area Connection 3                   Static

    I don't think I need to use the host username/password settings too as it's using vCenter, I tried with it anyway with no change.

    If I run the same command but only specify IP, or Gateway, or Netmask it's still the same result.

    I've removed the test server from the domain to make sure it isn't some strange policy but the results are the same, the administrator account I'm using is a local admin account with full permissions.

    I've tried allowing all remote-script execution on Server01 too with no change. The firewall is turned of, RPC service is started etc. VMWare tools is installed correctly.

    Cheers,
    Michael.



  • 2.  RE: Set-VMGuestNetworkInterface Issue

    Posted Dec 03, 2014 07:00 AM

    I suspect the FW in the guest OS is causing the "RPC server is unavailable" message.

    A bit of background: the Set-VMGuestNetworkInterface cmdlet in fact runs a BAT/bash file, similar to the method Invoke-VMScript uses, inside the guest OS.

    The BAT files contain some "netsh" commands.

    And it is probably one of these netsh commands that is generating the RPC server error.

    Note that the Set-VMGuestNetworkInterface cmdlet only supports a limited set of guest OS (the guestID is in the name of the BAT file).

    And note that the PowerCLI Team has recently announced that this cmdlet will disappear in one of the future PowerCLI builds.

    As an alternative you can use Invoke-VMScript with a PowerShell script to configure the NIC inside the guest OS.

    See for example Alan's PowerCLI: Changing a VM IP Address with Invoke-VMScript post.



  • 3.  RE: Set-VMGuestNetworkInterface Issue

    Posted Dec 04, 2014 12:24 AM

    Thanks LucD, I'll give that a try.


    I'm currently getting "RPC server is unavailable" even when trying to run the command locally, but that's an issue with the VM so I'll sort that out.



  • 4.  RE: Set-VMGuestNetworkInterface Issue

    Posted Dec 04, 2014 07:00 AM

    Did you check if the FW inside the guest OS in the VM is allowing these RPC calls ?