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.
This is what it returns
PS C:\Documents and Settings\tom\Desktop> $host.version
Major Minor Build Revision
-
-
-
-
2 0 -1 -1
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
Wow, this is such a good article.
Kind Regards,
AWT
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
Hi Albert,
I'm glad you like it.
Regards, Robert
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.
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)
Actually, I tried stopping the request via browser and I thought it did not go through But after wards, I saw I have 2 posts now.
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
PS C:\Documents and Settings\tom\Desktop>
Thanks
I deleted the duplicate post for you
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.
This is what it returns
PS C:\Documents and Settings\tom\Desktop> $host.version
Major Minor Build Revision
-
-
-
-
2 0 -1 -1
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?
Hi Tom,
From where did you downloaded the plink.exe ?
The PuTTY Suite download page.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Ah... thanks man, I really appreciate your help.
Cheers,
Albert