1 Reply Latest reply on Mar 19, 2014 10:36 AM by LucD

    Changing 2 or more options at the same time - Advanced Settings on ESXi host

    DZ1 Hot Shot


      I have a script to change the syslog location to the first datastore that the ESXi host sees, and then there is an option to change uncheck the "Syslog.global.logDirUnique" (Some hosts had the option checked, but it needs to be changed now)



      My main problem is this...If I went via the GUI in vCenter on the host to Configuration > Advanced Settings > Syslog, I could then change the Syslog.global.logDir, and Syslog.global.logDirUnique, and when I click OK, they would both be changed at the same time.  In the script, one option gets changed and then another.  Is there a way to have them both change at once, without second or so delay?



      Get-datacenter  | Get-VMHost  | foreach {



      $EHost = $_



      Get-AdvancedSetting -Entity $EHost | where { $_.name -eq "Syslog.global.logdir" } | Set-AdvancedSetting -Value  ( "[" + "$( ($Ehost | Get-Datastore | sort Name | select -First 1).name)" + "]" + " " + "/scratch" + "/log" + "/" + "$( ($Ehost).name)" ) -Confirm:$false



      if ( (Get-AdvancedSetting -Entity $EHost | where { $_.name -eq "Syslog.global.logdirUnique" }).value -eq "True"  ) {



      Get-AdvancedSetting -Entity $EHost | where { $_.name -eq "Syslog.global.logdirUnique" } | Set-AdvancedSetting -Value $false -Confirm:$false



      }



      }