Powercli to list & delete snapshots

We have realized we are having broken NetApp VMs backup. The process left a lot of VM snapshots. To start off let’s find out those snaps with: get-vm | get-snapshot | where {$\_.Description -match "SMVI Snapshot generated for backup"} | Format-Table -Property VM,Name,Created,Description, SizeMB This command prints the flowing table: VM Name Created Description SizeMB -- ---- ------- ----------- ------ vyuka.fs smvi\_a3d... 23.11.2012 17:56:25 SMVI Snapshot... 6768,13 ojs smvi\_a3d... 23.11.2012 18:01:25 SMVI Snapshot. [Read More]

PowerCLI to start and stop Remote Tech Support (SSH)

Another PowerCLI one-liner to start Remote Tech Support (SSH) on ESX/ESXi:

Get-Cluster -Name "CIT2 CLuster" | Get-VMHost | Get-VMHostService | ? {$\_.Key -eq "TSM-ssh"} | Start-VMHostService

One-liner to stop:

Get-Cluster -Name "CIT2 CLuster" | Get-VMHost | Get-VMHostService | ? {$\_.Key -eq "TSM-ssh"} | Stop-VMHostService -Confirm:$false

Get VM ethernet info and state

PowerCLI > Get-VM -Name builder2 | Get-NetworkAdapter| Format-List -Property \*

MacAddress       : 00:50:56:90:34:9d
WakeOnLanEnabled : True
NetworkName      : Network 158.196.149.0
Type             : e1000
ParentId         : VirtualMachine-vm-4650
Parent           : builder2
Uid              : /VIServer=administrator@vcs1.vsb.cz:443/VirtualMachine=Virtu
                   alMachine-vm-4650/NetworkAdapter=4000/
ConnectionState  : Connected, GuestControl, StartConnected
ExtensionData    : VMware.Vim.VirtualE1000
Id               : VirtualMachine-vm-4650/4000
Name             : Network adapter 1
vmware 

Get VMs with disconnected virtual ethernet

PowerCLI > Get-NetworkAdapter (get-vm | where {$\_.powerstate -eq poweredon}) |
Where { $\_.connectionstate.connected -eq $null } | select parent, connectionstate

Parent                                  ConnectionState
------                                  ---------------
licenser                                NotConnected, GuestControl, NoStartC...
vmware 

PowerCLI to add vlan to vmware cluster

One-liner to add VLANs to the all hosts within vSphere cluster:

Get-Cluster "CIT Cluster" | Get-VMHost | Get-VirtualSwitch -name vSwitch0 | New-VirtualPortGroup -name "Networking - Vlan80" -VLanId 80

Create ESXi 4.0 USB stick with dd on Linux

These are the steps to create ESX 4.0 USB stick:

mount -o loop VMware-VMvisor-Installer-4.0.0.update04-504850.x86\64.iso /mnt/
cp /mnt/image.tgz .
tar xvzf image.tgz
bunzip2 usr/lib/vmware/installer/VMware-VMvisor-big-4.0.0-504850-x86_64.dd.bz2
dd if=usr/lib/vmware/installer/VMware-VMvisor-big-4.0.0-504850-x86_64.dd of=/dev/sdb
rm -r usr
umount /mnt
vmware 

Create ESXi 4.1 USB stick with dd on Linux

These are the steps to create ESX 4.1 USB stick:

mount -o loop VMware-VMvisor-Installer-4.1.0.update02-502767.x86\_64.iso /mnt/
cp /mnt/imagedd.bz2 .
bunzip2 imagedd.bz2
dd if=imagedd of=/dev/sdb
rm imagedd
umount /mnt

Comments:

saurin - Sep 3, 2012

Is this procedure creates the ESXi 4.1 installation USB?

David Hrbáč - Dec 6, 2012

Not sure. As to 5.0, there’s no need to create boot-able USB stick this way. Vmware installer works smoothly…

vmware 

How to remove sw raid for VMware Converter to work

VMWare converter is very powerful tool to provide physical to virtual conversion. It’s quite easy to make P2V of Windows base servers. The last versions of VMware Converter claim to support P2V of Linux based servers. This is true, but there are limits. Linux server running sw raid (mdadm) is one of them. Here is breif HOWTO: stop all important services disable these services break the mirror strip mdadm info from the disk change the partition type from fd (Linux raid auto) to 83 (Linux) chroot into single disk instance rename mdadm. [Read More]
vmware