SCharchouf's Posts

server are registred with FQDN I'm not sure if the certificate contains both FQDN and IP but I confirm that the vCenter is not resolved by its IP I verified with a Production vcenter I can ... See more...
server are registred with FQDN I'm not sure if the certificate contains both FQDN and IP but I confirm that the vCenter is not resolved by its IP I verified with a Production vcenter I can resolve the FQDN bwhen I nslookup its IP Get-EsxCli : 24/10/2020 20:58:21    Get-EsxCli          Could not establish secure channel for SSL/TLS with authority 'vCenter.local'. At X:\script.ps1:186 char:19 +     $esxcli = Get-EsxCli -VMHost $ESX -V2 +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo      : NotSpecified: (:) [Get-EsxCli], VimException + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.EsxCli.GetEsxC    li You cannot call a method on a null-valued expression. At X:\script.ps1:188 char:9 +     $obj = New-Object -TypeName PSObject -Property @{ +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo      : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull
Yep is that one but another one also provided the same error on a different server
I mean as I'm connecting to ESXi node through vCenter I'm trying to find a way to check why Get-VMHost is not working withing the script FYI : when I just connect to vCenter I run the Cmdlet G... See more...
I mean as I'm connecting to ESXi node through vCenter I'm trying to find a way to check why Get-VMHost is not working withing the script FYI : when I just connect to vCenter I run the Cmdlet Get-VMHost it's working really strange....:smileycry:
I'm trying to find a scripted way to collect all the information, however vCenter is not resolved with its IP address.
Thank you very much, it's perfect as a result
despite that I'm adding the below to my script, I have always the error message : Get-EsxCli Could not establish secure channel for SSL/TLS with authority [System.Net.ServicePointManager]::Sec... See more...
despite that I'm adding the below to my script, I have always the error message : Get-EsxCli Could not establish secure channel for SSL/TLS with authority [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls,[System.Net.SecurityProtocolType]::Tls11,[System.Net.SecurityProtocolType]::Tls12 Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false has anyone encountered this kind of problem?
I tried also to get the failed Host by using $($obj.VMHost)  but it didn't provide a good result
Thanks for confirmation finally, even the error message appears, the script is running. on a test vcenter there is just 1 single server which does not report information. is that possibl... See more...
Thanks for confirmation finally, even the error message appears, the script is running. on a test vcenter there is just 1 single server which does not report information. is that possible the information of the total number of ESXs checked in the vCenter, so that I can make the comparisons with the inventory of ESXs
Server rebooted same issue, checked with another vCenter also same issue I guess you are right regarding the error message related to SSL/TLS can we work with Get-Cluster | Get-VMHost -Pipeli... See more...
Server rebooted same issue, checked with another vCenter also same issue I guess you are right regarding the error message related to SSL/TLS can we work with Get-Cluster | Get-VMHost -PipelineVariable esx instead of using $esxcli and obtain the same result?
Thanks, you just put me on a track, the server had a restart message, I will test once started
I tested the script like this Get-VMHost | ForEach-Object -Process {     $esxcli = Get-ESXCLI -VMHost $_ -V2     $obj = New-Object -TypeName PSObject -Property @{                 Msg =... See more...
I tested the script like this Get-VMHost | ForEach-Object -Process {     $esxcli = Get-ESXCLI -VMHost $_ -V2     $obj = New-Object -TypeName PSObject -Property @{                 Msg = ($esxcli.software.acceptance.get.Invoke()).Trim()         VMHost = $esxcli.system.hostname.get.Invoke().FullyqualifiedDomainName }     if($obj.Msg -match 'PartnerSupported' ){         Write-Log -FilePath $LogFile -Message "Host $($obj.VMHost) have PartnerSupported Software Acceptance" -Level Success     }     else{      if($obj.Msg -match 'VMwareAccepted' ){         Write-Log -FilePath $LogFile -Message "Host $($obj.VMHost) have VMwareAccepted Software Acceptance" -Level Success     else{               Write-Log -FilePath $LogFile -Message "Host $($obj.VMHost) have VMwareCertified Software Acceptance" -Level Success     } } } } I got the below error : You cannot call a method on a null-valued expression. At X:\script.ps1:172 char:5 +     $obj = New-Object -TypeName PSObject -Property @{ +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : InvalidOperation: (:) [], RuntimeException     + FullyQualifiedErrorId : InvokeMethodOnNull
Thanks for the clarification I will check this on a new thread     Hostname should be added after acceptance in oder to get information for the host(s) that may have a different Software Acce... See more...
Thanks for the clarification I will check this on a new thread     Hostname should be added after acceptance in oder to get information for the host(s) that may have a different Software Acceptance Level
Thanks it's working fine   with just an error related to SSL/TLS Just a question it's possible to add the hostname?
Yes I'm connected to vcenter and I just tested the script like this and same issue $vcenter = Read-Host "vCenter name:" $user = Read-Host "User:" $password = Read-Host "Password:" $FileHa... See more...
Yes I'm connected to vcenter and I just tested the script like this and same issue $vcenter = Read-Host "vCenter name:" $user = Read-Host "User:" $password = Read-Host "Password:" $FileHardening = 'E:\temp' $esxcli = Get-ESXCLI -VMHost * -V2 $generatefile = ForEach ($line in $esxcli) { $line.software.acceptance.get.Invoke() } $generatefile | Out-String | ForEach-Object { $_.Trim() } > "E:\temp\Software_AcceptanceLevel-config.txt" $generateerrorfile = foreach ($line in (Get-Content -Path "E:\temp\Software_AcceptanceLevel-config.txt")) { if ($line -like "*PartnerSupported*") { } else { $line } } if ($generateerrorfile -eq $Null) {     Write-Host "All Hosts have PartnerSupported Software Acceptance" } else {     Write-Host "Hosts with wrong Software Acceptance detected"     Write-Host "You need to modify them manually" } it works only If I do connect-viserver then I run the script
despite that I added this on the top of my script I got the below error message Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false Get-ESXCLI : 23/10/2020 19:10:4... See more...
despite that I added this on the top of my script I got the below error message Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false Get-ESXCLI : 23/10/2020 19:10:40    Get-EsxCli          Could not establish secure channel for SSL/TLS with authority 'vcenter.local'. At E:\Hardening_ESXi\Herdening_ESXi.ps1:182 char:11 + $esxcli = Get-ESXCLI -VMHost * -V2 +       ~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo      : NotSpecified: (:) [Get-EsxCli], VimException + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.EsxCli.GetEsxCli
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 =... See more...
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() } > "$FileHardening\Software_AcceptanceLevel-config.txt" $generateerrorfile = foreach($line in (gc "$FileHardening\Software_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
Thanks LucD if I identify some VMs with DirectPath Enabled is there a way to disabled this option as it's not recommended by VMware your comment are always welcome
Hello Community, is there a way via script to get all VMs that have DirectPath I/O enabled?
Thanks LucD I'm using a function to log output to file , so if I have understood correctly shall I add this parametre $host.PrivateData to my function or I need to create another one? is t... See more...
Thanks LucD I'm using a function to log output to file , so if I have understood correctly shall I add this parametre $host.PrivateData to my function or I need to create another one? is there some samples to check and learn from it?:smileyblush: