Skip to main content

Script to collect the service tag and the model of ESXi hosts connected to vCenter

 Requirement: Need to gather all the service tags and hardware models of ESXi hosts connected to vCenter.

 

Script: To be saved as ps1 script and execute it and create temp directory to save the file.

$vcenter = Read-Host "vCenter"
$cred = Get-Credential

Connect-VIServer $vcenter -Credential $cred

$result = Get-VMHost | ForEach-Object {

    $h = $_
    $esxcli = Get-EsxCli -VMHost $h -V2

    try {
        $bmc = $esxcli.hardware.ipmi.bmc.get.Invoke()

        # Extract IPv4 only
        $ipv4 = $bmc.IPv4Address

        [PSCustomObject]@{
            Host        = $h.Name
            IPv4Address = $ipv4
        }
    }
    catch {
        [PSCustomObject]@{
            Host        = $h.Name
            IPv4Address = "Not Available"
        }
    }
}

# Export to CSV
$csvPath = "C:\Temp\ESXi_BMC_IPs.csv"
$result | Export-Csv -Path $csvPath -NoTypeInformation

# Optional: also display nicely in console
$result | Format-Table -AutoSize

Write-Host "Report saved to $csvPath"

 

1) Run the script

2) Prompt will be open for credentials

3) Input the credentials and it will generate the output. 

 Sample Output:


 


 

Comments

Popular posts from this blog

How to find the physical switch port details from esxcli?

 This article will help you to get the details of the physical switch port details of  ESXi uplinks. Step 1: Login to the ESXi host using root user/ SSO User. Step 2: Enter the below command into the terminal.   vim-cmd hostsvc/net/query_networkhint | grep 'portId\|devId\|vmnic' Output will show the details of the associated physical switch. Note: CDP, LLDP has to be enabled on physical switch. This information is needed when you end up in a troubleshooting session with network team for physical uplinks down/inconsistency of traffic.

System Recovery Partition Disk Blocks The Extension of Windows Disk - Sysprep Issues

Requirement : Windows Activated Template on vCenter  Issue : After the windows is installed, system recovery partition end up created next to windows disk.  Resolution Credit : Mohammed Junaid Ahmed                           Resolution :  1) Create a VM using standard procedure on vCenter  2) Power ON the VM and follow below screen instructions  Click Next   Click on ' Repair your computer '  Click on Troubleshoot       Click on Command Prompt     You should see the command prompt Begin with Diskpart   Click Turn off your PC Restart your computer and continue windows installation, and you will see the disk partitions as below

Renew SSL Certificate for vCloud Director 10.4

Hello There, I would like to give credit for this article to my colleague Muhannad S. Aljaghthami who worked on this task and gave us full insight on how to do. Now lets talk about replacing an expired/ about to expire SSL certificate for the vCloud Director application which is hosted on internet. Prerequisites: Digicert Certificate utility for windows.  Putty/Mobaxterm application for SSH to vCD cells. Winscp to transfer the files to vCD cells. SSH access should be validated on vCD Cells Backup tool to take a backup of vCD cells. Versions & products used while writing this article: vCloud Director 10.4 NSX AVI 22.1.1 Step by step procedure: Initiated a CSR request using Digicert utility for windows and shared the CSR with the team who manages the SSL certificates.  Post submission of CSR,we received the root & SSL certificate for our vCloud Director URL. Using the Digicert utility, we have extracted the pfx file and key file, sample screenshot below.     No...