any idea how to get rid of this warning? I already have scratch partition configured. i dont see a supress value to hide this
#Start Setting Paramters for Scripts
param(
[Parameter(Mandatory=$true)]$vCenter,
$VMhost ="*",
$clusterName = '*'
)
#End Setting Paramters for Scripts
#Connect to vCenter
Write-Verbose "Connecting to vCenter"
$server = Connect-VIServer $vCenter -credential $(get-credential)
# Start Creating Scratch Partitions #######################################################################################
$currentLoc = Get-Location
$cluster = Get-Cluster $clusterName
ForEach ($VMhostname in ($cluster | Get-VMHost -name $VMhost)| sort)
{
#Get only the first part of the FQDN (only if you used the FQDN to add the ESX server to vCenter)
$hostname = $VMhostname.name.split(".")[0].ToUpper()
Write-Host -ForegroundColor green "Configuring $hostname"
$hostnamefolder = $VMhostname.name.split(".")[0]
$folder = ".locker_"+$hostnamefolder
#Local datastore
$datastore = get-datastore -name 'MGMT-DS-01' -Entity $VMhostname
Write-Verbose "Datastore is $($datastore.name)"
#Make the local datastore accessible as a PSdrive
$null = New-PSDrive -Name $hostname -Root \ -PSProvider VimDatastore -Datastore ($datastore) -Scope global
Write-Verbose "Created PSDrive at location $hostname"
#Access the new PSDrive
Set-Location $hostname":"
Write-Verbose "Changed Location to datastore"
#Create the syslog folder
$null = New-Item $folder -ItemType directory -ErrorAction SilentlyContinue
Write-Verbose "Created folder named $folder"
#Set the advanced parameter to configure the scratch on the boot lun
$value = "/vmfs/volumes/$($datastore.name)/"+$folder
Get-AdvancedSetting -Entity $VMhostname -Name "ScratchConfig.ConfiguredScratchLocation" | Set-AdvancedSetting -Value $value -confirm:$false
Write-Verbose "Set scratch location on $hostname to $value"
#Cleanup
Set-Location $currentLoc
Remove-PSDrive $hostname
Clear-Variable hostname -ErrorAction SilentlyContinue
Clear-Variable datastorename -ErrorAction SilentlyContinue
Clear-Variable value -ErrorAction SilentlyContinue
}
Write-Host -ForegroundColor Green "End Creating Scratch Partition".ToUpper()
# End Creating Scratch Partitions ##################################################################################
Attached is a sample for configuring scratch partitions. - You will need to tweek the directory and cluster name to suit. You will need to reboot once they are set for the log folder to appear in the shared storage. Also both location in the second screengrab should be the same. As in Directory Configured and current directory
Changing the configured scratch location requires a reboot of the ESXi host for the changes to take effect.
Have you done that?