PowerCLI: Check ESXi Scratch Location and Syslog Server Settings


As part of the ESXi health check, we need to ensure the scratch location and syslog server has been configured correctly. Here is my script to check the settings:

$VMHost = Get-Content C:\powercli\Servers.txt

Foreach ($_ in $VMHost) {
$Scratch = Get-VMHostAdvancedConfiguration -VMHost $_ -Name ScratchConfig.ConfiguredScratchLocation
$SyslogServer = Get-VMHostAdvancedConfiguration -VMHost $_ -Name syslog.global.loghost
$SyslogDir = Get-VMHostAdvancedConfiguration -VMHost $_ -Name syslog.global.logDir

Write-Host $_ “|Scratch_Location:” $Scratch.Values ” |Syslog_Server:” $SyslogServer.Values ” |Syslog_Dir:” $SyslogDir.Values
}

The results look this:

vmhost-01.rcau.org.au |Scratch_Location: /vmfs/volumes/4f7a9ded-b8f5c9e2-fb7a-5cf3fcad2cab/.locker-vmhost-01  |Syslog_Server: udp://Syslog-01:514  |Syslog_Dir:
vmhost-02.rcau.org.au |Scratch_Location: /vmfs/volumes/4f7a9ded-b8f5c9e2-fb7a-5cf3fcad2cab/.locker-vmhost-02  |Syslog_Server: udp://Syslog-01:514  |Syslog_Dir:
vmhost-03.rcau.org.au |Scratch_Location: /vmfs/volumes/4f7a9ded-b8f5c9e2-fb7a-5cf3fcad2cab/.locker-vmhost-03  |Syslog_Server: udp://Syslog-01:514  |Syslog_Dir:

 

How to change the scratch location?

Advertisement

3 thoughts on “PowerCLI: Check ESXi Scratch Location and Syslog Server Settings

  1. For newer versions, the script can be:

    foreach ($Ht in $Hosts){
    >> $SyslogDir = Get-VMHost $Ht | Get-AdvancedSetting -Name ‘Syslog.global.logDir’
    >> $SyslogServer = Get-VMHost $Ht | Get-AdvancedSetting -Name ‘Syslog.global.loghost’
    >> $Scratch = Get-VMHost $Ht | Get-AdvancedSetting -Name ‘ScratchConfig.CurrentScratchLocation’
    >> Write-Host $Ht “| Syslog Dir: ” $SyslogDir.Value “| Syslog Server: ” $SyslogServer.Value “| Scratch Location: ” $Scratch.Value | ft -AutoSize
    >> }

  2. For newer versions, the script can be:

    foreach ($Ht in $Hosts){
    >> $SyslogDir = Get-VMHost $Ht | Get-AdvancedSetting -Name ‘Syslog.global.logDir’
    >> $SyslogServer = Get-VMHost $Ht | Get-AdvancedSetting -Name ‘Syslog.global.loghost’
    >> $Scratch = Get-VMHost $Ht | Get-AdvancedSetting -Name ‘ScratchConfig.CurrentScratchLocation’
    >> Write-Host $Ht “| Syslog Dir: ” $SyslogDir.Value “| Syslog Server: ” $SyslogServer.Value “| Scratch Location: ” $Scratch.Value | ft -AutoSize
    >> }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s