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

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

Create a vCenter role using vCenter MOB

 Requirement: Finding a way to automate the creation of Role for any services with its permissions. Example: Citrix service account to be integrated with vCenter. Steps: 1) Login to vCenter : https://192.168.1.68/mob  2) Click on 'Content'                3) Click on Authorization Manager                                     4) Click on  'AddAuthorizationRole'                             5) Provide name in name field & privId in xml format & Click Invoke Method                        This should give you a return value and then the Role will be reflected on vCenter. 

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