intial description
This is very simple script which will export the data in csv as well as set the value also.
body
VC | Host | Version | ESXiShell_Timeout | SSH_Timeout | Dcui_TimeOut |
vmwarediary | abc1.vmwarediary.com | 6.7.0 | 300 | 300 | 300 |
vmwarediary | abc2.vmwarediary.com | 6.7.0 | 300 | 300 | 300 |
vmwarediary | abc3.vmwarediary.com | 6.7.0 | 300 | 300 | 300 |
vmwarediary | abc4.vmwarediary.com | 6.7.0 | 300 | 300 | 300 |
1. Script have two section inside. First Get the value and export in csv and other one set the value and export in csv.
2. You must have powercli module installed on the server.
3. Use the parameter as per your infra decided value.
import-module vmware.vimautomation.core
Connect-VIServer vmwarediary
$HostData = @()
$vmhs = Get-VMHost
foreach($vmh in $vmhs){
$myItem = "" | Select VC , Host , Version, ESXiShell_Timeout , SSH_Timeout , Dcui_TimeOut
$myItem.Host = $vmh.Name
$myItem.VC = $defaultviserver.Name
$myItem.Version = $vmh.Version
#>>>>>>>>>Fetching Details>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
$myItem.ESXiShell_Timeout = Get-AdvancedSetting -Entity (Get-cluster | Get-VMhost $vmh) -name UserVars.ESXiShellTimeOut | Select -ExpandProperty Value
$myItem.SSH_Timeout = Get-AdvancedSetting -Entity (Get-cluster | Get-VMhost $vmh) -name UserVars.ESXiShellInteractiveTimeOut | Select -ExpandProperty Value
$myItem.Dcui_TimeOut = Get-AdvancedSetting -Entity (Get-cluster | Get-VMhost $vmh) -name UserVars.DcuiTimeOut | Select -ExpandProperty Value
#>>>>>>>>>>>>>>>>>>>>>setting the Value>>>>>>>>>>>>>>>>>>>>>>>>>>>
#$myItem.ESXiShell_Timeout = Get-AdvancedSetting -Entity (Get-cluster | Get-VMhost $vmh) -name UserVars.ESXiShellTimeOut | Set-AdvancedSetting -Value 0 -Confirm:$false | select -ExpandProperty value
#$myItem.SSH_Timeout = Get-AdvancedSetting -Entity (Get-cluster | Get-VMhost $vmh) -name UserVars.ESXiShellInteractiveTimeOut | Set-AdvancedSetting -Value 0 -Confirm:$false | select -ExpandProperty value
#$myItem.Dcui_TimeOut = Get-AdvancedSetting -Entity (Get-cluster | Get-VMhost $vmh) -name UserVars.DcuiTimeOut | Set-AdvancedSetting -Value 600 -Confirm:$false | select -ExpandProperty value
$HostData += $myItem
}
$HostData | export-csv -path d:\host.csv -NoTypeInformation
Thanks for visitng the site, if you like the content, kindly like and put comment.
code
text