none
Select live migration network in Cluster migration - Script

    Question

  • Hey folks

    I understand that this Cmdlet (set-vmmigrationnetwork) is not for the cluster . However In Hyper V cluster , By default It is selecting all the networks to use for live migration . Is there anyway we could script it to select specific network rather. ? . Also is there any chance we could name the cluster networks. Out of the box it is cluster network 1 , Cluster network 2 etc ...

    Can we script it to name as ISCSI , Live migration, Cluster heartbeat etc . Just to make is easy to visualize.

    Thanks

    mumtaz


    • Edited by mumtazkhan Friday, December 20, 2013 5:23 PM spell
    • Moved by Bill_Stewart Friday, December 20, 2013 5:56 PM Move to more appropriate forum
    Friday, December 20, 2013 5:23 PM

Answers

  • Here is one way to do it, by using the network cluster resource object: http://blogs.msdn.com/b/virtual_pc_guy/archive/2013/05/02/using-powershell-to-configure-live-migration-networks-in-a-hyper-v-cluster.aspx.

    If that's not what you want, there are other ways. I did it differently in my book. Unfortunately, I can't share the script because the publisher owns it. I realize that looks like an egotistical self-plug, but I'd rather be disliked for doing something distasteful than sued for a copyright violation. What the script does is modify values in the keys you'll find at HKLM\Cluster\ResourceTypes\VirtualMachine\Parameters. If you know how to use PowerShell to modify the registry, you can probably figure it out. Just make the change on one node; all the others are updated automatically.


    Eric Siron Altaro Hyper-V Blog
    I am an independent blog contributor, not an Altaro employee. I am solely responsible for the content of my posts.
    "Every relationship you have is in worse shape than you think."

    Friday, December 20, 2013 8:32 PM

