PowerCLI

 View Only
  • 1.  Set-VM change ConfiguredGuestID and Configured Guest OS

    Posted Sep 10, 2018 04:19 PM

    Good morning!

    Looking for a way to change via set-vm configuredguestid and configured guest OS.  It appears after pawing through help text there is no set-vm cmdlet or option which could be used to change the values.   Is this correct, am i missing something?   It appears the vm must be powered off in order to change the  Configured Guest OS.  Here is the script I'm fiddling with:

    Get-Content -Path D:\PowerShell_temp\Configured_GuestId.txt | %{

    Get-VMGuest -VM (Get-VM -Name $_) | Set-VM -ConfiguredGuestId centos6_64Guest -Confirm:$false

      }

    Thank you in advance for your input.

    Norm



  • 2.  RE: Set-VM change ConfiguredGuestID and Configured Guest OS

    Posted Sep 10, 2018 05:02 PM

    Not sure why you are using Get-VMGuest.

    You can do

    Get-VM -Name MyVM | Set-VM -GuestId windows9_64Guest

    The values you can use on the GuestId parameter are defined in the VirtualMachineGuestOsIdentifier enum.



  • 3.  RE: Set-VM change ConfiguredGuestID and Configured Guest OS

    Posted Sep 10, 2018 05:39 PM

    Hi Lucd;

    Trying to change Configured GuestID and Configured Guest OS don't have a need to change GuestID, hence the need to use Get-VMGuest -VM    if I'm understanding correctly the only way I can  access ConfiguredGuestID  is through Get-VMGuest,  your right but it doesn't appear one can change the Configured Guest OS via set-vm

    Thanks for your input

    Norm



  • 4.  RE: Set-VM change ConfiguredGuestID and Configured Guest OS

    Posted Sep 10, 2018 06:02 PM

    What you name Configured GuestID is changed with the command I gave above.

    In fact the ConfiguredGUestID property is the same as the GuestID property.

    Get-VM | Select Name,

       @{N='ConfiguredGuestId';E={$_.Guest.ConfiguredGuestId}},

       @{N='GuestID';E={$_.ExtensionData.Config.GuestID}}

    Not too sure what you mean with the Configured Guest OS.
    Where do you see that property?



  • 5.  RE: Set-VM change ConfiguredGuestID and Configured Guest OS

    Posted Sep 10, 2018 07:17 PM

    Hello Lucd;

    I'm looking at our vcheck report in the section titled "Virtual machines with incorrect OS configuration" columns 4 "Configured GuestID" and column 5 "Configured Guest OS"

    Norm



  • 6.  RE: Set-VM change ConfiguredGuestID and Configured Guest OS

    Posted Sep 10, 2018 07:23 PM

    Hi Lucd;

    Please note the following:

    [12:18 PM]ndl@FWTS012:Powershell_Test $ Get-VMGuest -VM (Get-VM -Name fwapp261) | Select-Object *

    OSFullName        : CentOS 6 (64-bit)

    IPAddress         : {172.18.61.44, fe80::250:56ff:feb9:5f30}

    State             : Running

    Disks             : {Capacity:6264729600, FreeSpace:4243173376, Path:/, Capacity:499355648, FreeSpace:318663680, Path:/boot, Capacity:1023303680, FreeSpace:1021677568, Path:/home,

                        Capacity:8188788736, FreeSpace:1848401920, Path:/opt...}

    HostName          : FwApp261

    Nics              : {Network adapter 1:dvportgroup-12501}

    ScreenDimensions  : {Width=1280, Height=768}

    VmId              : VirtualMachine-vm-618738

    VM                : FwApp261

    VmUid             : /VIServer=wvus\ndl@fwapp100:443/VirtualMachine=VirtualMachine-vm-618738/

    VmName            : FwApp261

    Uid               : /VIServer=wvus\ndl@fwapp100:443/VirtualMachine=VirtualMachine-vm-618738/VMGuest=/

    GuestId           : centos6_64Guest

    ConfiguredGuestId : rhel6_64Guest        ---- WOULD LIKE TO CHANGE TO centos6_64Guest

    RuntimeGuestId    : centos6_64Guest

    ToolsVersion      : 10.1.7

    ExtensionData     : VMware.Vim.GuestInfo

    Client            : VMware.VimAutomation.ViCore.Impl.V1.VimClient

    GuestFamily       : linuxGuest

    Thank you for input

    Norm



  • 7.  RE: Set-VM change ConfiguredGuestID and Configured Guest OS

    Posted Sep 10, 2018 08:22 PM

    Ok, got you.

    The change can be done with

    Get-VM -Name fwapp261 | Set-VM -GuestId centos6_64Guest

    What the vCheck report shows as Configured  Guest OS is in fact the name of the guest OS, as determined by the VMware Tools.

    You can't change that value, unless you reinstall a new guest OS.



  • 8.  RE: Set-VM change ConfiguredGuestID and Configured Guest OS

    Posted Sep 10, 2018 09:17 PM

    Hello Lucd;

    Understand your command but for some reason it's not working

    Here is a snippet from vcheck report

    Name

    GuestId

    Installed Guest OS

    Configured GuestId

    Configured Guest OS

    FwApp261

    centos6_64Guest

    CentOS 6 (64-bit)

    rhel6_64Guest

    Red Hat Enterprise Linux 6 (64-bit)

    Note the following opportunity:

    1:58 PM]ndl@FWTS012:Powershell_Test $ Get-VM -Name fwapp261 | Set-VM -GuestId centos6_64Guest

    Set-VM : 9/10/2018 2:07:39 PM Set-VM The guest operating system 'centos6_64Guest' is not supported on the host.

    At line:1 char:25

    + Get-VM -Name fwapp261 | Set-VM -GuestId centos6_64Guest

    +                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : InvalidArgument: (:) [Set-VM], InvalidArgument

        + FullyQualifiedErrorId : Client20_VMServiceImpl_TryValidateGuestId_UnsupportedGuestId,VMware.VimAutomation.ViCore.Cmdlets.Commands.SetVM

    Should I assume the host refers to the esxi host the VM is assigned to, any thoughts as to why this message is occuring

    Thank you for your patience!!!

    Norm



  • 9.  RE: Set-VM change ConfiguredGuestID and Configured Guest OS

    Posted Sep 11, 2018 04:38 AM

    The range of supported guest OS depends also on the version of the ESXi node on which you run the VM.

    That's what the error message also seems to suggest.

    Which ESXi version are you using?



  • 10.  RE: Set-VM change ConfiguredGuestID and Configured Guest OS

    Posted Sep 11, 2018 03:28 PM

    Hello Lucd;

    Our current version is 6.5.0

    Norm



  • 11.  RE: Set-VM change ConfiguredGuestID and Configured Guest OS

    Posted Sep 11, 2018 03:32 PM

    That is strange, since the centos6_64Guest guestid is supported since 6.5.

    See also the VirtualMachineGuestOsIdentifier enum I mentioned earlier.

    Is that 6.5 for the ESXi nodes and the vCenter?

    Is the VM powered off when you run the script?