‘ESXI-Details.ps1’
#Set Cleanup
rm -force -verbose d:\PowerShell\reports\ESXIHostDetails.txt
#Set ESXIHosts from this script below:
#. D:\powershell\Set-ESXiHosts.ps1
$ESXIHosts = gc D:\powershell\input\ESXIHosts.txt
#$ESXIHosts.count
# Connect to each vCenter server
#Set Headers
‘ESXIHostDetailComputerName,ESXIHostDetailIP’|out-file -Append -Encoding ascii d:\PowerShell\reports\ESXIHostDetails.txt
foreach($ESXIHost in $ESXIHosts){
# Test network connection to vCenter server
$ESXIHostDetail = Test-NetConnection $ESXIHost -ea Stop |select -Unique -Property ComputerName, RemoteAddress
if($ESXIHostDetail -is $Null){continue}
# Extract required information from network connection details
$ESXIHostDetailComputerName = $ESXIHostDetail.ComputerName
$ESXIHostDetailRemoteAddress = $ESXIHostDetail.RemoteAddress
$ESXIHostDetailIP = $ESXIHostDetail.RemoteAddress.IPAddressToString
“$ESXIHostDetailComputerName,$ESXIHostDetailIP” |out-file -Append -Encoding ascii d:\PowerShell\reports\ESXIHostDetails.txt
}
Get ESXi Details
by
Tags:
Leave a Reply