All replies

  • Try posting in the Cluster forum.  They would be able to more completely address you issues which are not scripting issues but are issues of how to set up and design a network.

    ¯\_(ツ)_/¯

    Friday, December 20, 2013 5:57 PM
  • Here is one way to do it, by using the network cluster resource object: http://blogs.msdn.com/b/virtual_pc_guy/archive/2013/05/02/using-powershell-to-configure-live-migration-networks-in-a-hyper-v-cluster.aspx.

    If that's not what you want, there are other ways. I did it differently in my book. Unfortunately, I can't share the script because the publisher owns it. I realize that looks like an egotistical self-plug, but I'd rather be disliked for doing something distasteful than sued for a copyright violation. What the script does is modify values in the keys you'll find at HKLM\Cluster\ResourceTypes\VirtualMachine\Parameters. If you know how to use PowerShell to modify the registry, you can probably figure it out. Just make the change on one node; all the others are updated automatically.


    Eric Siron Altaro Hyper-V Blog
    I am an independent blog contributor, not an Altaro employee. I am solely responsible for the content of my posts.
    "Every relationship you have is in worse shape than you think."

    Friday, December 20, 2013 8:32 PM
  • I answered your renaming question in the other forum you posted in.  Looks like Eric has found a more reliable way to set the live migration network than what I posted in the other blog.  I'm going to end up changing my script to Ben's.

    .:|:.:|:. tim

    Saturday, December 21, 2013 11:58 PM
  • Thanks TIm and Eric .

    Eric - Can  I have name of your book please.

    thanks

    mumtaz

    Monday, December 23, 2013 10:29 AM
  • Microsoft Hyper-V Cluster Design. I see that today, the eBook is on sale for $5.00 if you go through the publisher. Amazon usually has the cheapest print price.

    Eric Siron Altaro Hyper-V Blog
    I am an independent blog contributor, not an Altaro employee. I am solely responsible for the content of my posts.
    "Every relationship you have is in worse shape than you think."

    Monday, December 23, 2013 2:15 PM
  • Hi Elton

    Yes problem is now solved . If anyone else need to do this then please refer to my wiki article http://social.technet.microsoft.com/wiki/contents/articles/22142.change-the-cluster-network-names-and-disk-names-using-powershell.aspx

    thanks

    mumtaz


    • Edited by mumtazkhan Friday, December 27, 2013 10:39 AM Adding line
    Friday, December 27, 2013 9:20 AM
  • Did you actually run those commands in your environment to rename things?  I can't see how they would work.  For example:

    Get-ClusterResource -Name "Cluster Disk *").Name = "put your Disk name here"

    I think this will error out if you run it because "Cluster Disk *" is going to return multiple values if you have more than one disk, which is pretty common in a cluster.

    The one for renaming the NICs is actually worse because you are selecting all networks and then renaming based on no known criteria.

    I think you have the basics there (I know the example I gave you for renaming NICs works because it tested for a known network subnet whereas you are pulling all networks), but you need to provide some sort of an explanation of what you are doing.


    .:|:.:|:. tim

    Friday, December 27, 2013 5:00 PM
  • Hi tim

    If you read the text above this powershell . It tells that replace * with the number . For the Network, It tells you to replace the subnet and desired name before running it because everyone has different subnet . 

    Thanks for your feedback anyway, this is my first wiki article . I'll try to make it more readable and understandable. 

    Thanks

    mumtaz 

    Friday, December 27, 2013 11:33 PM
  • I think Mumtar miss big item here.

    ¯\_(ツ)_/¯

    Saturday, December 28, 2013 12:16 AM
  • Hi tim

    If you read the text above this powershell . It tells that replace * with the number . For the Network, It tells you to replace the subnet and desired name before running it because everyone has different subnet . 

    Thanks for your feedback anyway, this is my first wiki article . I'll try to make it more readable and understandable. 

    Thanks

    mumtaz 

    Thanks for your submission and work to improve the community. Tim does have a very valid concern, though. People aren't going to read the text. They're going to copy/paste/execute. With the asterisks, their systems are going to perform actions that they may not have intended. Rather than using asterisks, put in placeholder variables like $Subnet and $CurrentDiskName, and tell people they have to provide valid values. Then, the scripts will fail outright if used as-is instead of producing undesirable effects. You could then provide examples that show possibilities. If you don't want to do that, then use something like a hash sign (#) instead of asterisks. Hash signs have no special meaning inside PowerShell strings and will, like empty placeholder variables, cause the scripts to fail without causing damage.

    Eric Siron Altaro Hyper-V Blog
    I am an independent blog contributor, not an Altaro employee. I am solely responsible for the content of my posts.
    "Every relationship you have is in worse shape than you think."

    Saturday, December 28, 2013 2:42 AM
  • Hi Elton

    Yes problem is now solved . If anyone else need to do this then please refer to my wiki article http://social.technet.microsoft.com/wiki/contents/articles/22142.change-the-cluster-network-names-and-disk-names-using-powershell.aspx

    thanks

    mumtaz



    Unfortunately you code will not work.  You cannot rename an object by assignment.

    ¯\_(ツ)_/¯

    Saturday, December 28, 2013 6:45 AM
  • jrv

    It does works . you need to run this command on one of the cluster nodes . I presume you are running it locally Or create a remote powershell session. 

    Please try to take the below as an example and then modify the subnet according to your environment

    $oldname = Get-ClusterNetwork  | ?{$_.Address -like "192.168.1.*" }| Select-Object name | ForEach-Object{$_.name} 
    (Get-ClusterNetwork -Name $oldname).Name = "ISCSI Network"  

    Saturday, December 28, 2013 9:41 AM
  • Thanks Eric . I will edit the article as you've said .. I think a lot of people are doing copy-paste without reading the text . 

    Thanks

    mumtaz



    • Edited by mumtazkhan Saturday, December 28, 2013 9:50 AM
    Saturday, December 28, 2013 9:43 AM
  • jrv

    It does works . you need to run this command on one of the cluster nodes . I presume you are running it locally Or create a remote powershell session. 

    Please try to take the below as an example and then modify the subnet according to your environment

    $oldname = Get-ClusterNetwork  | ?{$_.Address -like "192.168.1.*" }| Select-Object name | ForEach-Object{$_.name} 
    (Get-ClusterNetwork -Name $oldname).Name = "ISCSI Network"  


    If you carefully read the help for the CmdLet you will see that it only returns information.  There is another CmdLet that is used to "Set" the cluster values.  The "Get" CmdLets are only used to return a status object that can be used in other CmdLets.

    ¯\_(ツ)_/¯

    Saturday, December 28, 2013 9:58 AM
  • Get cmdlet it getting value and .Name in the end can be used to assign the values . Please run these two liner on cluster node and let me if it works for you . And It has to be run on Hyper V 2012 + and minumum powershell 3.0 

    Saturday, December 28, 2013 10:02 AM