VMware Cloud Community
Vishy1
Enthusiast
Enthusiast
Jump to solution

How to check if VT is enabled

Hi There,

We have a large VM enviromnent and I want to be able to check if Intel VT is enabled using a powershell script for enitre ESX servers (Dell Poweredge) via VC, hoping someone wrote a script that can do this task in a single execution.

Thanks in Advance.

If you found this information useful, please consider awarding points for Correct or Helpful.

If you found this information useful, please consider awarding points for Correct or Helpful.
Tags (1)
Reply
0 Kudos
1 Solution

Accepted Solutions
tomtom1
Enthusiast
Enthusiast
Jump to solution

This is what it returns

PS C:\Documents and Settings\tom\Desktop> $host.version

Major Minor Build Revision

-


-


-


-


2 0 -1 -1

View solution in original post

Reply
0 Kudos
13 Replies
RvdNieuwendijk
Leadership
Leadership
Jump to solution

You can use the console command 'esxcfg-info|grep "HV Support"' and plink.exe to get the VT enabled status from PowerCLI. See for an example of using plink.exe. You can download plink.exe from the PuTTY Download Page if you don't have it already.

Information about the output of the HV Support command can be found in the VMware Knowledge base article Determining if Intel Virtualization Technology or AMD Virtualization is enabled in the BIOS without ....

Combining all these information I come to the following script:

$User = "root"
$Password = "password"
$Command = "esxcfg-info | grep 'HV Support'"

function Invoke-VMhostCommand {
  # This function assumes that plink.exe is in your path
  param([parameter(Mandatory=$true)][string] $VMHost,
        [parameter(Mandatory=$true)][string] $User,
        [parameter(Mandatory=$true)][string] $Password,
        [parameter(Mandatory=$true)][string] $Command)

  $plink = "plink.exe"
  $plinkoptions = " -v -batch -pw $Password"
  $remoteCommand = '"' + $Command + '"'
  $PlinkCommand = $plink + " " + $plinkoptions + " " + $User + "@" + $VMHost + " " + $remoteCommand
  $msg = Invoke-Expression -command $PlinkCommand
  $Report = "" | Select-Object Host,Output
  $Report.Host = $VMHost
  $Report.Output = $msg
  $Report
}

$Report = Get-VMHost | ForEach-Object {Invoke-VMHostCommand -VMHost $_.Name -User $User -Password $Password -Command $Command }
$Report | Format-Table -AutoSize

Regards, Robert

Message was edited by: RvdNieuwendijk

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Reply
0 Kudos
AlbertWT
Virtuoso
Virtuoso
Jump to solution

Wow, this is such a good article.

Kind Regards,

AWT

/* Please feel free to provide any comments or input you may have. */
Reply
0 Kudos
tomtom1
Enthusiast
Enthusiast
Jump to solution

Can any one tell me how to run this script? I have downloaded and kept the plink.exe on my c:\windows path. I also have power path installed.

thanks

Reply
0 Kudos
RvdNieuwendijk
Leadership
Leadership
Jump to solution

Hi Albert,

I'm glad you like it.

Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Reply
0 Kudos
RvdNieuwendijk
Leadership
Leadership
Jump to solution

If you make a mistake in a post you can use the edit link to change it. So you don't have to make a new post to correct it. I use it all the time. Smiley Wink

To use the script you need PowerShell v2 and VMware vSphere PowerCLI, which you can download from http://www.vmware.com/go/powercli.

Before you run the script you need to connect to a vCenter server first with the Connect-VIserver cmdlet. If your vCenter server is called vCenter1 you can do this with:

Connect-VIserver vCenter1 -Credential (Get-Credential)

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

Actually, I tried stopping the request via browser and I thought it did not go through Smiley Happy But after wards, I saw I have 2 posts now. Smiley Happy

This is the erro message I am getting

PS C:\Documents and Settings\tom\Desktop> .\vt.ps1

Parameter attributes need to be a constant or a script block.

At C:\Documents and Settings\tom\Desktop\vt.ps1:7 char:35

+ param([string] $VMHost,

PS C:\Documents and Settings\tom\Desktop>

Thanks

Reply
0 Kudos
Troy_Clavell
Immortal
Immortal
Jump to solution

I deleted the duplicate post for you Smiley Wink

Reply
0 Kudos
RvdNieuwendijk
Leadership
Leadership
Jump to solution

It looks like you are running PowerShell v1. The script uses features that are new in PowerShell v2. So you need to install that to run this script. You can check if you are running PowerShell v2 with the $host.version command. It should return:

[vSphere PowerCLI] C:\users\robert> $host.version

Major  Minor  Build  Revision
-----  -----  -----  --------
2      0      -1     -1

You can download PowerShell v2 from Download Windows PowerShell.

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

This is what it returns

PS C:\Documents and Settings\tom\Desktop> $host.version

Major Minor Build Revision

-


-


-


-


2 0 -1 -1

Reply
0 Kudos
RvdNieuwendijk
Leadership
Leadership
Jump to solution

It looks like you have PowerShell v2 allready installed. Maybe something is wrong with the installation. Can you try to remove PowerShell from your system and install PowerShell v2 again?

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Reply
0 Kudos
AlbertWT
Virtuoso
Virtuoso
Jump to solution

Hi Tom,

From where did you downloaded the plink.exe ?

/* Please feel free to provide any comments or input you may have. */
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

The PuTTY Suite download page.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
AlbertWT
Virtuoso
Virtuoso
Jump to solution

Ah... thanks man, I really appreciate your help.

Cheers,

Albert

/* Please feel free to provide any comments or input you may have. */
Reply
0 Kudos