Tag: VMware

Enabling vCenter Server Appliance (VCSA) to use SMB2

VMware’s KB (https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2134063) about joining the appliance to the domain only shows the option of enabling SMB1 on your domain controller.  With VMware Support, we were able to figure how to enable SMB2 communication from the vCSA to the domain controllers.

  1. SSH into the vCSA
  2. enable the bash shell
    1. shell.set --enabled true
  3. enter the bash shell
    1. shell
  4. Set the SMB2Enabled Flag in likewise’s config:
    1. /opt/likewise/bin/lwregshell set_value '[HKEY_THIS_MACHINE\Services\lwio\Parameters\Drivers\rdr]' Smb2Enabled 1
  5. You can verify the values with the following command:
    1. /opt/likewise/bin/lwregshell list_values '[HKEY_THIS_MACHINE\Services\lwio\Parameters\Drivers\rdr]'
  6. Then restart likewise:
    1. /opt/likewise/bin/lwsm restart lwio

Now the vCSA will use SMB2! This can be required if you have security policy requiring the disablement of SMB1.

Removing old snapshots in PowerCLI

Removing old snapshots in PowerCLI

Manually cleaning up Virtual Machine Snapshots can be a tedious process from the GUI.  Luckily for us, removing them with PowerCLI is very easy.

First, let’s get comfortable with at least looking at what snapshots exist on a VM:

Get-VM TestVM | Get-Snapshot

This gives us the following information (which isn’t exactly useful to us):

//todo add snapshot listing//

How about piping the output and selecting some more useful (to me) information:

Get-VM TestVM | Get-Snapshot | Select VM, Name, Created, SizeGB

//todo add formatted listing//

Let’s move onto removing all snapshots from a specific Virtual Machine:

Get-VM TestVM | Get-Snapshot | Remove-Snapshot

This will prompt you to confirm snapshot removal for each snapshot on the VM.

We can suppress the confirmation by toggling the confirm Boolean to false:

Get-VM TestVM | Get-Snapshot | Remove-Snapshot -confirm:$false

The above command will delete each snapshot one by one.  If we’re planning to delete all the snapshots, why not just select the last snapshot and delete all the children (note:  if you have multiple snapshot chains on the VM this won’t have the intended effect), similar to a Delete All:

Get-VM TestVM | Get-Snapshot | Select-Object -Last 1 | Remove-Snapshot -Confirm:$false -RemoveChildren

That covers the basics for removing a snapshot from a single VM, but often we’ll need to delete snapshots from a collection of VMs.

To remove all snapshots on all VMs from a specific VM Folder:

Get-Folder ExampleFolder | Get-VM | Get-Snapshot | Remove-Snapshot -confirm:$false -RemoveChildren

To remove all snapshots from all VMs older than Feb 1, 2017:

Get-VM | Get-Snapshot | Where-Object {$_.Created -lt (Get-Date 1/Feb/2017)} | Remove-Snapshot -Confirm:$false