Automation

 View Only
  • 1.  Windows 2012 R2 to Windows 2019 migrations using PowerCLI

    Posted Feb 22, 2023 12:48 PM

    Hello everybody

    I've got some Windows 2012 R2 VM's I need to upgrade to Windows Server 2019 under vSphere 6.7

    I've upgraded some of the test servers in-place which, allbeit time consuming, is ok, however I would rather use something like Powercli to spin up copies of the servers on a different network, upgrade to Windows 2019 via Ansible / unattended deployment and then take the original server offline & assign the network adaptor to the new machine

    I'm far from an expert on VMWare so I'd love to utilise peoples knowledge on how they have carried out similar tasks.  I was thinking of using get-vm / new-vm & using snapshots, but I think this will cause my problems with UUID and MAC's etc.  I some how need to take a copy of that server to <servername>_clone, upgrade the OS, then drop the <servername> and make <servername>_clone the original <servername>. 

    I'd love to hear your ideas on how best to achieve this. 



  • 2.  RE: Windows 2012 R2 to Windows 2019 migrations using PowerCLI

    Posted Feb 22, 2023 12:57 PM

    Do the original VMs need to stay online while the upgrade is being done?
    If no, then taking a snapshot, moving the VM to another network, doing the upgrade, testing the upgrade, moving it back to the original network, and finally consolidating the Snapshot would be the preferred way of working for me.

    If yes, you will have to make a clone of the original VM, and do your upgrade on that clone.
    If the MAC of the original VM is any way used for things like licensing, you have an issue.
    While you could manually assign the same MAC on the clone, this might cause networking issues.
    The UUID of a new VM is always different, there is no way around that.
    But I wonder where in the Guest OS you would have a need for that UUID.
    Unless you mean something else than the VVM's UUID?



  • 3.  RE: Windows 2012 R2 to Windows 2019 migrations using PowerCLI

    Posted Feb 22, 2023 01:29 PM

    Thanks for the reply LucD, very much appreciated

    No they wouldn't need to stay online during the upgrade.  At minimum, the prod ones would be done over a maintenance weekend, so limited downtime on the source is not an issue.

    My main point about the UUID and I accept I may be using the wrong term (or even talking rubbish !) is that if two boxes are active and have the same ID, will things get confused.  Especially are setup on a cluster and cause problems with failover / cause vSphere act strangely etc - I don't know.  But I think you've provided me with info anyway - the UUID would NOT be the same even with a snapshot copy, so vSphere will never see it as the same machine, its always going to be a unique box - which is great.

    I'll check posts /webpages for consolidation of Snapshots.  It sounds like that is something else I wasn't aware of - taking two snapshots (one 2012 R2 & one 2019) and merging them.

     

     



  • 4.  RE: Windows 2012 R2 to Windows 2019 migrations using PowerCLI

    Posted Feb 22, 2023 01:35 PM

    Just to clarify, if the UUID you mention is the one from the actual VM, that will stay the same after a Snapshot.
    In fact, the entire VM will be the same, just that all changes after the snapshot are recorded separately, so you can revert when something goes wrong.
    If everything is ok, a snapshot consolidation merges the recorded changes into the VM's files, more specifically the harddisks.

    As a note, if there are things like databases running inside the Guest OS, it is always wise to take the snapshot when the VM is powered off. That avoids DB inconsistencies.



  • 5.  RE: Windows 2012 R2 to Windows 2019 migrations using PowerCLI

    Posted Feb 22, 2023 01:51 PM

    So if I have two VM's running (one a clone of the other) - they'll both have the same UUID - does that not cause issues within vSphere ?  I guess that would be akin to have a multiple unique ids for something, or is this mitigated by ensuring they are on a different network ?

     

    Do you have any code you could point to for this ?  I'd imagine pseudo-code it would be similar to ;

    Connect to viserver

    source = get-vm -name "source-server"

    clone_server = new-vm $source

    source_network = get-networkadaptor $source

    clone_server | set-networkadaptor <temp network adaptor>

    Then start up the cloned server, update it to 2019, test

    clone_server | set-networkadaptor $source_network

     

    Noted your point re stopping vm & taking a snapshot.  Sounds like a sensible approach



  • 6.  RE: Windows 2012 R2 to Windows 2019 migrations using PowerCLI

    Posted Feb 22, 2023 03:02 PM

    I suspect you might have the wrong conception of a VM's UUID.
    First, this is entirely internal to the vSphere environment, the Guest OS does not use this to distinguish systems.

    The API Reference defines the UUID as

    LucD_0-1677078050105.png

    So when a new VM is created (beit from scratch or as a clone), vSphere will assign it a new UUID.

    With a Snapshot a VM keeps it's UUID.