none
Changing IP settings of virtual machine's network adapter from host RRS feed

  • Question

  • I want to change IP settings of a virtual machine in a program that runs on hyper-v host. As far as I know there does not exist a way in which I can do this using WMI. That's OS level setting which I believe has to be done from inside the virtual machine. Please correct me if there are any APIs which I can use to accomplish this.

    I am curious if there is any way through which I can run scripts inside the virtual machine from a program running on the hyper-v host. Do integration services help do this?

    Any pointers?

    Thanks,

    Vivek.

    Thursday, September 20, 2012 12:48 PM

Answers

  • Hi!

    Such a way does not exist that I'm aware of, you can however run scripts from remote using a tool like sysinternals PSExec: http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

    This kind of remote execution occurs over network, so it applies to both physical and virtual Machines.


    I suspect that allowing script execution through integration services would be considered a security risk, but I do remember reading something about it being possible to set static IP address in a virtual machine using SCVMM2012, although I haven't tried it.

    Thursday, September 20, 2012 1:24 PM
  • SCVMM will use PowerShell and other remote management tools to set the IP address, but I think it has to have access to the VM via the network to start with.  So if you have DHCP set in the environment, you can gain network access, then issue the proper commands to change it from DHCP to fixed.  I don't see how SCVMM could do it any other way unless it is editing the registry within the VHD while the VM is turned off.  My understanding is that the ONLY way for the host to communicate to the VM is via standard networking protocols due to the security concerns mentioned by Mike.

    tim

    Thursday, September 20, 2012 5:05 PM
  • As Mike and Tim have mentioned.

    Today, this requires an agent of some type that is running in the VM to apply the IP settings.  (the SCVMM and VMware way).

    The alternate is that you drive your DHCP server programatically and you create DHCP reservations based on MAC.


    Brian Ehlert
    http://ITProctology.blogspot.com
    Learn. Apply. Repeat.
    Disclaimer: Attempting change is of your own free will.

    Thursday, September 20, 2012 5:48 PM
    Moderator

All replies

  • Hi!

    Such a way does not exist that I'm aware of, you can however run scripts from remote using a tool like sysinternals PSExec: http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

    This kind of remote execution occurs over network, so it applies to both physical and virtual Machines.


    I suspect that allowing script execution through integration services would be considered a security risk, but I do remember reading something about it being possible to set static IP address in a virtual machine using SCVMM2012, although I haven't tried it.

    Thursday, September 20, 2012 1:24 PM
  • SCVMM will use PowerShell and other remote management tools to set the IP address, but I think it has to have access to the VM via the network to start with.  So if you have DHCP set in the environment, you can gain network access, then issue the proper commands to change it from DHCP to fixed.  I don't see how SCVMM could do it any other way unless it is editing the registry within the VHD while the VM is turned off.  My understanding is that the ONLY way for the host to communicate to the VM is via standard networking protocols due to the security concerns mentioned by Mike.

    tim

    Thursday, September 20, 2012 5:05 PM
  • As Mike and Tim have mentioned.

    Today, this requires an agent of some type that is running in the VM to apply the IP settings.  (the SCVMM and VMware way).

    The alternate is that you drive your DHCP server programatically and you create DHCP reservations based on MAC.


    Brian Ehlert
    http://ITProctology.blogspot.com
    Learn. Apply. Repeat.
    Disclaimer: Attempting change is of your own free will.

    Thursday, September 20, 2012 5:48 PM
    Moderator