Home » command

Tag: command

Dynamically display the PVS environment detail on users desktop with BGINFO

I want all PVS servers to dynamically display their environment on the desktop when a users logs into the desktop.

This can be achieved by:

1) adding a new ‘personality’ variable to each device in PVS

2) scripting the import of the variables from the c:personality.ini file to the windows registry

3) setting BGINFO to display the registry information at each user logon.

Process:

1) Edit the properties of the Target Device > Personality Tab > and Add your variables

PVS_Personality_variable

2) Script the import with VB and run as a computer startup script in the GPO

Set objShel = CreateObject(“WScript.Shell”)
objShel.Run “C:Progra~1CitrixProvis~1GetPer~1.exe Environment /r=HKEY_LOCAL_MACHINESOFTWAREMYCOMPANYPVSEnv”

3) Download BGINFO from sysinternals and setup the new desktop display

BGINFO_PVS_ENVIROMENTVIEW BGINFO_PVS_ENVIROMENT_registryssetup

bginfp_pvs_examplebginfp_pvs_example_prod

 

Recreate or Publish the Windows Printers Folder (Win7 or 2008)

The following commands will recreate or open a ‘Printers’ folder

rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder

%windir%explorer.exe /e,::{2227A280-3AEA-1069-A2DE-08002B30309D}

control.exe printers

This can be used to publish a printers folder via Citrix XenApp

%windir%explorer.exe /e,::{2227A280-3AEA-1069-A2DE-08002B30309D

Reduce WINSXS folder size

I hate the C:\Windows\WINSXS folder. The size it takes up is a complete joke even BEFORE apps or windows updates.

These are some of the commands that I have found in the past (with varying success) to try and reduce the size of this rediculous folder.

It is rare that I have run this on a production environment, but on mini test VM’s and prelive stuff havent ever had any issues (depends if the commands even exist or are installed)

USE THESE COMMANDS COMPLETELY AT YOUR OWNRISK, IF YOU BREAK THIS FOLDER YOU WILL MORE THAN LIKELY RUIN YOUR SERVER. ALWAYS HAVE A BACKUP!

From and administrator command prompt try the following to try and reduce WINSXS folder size

  1. vsp1cln.exe
  2. compcln.exe
  3. dism.exe /online /cleanup-image /spsuperseded * (most successful)

or you can even try deleting blobs.bin file and reboot the system, c:\Windows\winsxs\ManifestCache\blobs.bin (only if its really big, and it should regenerate)

USE THESE COMMANDS COMPLETELY AT YOUR OWNRISK, IF YOU BREAK THIS FOLDER YOU WILL MORE THAN LIKELY RUIN YOUR SERVER. ALWAYS HAVE A BACKUP!

James

App-V Application refresh failure with same name

Situation: we had recently repackaged a new verson of an applicaiton and though the ucn path had changed, the APP-V name was identical.

Error: The Application Virtualization Client cannot use the OSD file specified because the GUID attribute for the CODEBASE element changed (rc 0C403B04-00001004).

Solution: under sftcmc.msc the properties of the app showed the OSD file pointing to the previous version of the published apps directory

On the server I opened the cmd prompt as ‘run as administrator’ and did the following

list all apps: sftmime query obj:app /short

Remove the application: sftmime.exe remove app:”applicationName” /complete

References:

http://support.microsoft.com/kb/931188

Batch File – Sound Alert on Folder Exist

:TestAgain CLS

IF NOT EXIST c:FOLDERALERT_* GOTO NOALERT

“C:windowssndrec32.exe” /play /Close  “C:WINDOWSMEDIAWindows Ringin.wav”

REm Start /MIN “C:Program FilesWindows Media Playerwmplayer.exe”  “C:WINDOWSMEDIAWindows Ringin.wav” REM “%SystemRoot%system32SoundRecorder.exe” /CLOSE /PLAY “C:WINDOWSMEDIAWindows Ringin.wav”

PING 127.0.0.1 -n 5 -w 2000 >NUL Rem Taskkill /IM “WMplayer.exe” /F

PING 127.0.0.1 -n 5 -w 2000 >NUL GOTO TestAgain

:NOALERT

PING 127.0.0.1 -n 5 -w 4000 >NUL

GOTO TestAgain

How to License a Netscaler Device

The netscalers are license by the FLEXnet host ID of the machine.

To get this information from the device

1) SSH, putty or use the console of the netscaler device and login as the nsroot account
2) run the shell
– command: shell
3) Run the FLEXnet host ID command
– command: lmutil lmhostid -ether

4) Output will be something like

root@ns# lmutil lmhostid -ether
lmutil – Copyright (c) 1989-2007 Macrovision Europe Ltd. and/or Macrovision Corporation. All Rights Reserved.
The FLEXnet host ID of this machine is “xxxxxxxxxxxx”

