Software Acceptance Level

This post was originally published on this site

I’m trying to get the software acceptance level for some hosts and then provide a result

basicaly the script should collect the info and then compare it unfortunaly it’s not working

 

$esxcli = Get-ESXCLI -VMHost -V2 -Server

$generatefile = ForEach($line in $esxcli) {$line.software.acceptance.get()}

$generatefile | Out-String | ForEach-Object { $_.Trim() } > “$FileHardeningSoftware_AcceptanceLevel-config.txt”

$generateerrorfile = foreach($line in (gc “$FileHardeningSoftware_AcceptanceLevel-config.txt”)) {if ($line -like “*PartnerSupported*”) {} else {$line}}

if ($generateerrorfile -eq $Null) {

Write-Log -FilePath $LogFile -Message “All Hosts have PartnerSupported Software Acceptance” -Level Success

}

else{

Write-Log -FilePath $LogFile -Message “Hosts with wrong Software Acceptance detected” -Level Warning

Write-Log -FilePath $LogFile -Message “You need to modify them manually” -Level Warning

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.