Monday, June 25, 2012

VMware Important Commands

Upgrade VMware Tools, all virtual machines in cluster:

Get-Cluster "Productie" | Get-VM | Update-Tools –NoReboot

Upgrade VMware Tools, located in folder:

Get-Cluster "Productie" | Get-Folder "Beheer servers" | Get-VM | Update-Tools –NoReboot

Upgrade VMware Tools, selected virtual machine:

Get-Cluster "HOCluster" | Get-VM "VDI01" | Update-Tools –NoReboot

Find VMware CPU Information

cat /proc/cpuinfo

Find out memory information

cat /proc/memoinfo

Enter Maintenance Mode:

Vimsh -n –e /hostsvc/maintenance_mode_enter

Exit maintenance Mode:

Vimsh –n –e /hostsvc/maintenance_mode_exit

Check the ESX server whether Maintenance mode or Not:

Vimsh –n –e “hostsvc/hostsummary” | grep inMaintenanceMode

List the location of the virtual machine.

vmware-cmd -l

VMware Host Log Files located in ,

/var/log/messages:
/var/log/vmware/hostd.log
/var/log/sysboot.log

To Restart VMware services

#service mgmt-vmware restart
#service vmware-vpxa restart
#/etc/init.d/network restart

 VMware DNS verification

1.Verify the format and content of /etc/hosts, run the command:
[root@server root]# cat /etc/hosts
 Here is an example of the hosts file:
127.0.0.1         localhost.localdomain localhost
192.168.1.10   server.domain.com server

2. To verify the contents of /etc/sysconfig/network, run the command: [root@server root]# cat /etc/sysconfig/network

Confirm that the proper values for your environment exist for the fully qualified hostname and gateway. Consult your network administrator if you are unsure of the proper values. Here is an example of the network file:

NETWORKING=yes
HOSTNAME=server.domain.com
GATEWAY=192.168.1.1
GATEWAYDEV=vswif0

3. To verify that /etc/sysconfig/network-scripts/ifcfg-vswif0 has the correct settings for IP address (IPADDR), subnet mask (NETMASK), and network (NETWORK), run the command:

[root@server root]# cat /etc/sysconfig/network-scripts/ifcfg-vswif0

Consult your network administrator if you are unsure of the correct settings.
Here is an example of the ifcfg-vswif0 file:

DEVICE=vswif0
BOOTPROTO=static
BROADCAST=192.168.1.255
IPADDR=192.168.1.10
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes
PORTGROUP="Service Console"
MACADDR=00:50:56:4a:66:ba

4. To display the routing table, run the command:
[root@server root]# route –n

The output looks similar to:

Destination   Gateway Genmask         Flags  Metric   Ref   Use  Iface

192.168.1.0   0.0.0.0    255.255.255.0 U         0          0        0    vswif0
169.254.0.0   0.0.0.0   255.255.0.0      U         0          0        0    vswif0
0.0.0.0          192.168.1.1 0.0.0.0        UG       0          0        0    vswif0

Ensure that the second column of the row flagged with UG matches the gateway address for your environment.

5. To verify that the DNS information in /etc/resolv.conf is correct for your environment, run the command:

[root@server root]# cat /etc/resolv.conf

Here is an example of the resolv.conf file:
search domain.com
nameserver 192.168.1.2
nameserver 192.168.1.3