Category: Uncategorised

Export A Running VM From vCloud

Late last year i wrote about identifying chain linked VM’s within the vCloud environment, since then ive had to export a number of virtual machines from vCloud back to native vSphere.

For some of the process we need to use the ManagedBy.PS1 powershell script provided by VMware in this artice (its attached) https://kb.vmware.com/s/article/2032366

The script that i wrote to do this is below

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Export VM script for vCloud (required ManagedBy Script from VMware)

# Variables for the vApp Decommission.
$disablespec = New-Object VMware.Vim.VirtualMachineConfigSpec
$disablespec.vAppConfigRemoved = $True

# Text file with list of VM's we want to export from vCloud
$vms = Get-Content "vms.txt"

Foreach ($vm in $vms) {

$vm = "$vm"

Write-Host "Cleaning UUID UP :" $vm
#Remove vCloud UUID settings in vmx configuration
Get-AdvancedSetting -entity "$vm" -Name cloud.uuid|Remove-AdvancedSetting

Write-Host "Unlinking VM from vCloud Management :" $vm
# Unlink managed by
Invoke-Expression -Command '.\ManagedBy.ps1 -Cmd Clear -VMs $vm'

Write-Host "Removing vApp Flag :" $vm
#Remove vApp Flag
$vm = Get-VM $vm | Get-View
$vm.ReconfigVM($disablespec)

}

This successfully cleans up the VM removing the UUID in advanced settings are un-linking it from vcloud, it also changes the VM from a vApp to a standard VM. What you will be left with is the same VM with a (UUID reference number after it). Should you wish to remove this UUID referance number you can do afterwards with the script below, however check your backup technology before hand as it may see the changes as a new system and remove your historical references.

1
2
3
4
5
6
7
8
9
10
11
# Same text file that was used for the vCloud Export
$vms = Get-Content "vms.txt"

Foreach ($vm in $vms) {

    $vm = "$vm"
    Write-Host "Current VM Name :" $vm
    $newvm = $vm.Substring(0, $vm.IndexOf('('))
    Write-Host "New VM Name :" $newvm
    Set-VM -VM $vm -Name $newvm
}

And that should be it.

PowerCli List HBA WWN’s

Whenever you get storage masked to your esxi node/cluster you always going to need to know what HBA WWN addresses are (assuming your using HBA not iSCSI etc) here is a quick powercli hba statement you can use to refresh your memory

 

For a cluster the following:

1
Get-Cluster clustername | Get-VMhost | Get-VMHostHBA -Type FibreChannel | Select VMHost,Device,@{N="WWN";E={"{0:X}" -f $_.PortWorldWideName}} | Sort VMhost,Device

 

And if you want to do a single host:

1
Get-VMhost -Name hostname| Get-VMHostHBA -Type FibreChannel | Select VMHost,Device,@{N="WWN";E={"{0:X}" -f $_.PortWorldWideName}} | Sort VMhost,Device

 

 

Studing For VCP6-NV (2V0-642) (UPDATE – I Passed ?)

Quick update i took the exam on Friday morning and happy to say passed with a score of 433 (300 is the pass mark).

Personally i think it was a tricky exam but not as difficult as i anticipated it to be, i used the references ive already mentioned before and bolstered it up with 2 pluralsight courses i got access to on a 6 month trial basis.

I’m not going to go into the question i was given but i would say if you follow the links ive provided and the VMware blueprint  you should be ok.

 

 

Im a VMware vExpert 2018

To add to an already amazing year in world of virtualisation, today I was named a VMware vExpert 2018 . I’m honoured, humbled, and proud of my contributions to this amazing virtualisation community. The vExpert list is constantly growing, and it’s amazing to be part of this list of experts.

vExperts demonstrate significant contributions to the community and a willingness to share their expertise with others.