Automation

 View Only
  • 1.  Script to compare the images before scriptbased update

    Posted Jun 27, 2024 03:30 AM
    Edited by dampfross Jun 27, 2024 03:45 AM

    Hi, before we changed to ESXi 8.x our updates were based on baselines. Now we changed to image based updates. Unfortunately I could not find the comparable commands.

    My former part of the script should be replaced (if possible)

            $Update = Get-Compliance -Entity $vmHost -ComplianceStatus NotCompliant -Detailed    # check the Baselines if there is any unassigned


            foreach ($Baseline in $Update) {            
                attach-baseline -entity $vmHost -Baseline $Update.Baseline                        # assign baselines
            }
            $Start = Get-Date -Format "HH:mm:ss"

            $Baselines = Get-Baseline -Entity $vmHost                                                       # Create list of all baselines

            if ($Update.Count -gt 0) {
                Test-Compliance -entity $vmHost                                                                  # Check update against actual host
                Stage-Patch -Entity $vmHost                                                                        # Assign Update to host
              }
    After the preconditions are met, the update follows:

              Update-Entity -Entity $vmhost    -Baseline $Baselines -Confirm:$false


    Found some commands with python, but even I installed python 3.12 with powercli 13.2, executing these commands tells me, for example:

    Get-EsxImageProfile : Failed to run 'python.exe'. Make sure that Python 3.7.1 or higher is installed and that you have set the path to 
    the Python executable by using Set-PowerCLIConfiguration -PythonPath <executable_path>. See the PowerCLI Compatibility Matrixes for 
    information on the Python requirements.

    Python path was defined:
    Set-PowerCLIConfiguration -WebOperationTimeoutSeconds -1 -PythonPath "C:\Program Files\Python\Python312\" -Confirm:$false

    So I would prefer a solution without python, if there is any.
    Thanks in advance



  • 2.  RE: Script to compare the images before scriptbased update

    Posted Jun 27, 2024 10:03 AM

    I'm afraid not, these new cmdlets require (the correct) Python version.



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


    Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference


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



  • 3.  RE: Script to compare the images before scriptbased update

    Posted Jun 27, 2024 11:01 AM
    Two additional questions:The python version 3 12 is too high?
    And will do these cmdlets the mentioned job?
    Just looking for an replacement to compare and install the images ;)






  • 4.  RE: Script to compare the images before scriptbased update

    Posted Jun 27, 2024 11:23 AM

    I saw mentions that Python 3.11 worked with PowerCLI 13.2.1.

    The PowerCLI 13.2.2 Release Notes mention that some Python version dependencies were fixed.

    Using the Imega Builder cmdlets is described in Configure vSphere ESXi Image Builder



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


    Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference


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



  • 5.  RE: Script to compare the images before scriptbased update

    Posted Jun 27, 2024 03:05 PM
    Thank you, I'll try it