5) Use this when allocating your licensing file from mycitrix.com

 

XenServer Mount USB from HOST

Situation: USB Drive attached to the XenServer host, need to mount directly into a VM for removable usb drive access.

Solution: Download the usbmount.bat from http://support.citrix.com/article/CTX118198

Edit the file with your xenserver details  and your vm and usb uuid’s.

HOW DO I FIND MY XENSERVER VM UUID?

bring up a console session on the XenServer and run

xe vm-list

HOW DO I FIND MY XENSERVER USB UUID?

the citrix provided command for listing Removable storage didn’t return any results in my setup.

xe sr-list name-label=Removable Storage

So under the XenServer Console > Click the Removable storage node in the console > Right click and copy the UUID Displayed

 

RUNNING THE SCRIPT

Edit the below script with your details

then run

usbmount.bat ATTACH

or

usbmount DETACH

—————————————————————————————–START SCRIPT —————————————————————————————————-

@ECHO OFF
setlocal
REM Attach a USB flash device to a specified VM on XenServer 4.x

REM ————- EDIT THE OPTIONS BELOW TO SUIT YOUR ENVIRONMENT ————-

REM XenServer Credentials
SET XE_USERNAME=root
SET XE_PASSWORD=CHANGEME
SET XE_SERVER=xxx.xxx.xxx.xxx

REM Removable Storage Repository UUID
SET REMOVABLE_SR_UUID=CHANGEME

REM UUID of the VM you wish to attach the USB storage to
SET VM_UUID=CHANGEME

REM Device name/order on the VM (e.g. hdb, hdc, hdd…)
set DEVICE_NAME=hdb

REM —————————————————————————

REM XenCenter Path
SET XE_CENTER_PATH=C:program filescitrixXenCenter

REM XE Binary and Baseline Parameters
SET XE_EXEC=”%XE_CENTER_PATH%xe.exe” -s %XE_SERVER% -u %XE_USERNAME% -pw %XE_PASSWORD%

REM Temporary working file
SET TEMP_FILE=%TEMP%/xs-usbmount.tmp

REM ———— DO NOT EDIT BEYOND THIS LINE —————-

IF “%1″==”ATTACH” GOTO ATTACH_STORAGE
IF “%1″==”DETACH” GOTO DETACH_STORAGE

REM No parameters
echo Usage USBMOUNT.BAT ^<ATTACH ^| DETACH^>
GOTO END

:DETACH_STORAGE
%XE_EXEC% vdi-list sr-uuid=%REMOVABLE_SR_UUID% params=vbd-uuids –minimal > %TEMP_FILE%
SET /P VBD_UUIDS= < %TEMP_FILE%

IF “%VBD_UUIDS%”==”” GOTO NOT_BOUND
%XE_EXEC% vbd-unplug uuid=%VBD_UUIDS%
%XE_EXEC% vbd-destroy uuid=%VBD_UUIDS%
echo.Storage Detached

GOTO END

:ATTACH_STORAGE

REM See if the storage is already bound to a VBD
%XE_EXEC% vdi-list sr-uuid=%REMOVABLE_SR_UUID% params=vbd-uuids –minimal > %TEMP_FILE%
SET /P VBD_UUIDS= < %TEMP_FILE%

IF NOT “%VBD_UUIDS%”==”” GOTO ALREADY_BOUND

%XE_EXEC% vdi-list sr-uuid=%REMOVABLE_SR_UUID% params=uuid –minimal > %TEMP_FILE%
SET /P VDI_UUID= < %TEMP_FILE%

%XE_EXEC% vbd-create vm-uuid=%VM_UUID% device=%DEVICE_NAME% vdi-uuid=%VDI_UUID% –minimal > %TEMP_FILE%
SET /P VBD_UUID= < %TEMP_FILE%

%XE_EXEC% vbd-plug uuid=%VBD_UUID%

echo.VBD UUID attached as: %VBD_UUID%
GOTO END

:ALREADY_BOUND
echo.Removable storage already attached to a VM – aborting.
GOTO END

:NOT_BOUND
echo.Storage device not bound to any VMs – aborting.
GOTO END

:END
endlocal

Change Windows Settings for D.E.P 2008

bcdedit.exe /set nx OptIn = “Turn on DEP for essential Windows programs and services only”
bcdedit.exe /set ns OptOut = “Turn on DEP for all programs and services except those I select”
bcdedit.exe /enum = Query Settings
bcdedit.exe /set nx AlwaysOff = “Disable DEP entirely”

To disable DEP just to internet Explorer 8 – see this article
http://blogs.msdn.com/b/askie/archive/2009/07/02/how-to-disable-dep-ns-memory-protection-in-ie-8-via-policy.aspx

References:
http://msdn.microsoft.com/en-us/library/windows/hardware/ff542202(v=vs.85).aspx