VMware Cloud Community
shankamu
Enthusiast
Enthusiast
Jump to solution

PowerCLI script to Export standalone ESXi host License

Hi,

Could you you please help with correct script to Export standalone 200 vSphere6 ESXi host License. All hosts have common credentials and few are part of vCenter servers and few stand alone.

Regards,

Reply
0 Kudos
1 Solution

Accepted Solutions
RvdNieuwendijk
Leadership
Leadership
Jump to solution

You can use the following PowerCLI script to retrieve the license keys of the standalone ESXi hosts esx1.yourdomain.com and esx2.yourdomain.com:

$VMHosts = 'esx1.yourdomain.com','esx2.yourdomain.com'

foreach ($VMHost in $VMHosts)

{

  $VIServer = Connect-VIserver -Server $VMHost -User root -Password 'secret' 

  if ($VIServer)

  {

    Get-VMHost -Server $VIServer | Select-Object -Property Name,LicenseKey

    Disconnect-VIServer -Server $VIServer -Confirm:$false

  }

}

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition

View solution in original post

3 Replies
RvdNieuwendijk
Leadership
Leadership
Jump to solution

You can use the following PowerCLI script to retrieve the license keys of the standalone ESXi hosts esx1.yourdomain.com and esx2.yourdomain.com:

$VMHosts = 'esx1.yourdomain.com','esx2.yourdomain.com'

foreach ($VMHost in $VMHosts)

{

  $VIServer = Connect-VIserver -Server $VMHost -User root -Password 'secret' 

  if ($VIServer)

  {

    Get-VMHost -Server $VIServer | Select-Object -Property Name,LicenseKey

    Disconnect-VIServer -Server $VIServer -Confirm:$false

  }

}

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
shankamu
Enthusiast
Enthusiast
Jump to solution

Could you please help me with input file for ESXhosts and export the output file to csv file for 200+ hosts.

Reply
0 Kudos
shankamu
Enthusiast
Enthusiast
Jump to solution

Could you please help me with input file for ESXhosts and export the output file to csv file for 200+ hosts.

Reply
0 Kudos