Richard Parmiter

Virtualisation blog and Knowledge Base

  • You are here: 
  • Home
  • script

use xe.exe to start/shutdown vm’s on XenServer

Posted on July 27th, 2010

I wanted to stress test a Citrix XenServer 5.6 computer to see how it copes with a number of simultaneou startup and shutdown requests.

I also wanted to see the IOPS passed to back end storage where the virtual machine hard drives are stored.

Rather than manually selecting the machine in XenCenter and shutting down or starting I wrote a script to perform the same action which made it a little quicker and easier when performing this task many times.

I wanted to perform the actions on a specific list of vm’s listed in a text file

List of VM’s – vm.txt

Name-of-VM1

Name-of-VM2

Name-of-VM3

Remember they are case sensitive and the same name you see in XenCenter. It can also be acheived with UUID’s of the VM’s but this is less friendly, so the names were used.

Startup VM’s

This is a simply dos batch script

set XenServer=[server name or IP]
set XenUser=[username]
set XenUserPwd=[password]

for /F %%1 in (vm.txt) do (
start “start %%1″ “c:\program files (x86)\Citrix\XenCenter\xe.exe” -s %XenServer% -u %XenUser% -pw %XenUserPwd% vm-start name-label=%%1
)

I have used the start command to open a seperate dos box for each VM so they are done in parallel. Without this the command waits for each VM to start before starting the next one. Running them all in parallel is *much* better for a stress test of a boot storm simulation!

Shutdown VM’s

set XenServer=[server name or IP]
set XenUser=[username]
set XenUserPwd=[password]

for /F %%1 in (vm.txt) do (
start “shutdown %%1″ “c:\program files (x86)\Citrix\XenCenter\xe.exe” -s %XenServer% -u %XenUser% -pw %XenUserPwd% vm-shutdown name-label=%%1
)

I will no doubt be working on some updates to these scripts in the near future and will share them soon.

Tags: , , , , , ,
Filed under Citrix XenServer, Scripts/Reg | No Comments »

Profiling Adobe Acrobat Reader 9.2

Posted on October 21st, 2009

In order to profile Adobe Acrobat Reader 9.2 for Citrix streaming I did the following.

Stage 1 – Download source files

Download and install the Adobe Customization wizard 9

Download the distribution version of Acrobat reader 9.2. You need to register on the adobe site to get access to this download.

Extract the msi from the .exe that was downloaded by running the following

AdbeRdr920_en_US.exe” -nos_ne -nos_o”Extracted”

This will place the extracted files in the “Extracted” folder

Stage 2 – Create a customised installation

Open the customization wizard

Open the Reader msi (extracted above)

Select the options desired. I chose the following:

Supress display of EULA

Remove acrobat.com features

disbale all updates

disable help | Digital editions

Disable product improvement programs

Disable help | Purchase acrobat

Save the customisation MST file

Stage 3 – install

Create a .cmd file that contains the install string including the MST file. For example:

msiexec /i “acroread.msi” TRANSFORMS=”adobe_9_2_transform.MST”

Launch this .cmd file from the Citrix Streaming Profiler

Install as normal

Stage 4 – Add a pre-launch script

Even though the option to disable updates was selected during the customisation wizard, it is not disabled when streaming the app. The same applies to the customer improvment program.

The best way to remove these is to run a pre-launch script to set the reg keys to remove these options.

Create a .vbs script with the following contents

Set objWshShell = CreateObject(“WScript.Shell”)
objWshShell.RegWrite “HKLM\Software\Adobe\Adobe ARM\1.0\ARM\iCheck”, 0 ,”REG_DWORD”
objWshShell.RegWrite “HKCU\Software\Adobe\CommonFiles\Usage\Reader 9\OptIn”, 0 ,”REG_DWORD”

Call this script as a pre-launch script within the streaming profiler.

..

Tags: , , , , , , , ,
Filed under Citrix XenApp, Scripts/Reg | 3 Comments »

Script variable trimming

Posted on May 8th, 2009

Suppose you are trying to run some scripts based on a command line variable, but the variable being passed to it is surrounded by quote marks.

i.e. “device_name” when all i want is device_name

There is an easy way to trim this. In the script need to set this passed variable to a seperate variable, and then trim it byt doing the following:

SET tempvariable=%1                 (need to set %%1 if its run as a script file)

echo %1                                      (will show “device_name”)

echo %tempvariable%                 (will show “device_name”)

echo %tempvariable:~1,-1%       (will show device_name)

The trimmed variable can then be used for another task, i.e. to start a service on a remote server

sc \\%tempvariable:~1,-1% start “ServiceName”

Happy trimming!

Tags: , , , , , , , , , , ,
Filed under Scripts/Reg | 1 Comment »

Script to export all the servers in a Citrix Farm

Posted on April 27th, 2009

Sometimes it is useful to have a list of servers in a text file in order to perform some other task. The following script will export all servers from a Citrix Farm and add them to a text file.

This script uses the built in Citrix tool, qfarm, and cleans up the output to provide the required list. It uses a temporary file (qfarmservers.txt) during the process and deletes it at the end.

REM ***************************************************
REM qfarmservers  = output from a qfarm /servers
REM serverlist    = cleaned up list of all servers in farm
REM ***************************************************

SET qfarmservers=c:\windows\temp\qfarmservers.txt
SET serverlist=c:\windows\temp\serverlist.txt

qfarm /servers >>%qfarmServers%
for /f “skip=3 tokens=1″ %%1 in (%qfarmservers%) do (
echo %%1 >> %serverlist%
)
Del %qfarmservers% /q

Just change the log file location(s) as required.

Tags: , , , , , , , , ,
Filed under Scripts/Reg | 1 Comment »

How to export the users of an AD Group.

Posted on January 23rd, 2009

This is the best and fastest way to export all users who are members of a group

dsquery group “CN=Group Name,OU=OU Location,DC=Domain Name,DC=local” | dsget group -members | dsget user -samid -c >>c:\windows\temp\groupmembers.txt

If there are nested groups it might fail with the following error message:

The object class of the target does not match the one specified on the command line.

This error is removed by adding the -c variable as this continues despite the error.

Tags: , , , , , ,
Filed under Scripts/Reg | No Comments »

Ads

Ads