1 2 Previous Next 16 Replies Latest reply on Aug 14, 2018 6:25 AM by JStars

    vmexe HP files execution with PowerCLI

    JStars Enthusiast

      At the end I'm submitting a new thread as I saw that old thread was not moved to the top after the update.

       

      I created a script to upload the file CPxxxx.vmexe successfully to all involved ESXi hosts. Then I'm running this but it produces no result:

       

       

      $vmhost = Get-VMHost xxxxxxxxxxxxxxxxxx  
        
      # Login credentials to SSH each host. It will convert the string from secure to plain text for plink  
      $user = Read-Host "ESXi Host SSH User"  
      $rootpword = Read-Host "ESXi Host SSH Password" -AsSecureString  
      $rootbstr = [System.Runtime.InteropServices.marshal]::SecureStringToBSTR($rootpword)  
      $rootpword = [System.Runtime.InteropServices.marshal]::PtrToStringAuto($rootbstr)  
        
      # The "echo y" command automatically accepts the key for plink.  
        echo y | C:\Users\xxxxxx\Documents\VI-Tools\powerCLI\tested\ESXi\plink.exe -ssh $vmhost -l $user -pw $rootpword exit | Out-Null  
        
      #execute patching  
      C:\Users\xxxxxx\Documents\VI-Tools\powerCLI\tested\ESXi\plink.exe -ssh $vmhost -l $user -pw $rootpword -batch "chmod +x /tmp/CP035395.vmexe"  
      start-process "cmd.exe" "/c echo y | C:\Users\xxxxx\Documents\VI-Tools\powerCLI\tested\ESXi\plink.exe -ssh $vmhost -l $user -pw $rootpword -batch /tmp/CP035395.vmexe"  
        
      sleep -Seconds 60  
        
      $VMhost | Restart-VMHost -Confirm:$false | Out-Null 
      
      

       

      the host gets rebooted but patch is not applied. Is there a way to successfully execute these kind of files with PowerCLI? Executing those commands from within a ssh session works fine.

        1 2 Previous Next