Monday, March 21, 2011

Reinstall HA to a ESX 3.5 host

1. Disable HA in your Cluster
2. Ensure the Startup/Shutdown is set to Disabled. To check this, go to the Configuration tab of your ESX host and check the Virtual Machine Startup/Shutdown settings. Ensure its set to Disabled.
3. Disconnect the ESX host in VirtualCenter. Right-click the host and click Disconnect At the service console, issue the commands:
      service mgmt-vmware stop
      service vmware-vpxa stop
      service vmware-vmkauthd stop
      service xinetd restart
     
4. Query the vpxa package
      rpm -qa | grep vpxa

5. At the service console, run the "rpm -e" command on the rpm file that displayed in the previous command.

      rpm -e <rpm_name>

6. This uninstalls the agent from the ESX host. Reconnecting the host to VirtualCenter re-installs the agent.

7. Remove the AAM Agents:
      rpm -qa | grep -i aam | awk '{print $1}' | xargs rpm -ef $1

8. Restart the services:
      service mgmt-vmware start && service vmware-vmkauthd start

9. Execute the vmware-cmd -l command to let you know when hostd is up and running so you can reattach it to VirtualCenter.

10. Log in to the VirtualCenter Server using VMware Infrastructure (VI) Client.
   Select the ESX host it in the inventory list.

11. Right-click on the ESX host and click Connect. This step initiates a re-install of the agent.

12. Reconnect the ESX host in VirtualCenter. Right-click the host and click Connect

13. Re-enable HA

Friday, March 18, 2011

Find Old Snapshot in Vcenter

param ( $Age = 30 )
$vm = Get-VM
$snapshots = Get-Snapshot -VM $vm
Write-Host -ForegroundColor Red "Old snapshots found:"
foreach ( $snap in $snapshots ) {
 if ( $snap.Created -lt (Get-Date).AddDays( -$Age ) ) {
  Write-Host "Name: " $snap.Name "  Size: " $snap.SizeMB "  Created: " $snap.Created
 }
}

Thursday, March 10, 2011

Server Virtulization

Check for Virtual Technology Enabled

root]# esxcfg-info|grep "HV Support"
         |----HV Support............................................3

0 - VT/AMD-V indicates that support is not available for this hardware.
1 - VT/AMD-V indicates that VT or AMD-V might be available but it is not supported for this hardware.
2 - VT/AMD-V indicates that VT or AMD-V is available but is currently not enabled in the BIOS.
3 - VT/AMD-V indicates that VT or AMD-V is enabled in the BIOS and can be used.

Script to add a New NFS Datastore to all hosts in cluster

New-datastore –nfs –vmhost (get-cluster “$clustername” | get-vmhost ) –name $datastorename –path $/path/nfs –nfshost $nfsserverip

Script to Add a New Portgroup to a Cluster or a Host

Get-Cluster -Name $clustername | Get-VMhost | Get-VirtualSwitch -Name $Vswitchname|New-virtualportgroup $portgroupname -Vlanid $vlanIDname