PowerCLI

  • 1.  PowerShell Script to get Virtual machine tools.config without login to virtual machines.alternative command for VMwareToolboxCmd.exe

    Posted Jan 23, 2025 03:28 AM

    PowerShell Script to get Virtual machine tools.config without login to virtual machines.alternative command for VMwareToolboxCmd.exe 



  • 2.  RE: PowerShell Script to get Virtual machine tools.config without login to virtual machines.alternative command for VMwareToolboxCmd.exe

    Posted Jan 23, 2025 05:30 AM

    Did you check with

    $vm = Get-VM -Name MyVM
    $vm.ExtensionData.Config.ExtraConfig


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


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


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



  • 3.  RE: PowerShell Script to get Virtual machine tools.config without login to virtual machines.alternative command for VMwareToolboxCmd.exe

    Posted Jan 23, 2025 08:23 PM

    Thanks for your reply. the above command help to get only Virtual machine advance settings. But i need  alternative command below items.

    Actually below command required to login Guest virtual machine. But i am exploring without  login guest machine to get data for below item.

    VMwareToolboxCmd.exe config get autoupgrade allow-add-feature
    VMwareToolboxCmd.exe config get autoupgrade allow-msi-transforms
    VMwareToolboxCmd.exe config get appinfo disabled
    VMwareToolboxCmd.exe config get containerinfo poll-interval
    VMwareToolboxCmd.exe config get guestoperations disabled
    VMwareToolboxCmd.exe config get gueststoreupgrade policy
    VMwareToolboxCmd.exe config get servicediscovery disabled
    VMwareToolboxCmd.exe config get logging log
    "VMwareToolboxCmd.exe config get logging vmsvc.handler
    VMwareToolboxCmd.exe config get logging toolboxcmd.handler
    VMwareToolboxCmd.exe config get logging vgauthsvc.handler
    VMwareToolboxCmd.exe config get logging vmtoolsd.handler"
    VMwareToolboxCmd.exe config get globalconf enabled
    VMwareToolboxCmd.exe config get deployPkg enable-customization
    VMwareToolboxCmd.exe config get autoupgrade allow-remove-feature
    VMwareToolboxCmd.exe config get autoupgrade allow-upgrade




  • 4.  RE: PowerShell Script to get Virtual machine tools.config without login to virtual machines.alternative command for VMwareToolboxCmd.exe

    Posted Jan 25, 2025 12:46 PM

    You can use the Invoke-VMScript cmdlet to run the toolboxcmd.exe inside the VM's Guest OS.

    Something like this for example

    $vmName = 'MyServer'
    $osUser = 'administrator@domain'
    $osPswd = 'VMware1!'
    
    $cmd = @'
    "C:\Program Files\VMware\VMware Tools\VMwareToolboxCmd.exe" config get autoupgrade allow-add-feature
    "C:\Program Files\VMware\VMware Tools\VMwareToolboxCmd.exe" config get autoupgrade allow-msi-transforms
    "C:\Program Files\VMware\VMware Tools\VMwareToolboxCmd.exe" config get appinfo disabled
    "C:\Program Files\VMware\VMware Tools\VMwareToolboxCmd.exe" config get containerinfo poll-interval
    "C:\Program Files\VMware\VMware Tools\VMwareToolboxCmd.exe" config get guestoperations disabled
    "C:\Program Files\VMware\VMware Tools\VMwareToolboxCmd.exe" config get servicediscovery disabled
    '@
    
    $sInvoke = @{
      VM = Get-VM -Name $vmName
      GuestCredential = New-Object -TypeName PSCredential -ArgumentList ($osUser, (ConvertTo-SecureString -String $osPswd -Force -AsPlainText))
      ScriptText = $cmd
      ScriptType = 'bat'
    }
    $result = Invoke-VMScript @sInvoke
    $result.ScriptOutput
    

    Note that in some Guest OS flavours, a long series of vmwaretoolboxcmd.exe calls might not return all the information.
    In that case you have to split up the calls in multiple calls to Invoke-VMScript



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


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


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