Automation

 View Only
  • 1.  Check for *.vib in a path

    Posted Nov 26, 2020 09:20 AM

    Tried to list all upgrade files in a path

    I store the actual update  vibs in a folder called Update. So I want to update the esxi with a script but Get-Childitem returns simply nothing.

    $VMHost = "ESXi"
    Connect-VIServer $VMHost
    $esxcli = Get-ESXcli -VMHost $VMHost

    $ds = Get-Datastore "STORE"
    $Path = $ds.DatastoreBrowserPath + "\Update\"

    $Files = Get-ChildItem -Recurse -Path $Path | sort

    if ($Files.Count -gt 0) {

        Foreach ($File in $Files) {
            $esxcli.software.vib.install($File)
        }
    }

    How can I get the right path to update the esxi?

    Thank you for any help



  • 2.  RE: Check for *.vib in a path
    Best Answer

    Posted Nov 26, 2020 10:01 AM

    You could do something like this.
    Remove the 'dryrun' property from the hash table, or set it to $false, when you are sure the script is working correctly.

     



  • 3.  RE: Check for *.vib in a path

    Posted Nov 26, 2020 10:34 AM

    Thank you very much  for your reply. Solved.