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.

JobQueue is full in iDRAC and unable to upgrade firmware??

  Hello There, I was working recently on upgrading the firmware for Dell Power Edge servers due a requirement. As usual, I did the download of the necessary firmware update file and uploaded it in the iDRAC and started the upgrade. Waited for couple of minutes, If I can say, it was almost 15 minutes without any progress. I tried to check the log/job queue in the iDRAC and found it was full of old entries and I tried clearing it but found no option. Later after findings, I managed to find a command which clears the jobqueue, and below is the command I used after logging into iDRAC via SSH. racadm jobqueue delete -i JID_CLEARALL_FORCE Once the above command was executed, I tried to login to iDRAC and check the job queue and found everything was cleared. Whats next?? Tried uploading the file again and then managed to successfully update the firmware.

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...