ESXi: Leave Windows Domain: The operation is not allow in the current state


Today I was struggling with an ESX host. The ESX host was unable to leave the Windows domain. I got the following error:

image

From the vSphere client I was unable to fix this issue. Apply Host profile failed also with the same error. So I started a search in the VMware KB and found an article about problems while attempting to join a Windows domain. In this article you’ll find a way to clean up the AD configuration from the CLI.

The solution for me was to stop the lsassd service:

/etc/init.d/lsassd stop

Remove the db directory:

/etc/likewise/db directory

and start the lasassd service again:

/etc/init.d/lsassd start

Now I was able to leave the Windows domain.

Advertisements

PowerCLI: Find and Set the Service Console Memory value


image

Last year I wrote a blog post about changing the COS memory. You can find the post here: https://ict-freak.nl/2008/11/26/vmware-service-console-memory/ (it’s written in Dutch). In that post there is already a one-liner made by LucD butt in this post you’ll get an extra one-liner to determine the COS memory value.

If you want to see how much memory is allocated for the Service Console run the next script:

Get-VMHost | Sort Name | Get-View | Select Name, `
@{N="Service Console Memory";E= {"" + `
[math]::round($_.Config.ConsoleReservation.ServiceConsoleReserved / 1MB, 0) + " MB "}}

 

Just add | Export-Csv -NoTypeInformation "D:\cosmem.csv" to export the data to a CSV file.

The output will look like this:

image

The script/one-liner:

Get-VMHost | Get-View | % { 
$_.Name | Where { $_.Config.ConsoleReservation.ServiceConsoleReserved -eq "314572800" }
(Get-View -Id $_.ConfigManager.MemoryManager).ReconfigureServiceConsoleReservation(800*1mb) }
 

You can monitor the changes in vCenter:

image 

More information about the maximum values can be found here:  vsp_40_config_max.pdf.

The maximum value for the COS Memory is 800MB so that’s what the script will use to set the COS memory.

Note: You have to restart the server to apply the changes.

PowerCLI: Set VM Startup Policy


image

Update: I added a little script block which enables the Startup Policy on the ESX Host.

If you want to change the VM Startup Order under Configuration – Virtual Machine Startup/Shutdown by hand will costs you a lot of time. So I wanted to see if I was able to script these settings with PowerCLI.

You can check the Startup Order via:  Get-VMHost |Get-VMStartPolicy |Sort StartOrder

And this is how you can see if the Startup Policy is enabled: Get-VMHostStartPolicy              -VMHost ( Get-VMHost )

image

First, I created a CSV file:

VMName,StartupOrder

DC01,1

MC01,2

VC01,3

MAIL01,4

XPMC01,5


In this CSV file, I have entered my VM’s and the startup order value. I have tested it with multiple servers and it’s possible to enter two VM’s with the same StartupOrder value if the VM’s are placed on different ESX Hosts.

The following script imports the CSV file and loops through all the items and configures the VM Startup Policy:

$vCenter = Read-Host "Enter the vCenter server name"

Connect-VIServer $vCenter

$hosts = Get-VMHostStartPolicy -VMHost (Get-VMHost)
$vms = "c:\scripts\ps\vmsStartup.csv"
$csv = Import-CSV $vms

foreach($item in $csv){
    $vm = $item.VMName
    $order = $item.StartupOrder

    $vmStartup = Get-VMStartPolicy -VM $vm
    Set-VMStartPolicy -StartPolicy $vmStartup `
        -StartAction PowerOn -StartOrder $order 

}

foreach($esx in $hosts){
    Set-VMHostStartPolicy -VMHostStartPolicy $esx -Enabled:$true
    }

Disconnect-VIServer -Confirm:$false

 

I created a short movie about the script in action:

VMware: Troubleshooting ESX Server


image

While reading my rss feeds in Feedreader, I saw this article:  http://www.virtualinsanity.com/index.php/2009/04/21/troubleshooting-esx/

I was at the Louisville VMUG on Friday talking about Troubleshooting ESX.  In my preparation for the event, I was looking for a good PowerPoint presentation I could reuse and I stumbled across a sweet little gem of a document.  Dudley Smith, a VMware Technical Account Manager (TAM) out of Virginia, created a cool one page Mind Map for Troubleshooting ESX.  Does it address every potential issue you’ll come across?  No, of course not.  But it’s a heck of a good place to start.  One look at his Mind Map and I thought to myself, “that would be a great thing to have printed out and hanging over every VMware admin’s desk.
image
image

You can download the pdf’s here:

http://www.virtualinsanity.com/index.php/2009/04/21/troubleshooting-esx/

VMware ESX/ESXi: no sound through RDP


image

Martin over at http://www.emware.nl/ has posted an article about getting sound through a RDP connection:

Working on vmware is great, but it gets even better when you have some sounds.
A straight out the box install gives you a error on the sound card.

  • The audio Service is not running
  • No audio Devices are installed

It took me some to figure out this problem, but at the end … it was really simple.

Let’s make it work !

Read the rest of the article here: http://www.emware.nl/articles/no-sound-in-esx-esxi-through-rdp.html

VMware: Hot Add VMDK


 

In ESX 3.5 is het mogelijk een een VMDK live aan een VM te koppelen. Je hoeft dus niet eerst de VM down te gooien. Start de Add Hardware Wizard en voeg een nieuwe VMDK toe.

 image

Nadat de VMDK is aangekoppeld open je binnen de VM de Computer Management mmc. Ga naar Storage – Disk Management. Voer een Rescan Disks uit.

image

De nieuwe VMDK wordt gevonden en kan worden gepartitioneerd.

image

Via deze manier kun je heel snel, extra storage toevoegen aan een VM.