Category Archives: Windows

XenServer: Powershell

If you like Powershell, you will like the XenServer Powershell.

Download XenServer SDK from the Citrix.com download page (You need to logon with you Citrix credentitals)

After you have install Citrix Xenserver Powershell, you can test to see if it have been install by running this comands:

Get-PSSnapin -registered

If it installed, you can add it to you powershell session by typing this command:

Add-PSSnapin Xen*

To connect to the XenServer

Connect-XenServer -Url https://<ServerIP>

To get all vm on the Xenserver:

Get-XenServer:VM

To only show the VM with VDI in the middle of the name

Get-XenServer:VM -name *vdi*

To see all command from XenServer Powershell

Get-Command -module Xen*

 

See more commands here:

http://kennethdalbjerg.dk/wp-content/uploads/2013/05/Citrix_XenServer_6.0_CmdLet_Poster.pdf
http://www.qa.com/about-qa/blogs/2012/july/citrix-xenserver-6-and-powershell/

XenServer: Add an extra Core to a CPU Socket

You can’t add extra Core to a CPU socket though XenCenter, you need to start you console of the XenServer.

To Add 4 Core in each CPU Socket you need to run this commands:

xe vm-param-set platform:cores-per-socket=4 uuid=<VM UUID>

To found the vm’s UUID, you can use these commands:

xe vm-list name-label=<Name of the VM>

After you have put 4 core in each CPU socket you also need to run these commands:

xe vm-param-set VCPUs-max=8 uuid=<VM UUID>
xe vm-param-set VCPUs-at-startup=8 uuid=<VM UUID>

This will add 8 CPU in totalt, but only 2 CPU socket with each 4 Core.

Web interface and the black drop down enable

In default the Bkack Drop Down is not enabled, in webinterface.

To enable it, do this:

  • On the Delivery Services server, navigate to: C:\inetpub\wwwroot\Citrix.
  • Open the folder that represents the desired Store (example: Store1).
  • With Notepad, open webinterface.conf.
  • Search for the showDesktopViewer attribute.
  • Change the attribute value from off to on.

Citrix XenApp failed to connect to Data Store

Today i have this problems on one of the Citrix XenApp servers, that the service IMA won’t connect to the Data store.

It failed with this events:

1. Citrix XenApp failed to connect to the Data Store. ODBC error while connecting to the database: S1000 -> [Microsoft][ODBC Microsoft Access Driver] Cannot open database ‘(unknown)’.  It may not be a database that your application recognizes, or the file may be corrupt.

2. Failed to load plugin C:\Program Files (x86)\Citrix\System32\Citrix\IMA\SubSystems\ImaPsSs.dll with error IMA_RESULT_FAILURE

3. Failed to load plugin C:\Program Files (x86)\Citrix\System32\Citrix\IMA\SubSystems\ImaRuntimeSS.dll with error IMA_RESULT_FAILURE

4. Failed to load initial plugins with error IMA_RESULT_FAILURE

5. The Citrix Independent Management Architecture service terminated with service-specific error 2147483649 (0×80000001).

 

But all my others servers in the farm was working just fine, so it must be a locally problems.
The Local Host Cache database, is used to allow a Citrix server in the Citrix Farm to pursue working if the server loses acces to date store temporay. The Local Host Cache database, is an Microsoft Access database, named lmalhc.mdb, and it store ind the Independent Mangement Architecture folder, located: <ProgramFiles>\Citrix\Independent Management Architecture\

 

So the solution to this problems must be to recreate the LHC database, this can be done with this command

dsmaint recreatelhc

But first check that

The datastore is available and function okay, and that the Citrix IMA Service is down :).

The command performs these actions:

Rename the existing Local Host Cache database, create a new one, and the setting PSRequired in registry to 1. Under HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\IMA\Runtime\

Setting thise key to, force the server to connect to the data store, so that the Local Host Cache database, can be recreated.

Search exchange message tracking log for a particular subject

If you want to search Exchange log for a particular subject, or just a bite of it, you can search witch this commands.

This will also export it to a nice CSV files.

Get-MessageTrackingLog -resultsize unlimited | Where-object {$_.MessageSubject -like "*Kenneth Dalbjerg"} | select-object timestamp,Sender,@{l="Recipients";e={$_.Recipients -join " "}},messageSubject | export-csv c:\KennethDalbjerg.csv

Kill a stuck vm in shuting down mode or pending mode

There are 3 options to do this, witch way depend on the stuck mode, start with options 1 and work you way thougt it onto the vm is shutdown.

Options 1:

SSH to the Xenserver witch running the vm

Type these commands:

xe task-list

Found the task and the UUID for this task, and kill it

xe task-cancel force=true uuid=<UUID>

 Options 2:

SSH to the Xenserver witch running the vm

xe vm-list

Find the vm han get the UUID

list_domains | grep <UUID>

Get the number in front of the UUID

/opt/xensource/debug/destroy_domain -domid <DOMID>

Options 3:

SSH to the Xenserver witch running the vm

xe-toolstack-restart

 

XenCenter – Failed to import

I have a problem with my Xencenter failed to import a OVF VM.
In XenCenter console, it just says: Failed to import.

If i look in the log files is was saying: (In XenCenter Console, push tab Help, and then clock on “View application log files. And then open op XenCenter.log):

System.Exception: Failed to import. —> System.IO.InvalidDataException: Failed to add resource Hard Disk Image. —> System.Exception: Failed to import. —> System.Exception: Failed to import virtual disk file. —> System.Xml.XmlException: Root element is missing.

Error on a Danish windows

System.Exception: Failed to import. —> System.IO.InvalidDataException: Failed to add resource Hard Disk Image. —> System.Exception: Failed to import. —> System.Exception: Failed to import virtual disk file. —> System.Xml.XmlException: Rod element mangler.

To fix this problem I did:
In XenCenter, select View -> Hidden Objects
This will show you hidden objects, such as Transfer objects.
Found the failed imported machine, right click on it and delete it.
Now you should found a XenServer Tranfer VM X.X.X-X, right click on it and delete it.

Now connect to the console on the XenServer host: (Master of the pool if you have such one)
And type this commands:

cd /opt/xensource/packages/files/transfer-vm
./install-transfer-vm.sh

Xenserver – Moving VM “VDINAME” to “VDINAME” on “Storage” This operation cannot be performed because this VDI OpaqueRef:8d37bee1-f85b-fb22-e47e-1b8f48b68b84 is in use by some other operation – copy

I have this error:

Moving VM “VDINAME” to “VDINAME” on “Storage” This operation cannot be performed because this VDI OpaqueRef:8d37bee1-f85b-fb22-e47e-1b8f48b68b84 is in use by some other operation – copy

When i was try moving a VM from from storage to another on XenServer. It was just because there was a DVD ISO mounted on the VM, when i Eject that one, the move was just running fine.