Friday, April 18, 2014

EdgeSight Load Testing with a Single User account (XenApp 6.5)

I've been doing some EdgeSight Load Testing with XenApp 6.5; which I haven't done in a few months.  We have updated our Citrix servers since then with the newer HotFix RollUp (HFRU) pack and now I'm testing a new application.  Our typical setup is to use a single generic account and connect it via multiple sessions to the same Citrix server and capture some metrics (CPU, Network, Memory, etc).  In the past, this seemed to work pretty flawlessly but in the last week I was having issues.  By the time the 3rd session was connecting to the Citrix server, instead of creating a new session it would 'steal' the 1st session.  This prevented me from having more than 2 sessions connected to a server.

Well, it turns out Citrix modified their behaviour a bit but allowed a registry key to be set to change it back.  The new value was introduced in HFRU 2 and is as follows:

http://support.citrix.com/article/CTX136248

On Windows Server 2003, you can specify whether a user can reconnect to a session from any client device or only from the originating client. The From originating client only option is not present anymore in the Remote Desktop Services settings of the Windows Server 2008 R2 edition.
This feature enhancement allows you to implement the same functionality on Windows Server 2008 R2 through XenApp. To enable the feature, you must set the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Policies\Citrix
Name: ReconnectSame
Type: REG_DWORD
Data: 1
Note that if Workspace Control is enabled on the Web Interface, enabling the "Automatically reconnect to sessions when users log on" feature can result in side effects and users might have to launch the session twice to open a session from the non-originating client device.

Enabling that registry key and I can immediately restart my load testing without any stolen sessions.

Thursday, April 10, 2014

Move ALL Windows 7/2008/2012 log files to another drive


# ===========================================================================================================
#
# Created by: Trentent Tye
#        Intel Server Team
#        IBM Canada Ltd.
#
# Creation Date: Apr 10, 2014
#
# File Name: Move-Log-Files.ps1
#
# Description: This script will be used to move all the log files from the default SYSTEMDRIVE to
#                   a drive of your choosing (in this case, D:\EventLogs).  We use this for non-persistent
#                   vDisks with a persistent write cache to keep these logs for troubleshooting purposes.
#
# ===========================================================================================================


# Change D:\EventLogs to some other destination if required.
$allLogs = Get-WinEvent -ListLog *
foreach ($logs in $allLogs) {
$filename = split-path $logs.LogFilePath -leaf
$logs.LogFilePath = “D:\EventLogs\$filename”
$logs.SaveChanges()
}

Friday, February 28, 2014

Install VMWare drivers offline into a Citrix PVS vDisk

I am attempting to disable interrupt coalescing for some testing that we are doing with a latency sensitive application and I have 2 VMWare virtual machines configured as such that work as expected.

The latency settings I have done are here:
http://www.vmware.com/files/pdf/techpaper/VMW-Tuning-Latency-Sensitive-Workloads.pdf

Essentially, we turned off interrupt coalescing on the physical NIC by doing the following:
Logging into the ESXi host with SSH
# esxcli network nic list 
(e1000e found as our NIC driver)

# esxcli system module parameters list -m e1000e
(we see InterruptThrottleRate as a parameter)
# esxcli system module parameters set -m e1000e -p "InterruptThrottleRate=0" 

Then we modified the VMWare virtual machines with these commands:
To do so through the vSphere Client, go to VM Settings  Options tab  Advanced General  Configuration
Parameters and add an entry for ethernetX.coalescingScheme with the value of "disabled"

We have 2 NIC's assigned to each of our PVS VM's.  One NIC is dedicated for the provisioning traffic and one for access to the rest of the network.  So I had to add 2 lines to my configuration:
ethernet0.coalescingScheme = disabled
ethernet1.coalescingScheme = disabled

For the VMWare virtual machines we just had the one line:
ethernet0.coalescingScheme = disabled


Upon powering up the VMWare virtual machines, the per packet latency dropped signficantly and our application was much more responsive.

Unfortunately, even with the settings being identical on the VMWare virtual machines and the Citrix PVS image, the PVS image will not disable interrupt coalescing, consistently showing our packets as have higher latency.  We built the vDisk image a couple years ago (~2011) and the vDisk now has outdated drivers that I suspect may be the issue.  The VMWare machines have a VMNET3 driver from August of 2013 and our PVS vDisk has a VMNET3 driver from March 2011.

To test if a newer driver would help, I did not want to reverse image the vDisk image as that is such a pain in the ass.  So I tried something else.  I made a new maintenance version of the vDisk and then mounted it on the PVS server:
C:\Users\svc_ctxinstall>"C:\Program Files\Citrix\Provisioning Services\CVhdMount.exe" -p 1 X:\vDisks-XenApp\XenApp65Tn01.14.avhd

This mounted the vDisk as drive "D:\"

I then took the newer driver from the VMWare virtual machine and injected it into the vDisk:

C:\Users\svc_ctxinstall>dism /image:D:\ /add-driver /driver:"C:\Program Files\VMware\VMware Tools\Drivers\vmxnet3"

I could see my newer driver installed alongside the existing driver:
Published Name : oem57.inf
Original File Name : vmxnet3ndis6.inf
Inbox : No
Class Name : Net
Provider Name : VMware, Inc.
Date : 08/28/2012
Version : 1.3.11.0

Published Name : oem6.inf
Original File Name : vmmouse.inf
Inbox : No
Class Name : Mouse
Provider Name : VMware, Inc.
Date : 11/17/2009
Version : 12.4.0.6

Published Name : oem7.inf
Original File Name : vmaudio.inf
Inbox : No
Class Name : MEDIA
Provider Name : VMware
Date : 04/21/2009
Version : 5.10.0.3506

Published Name : oem9.inf
Original File Name : vmxnet3ndis6.inf
Inbox : No
Class Name : Net
Provider Name : VMware, Inc.
Date : 11/22/2011
Version : 1.2.24.0

Then unmount the vDisk:
C:\Users\svc_ctxinstall>"C:\Program Files\Citrix\Provisioning Services\CVhdMount.exe" -u 1

I then set the vDisk to maintenance mode, set my PVS target device as maintenance and booted it up.  When I checked device manager I saw that the driver version was still 1.2.24.0


But clicking "Update Driver..." updated our production NIC to the newer version.  I chose "Search automatically and it found the newer, injected driver.  I then rebooted the VM and success!


Tuesday, February 25, 2014

Time how long a WMI filter call takes

The following command will time how long a WMI filter call will take to execute on your server/PC.

$query = "Select * from Win32_Processor where AddressWidth = '32'"
Measure-Command { Get-WmiObject -Query $query }


Thursday, January 30, 2014

Install AppV 5.0 Server via silent install

I made a script to automate the creation of our AppV 5.0 Management and Publishing servers.  We are going to install them on the same system.  To do this, we already have a database so we are just adding new servers to the infrastructure.  This script also installs all prerequisites if required.


::================================================================================
::
:: Created by: Trentent Tye
:: Intel Server Team
::
:: Creation Date: Jan 30, 2014
::
:: File Name: RunME_Server.cmd
::
:: Description: This script will configure a AppV 5 server for management
::                      and Streaming Capabilities
::
::================================================================================


@ECHO OFF
pushd %~dp0

CLS


:: ===========================================================================================================
:: Checks for Prerequisites
:: ===========================================================================================================
ECHO Checking for Prerequisites...

:: ===========================================================================================================
:: .NetFramework 4.0
:: ===========================================================================================================
SET DOTNET=1
IF EXIST "C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe" SET DOTNET=0

:: ===========================================================================================================
:: Microsoft Visual C++ 2010 x86
:: ===========================================================================================================
SET MSVC2010x86=1
reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\D04BB691875110D32B98EBCF771AA1E1
IF '%ERRORLEVEL%' EQU '0' SET MSVC2010x86=0

:: ===========================================================================================================
:: Microsoft Visual C++ 2010 x64
:: ===========================================================================================================
SET MSVC2010x64=1
reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\1926E8D15D0BCE53481466615F760A7F
IF '%ERRORLEVEL%' EQU '0' SET MSVC2010x64=0

:: ===========================================================================================================
:: Web Server + required features
:: ===========================================================================================================
        >FeatureCheck.ps1 ECHO.
        >>FeatureCheck.ps1 ECHO Import-Module servermanager
        >>FeatureCheck.ps1 ECHO get-windowsfeature web-* ^| where-object {$_.Installed -eq $True} ^| out-file $env:temp\windowFeature.txt
        "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" Set-ExecutionPolicy Unrestricted
        "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" .\FeatureCheck.ps1
        "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" Set-ExecutionPolicy Restricted
        DEL /F /Q FeatureCheck.ps1 >NUL

:: Find Web-Server
SET Web-Server=1
type %TEMP%\windowFeature.txt | findstr /I /C:"Web-Server"
IF '%ERRORLEVEL%' EQU '0' SET Web-Server=0

:: Find Web-Static-Content
SET Web-Static-Content=1
type %TEMP%\windowFeature.txt | findstr /I /C:"Web-Static-Content"
IF '%ERRORLEVEL%' EQU '0' SET Web-Static-Content=0

:: Find Web-Default-Doc
SET Web-Default-Doc=1
type %TEMP%\windowFeature.txt | findstr /I /C:"Web-Default-Doc"
IF '%ERRORLEVEL%' EQU '0' SET Web-Default-Doc=0

:: Find Web-Asp-Net
SET Web-Asp-Net=1
type %TEMP%\windowFeature.txt | findstr /I /C:"Web-Asp-Net"
IF '%ERRORLEVEL%' EQU '0' SET Web-Asp-Net=0

:: Find Web-Net-Ext
SET Web-Net-Ext=1
type %TEMP%\windowFeature.txt | findstr /I /C:"Web-Net-Ext"
IF '%ERRORLEVEL%' EQU '0' SET Web-Net-Ext=0

:: Find Web-ISAPI-Ext
SET Web-ISAPI-Ext=1
type %TEMP%\windowFeature.txt | findstr /I /C:"Web-ISAPI-Ext"
IF '%ERRORLEVEL%' EQU '0' SET Web-ISAPI-Ext=0

:: Find Web-ISAPI-Filter
SET Web-ISAPI-Filter=1
type %TEMP%\windowFeature.txt | findstr /I /C:"Web-ISAPI-Filter"
IF '%ERRORLEVEL%' EQU '0' SET Web-ISAPI-Filter=0

:: Find Web-Windows-Auth
SET Web-Windows-Auth=1
type %TEMP%\windowFeature.txt | findstr /I /C:"Web-Windows-Auth"
IF '%ERRORLEVEL%' EQU '0' SET Web-Windows-Auth=0

:: Find Web-Filtering
SET Web-Filtering=1
type %TEMP%\windowFeature.txt | findstr /I /C:"Web-Filtering"
IF '%ERRORLEVEL%' EQU '0' SET Web-Filtering=0

:: Find Web-Filtering
SET Web-Mgmt-Console=1
type %TEMP%\windowFeature.txt | findstr /I /C:"Web-Mgmt-Console"
IF '%ERRORLEVEL%' EQU '0' SET Web-Mgmt-Console=0


:: ===========================================================================================================
:: Windows Management Framework 3.0 (PowerShell 3.0)
:: ===========================================================================================================
        >WMF3.ps1 ECHO.
        >>WMF3.ps1 ECHO $osresult = $null 
        >>WMF3.ps1 ECHO $os = (Get-WmiObject Win32_OperatingSystem).Name 
        >>WMF3.ps1 ECHO if ($os -like "*Windows 8*") {$osresult = "True"} 
        >>WMF3.ps1 ECHO if ($os -like "*Server 2012*") {$osresult = "True"} 
        >>WMF3.ps1 ECHO $hfchk = Get-WmiObject -Query "select HotFixID from Win32_QuickFixEngineering where HotFixID like 'KB2506143'"
        >>WMF3.ps1 ECHO $hfchk.HotFixID ^|out-file $env:temp\WMF3.txt
        "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" Set-ExecutionPolicy Unrestricted
        "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" .\WMF3.ps1
        "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" Set-ExecutionPolicy Restricted
        DEL /F /Q WMF3.ps1 >NUL

SET WMF3=1
type %TEMP%\WMF3.txt | findstr /I /C:"KB2506143"
IF '%ERRORLEVEL%' EQU '0' SET WMF3=0


:: ===========================================================================================================
:: Install all prerequisites...
:: ===========================================================================================================

ECHO Results...
ECHO DOTNET=%DOTNET%
ECHO MSVC2010x86=%MSVC2010x86%
ECHO MSVC2010x64=%MSVC2010x64%
ECHO Web-Server=%Web-Server%
ECHO Web-Static-Content=%Web-Static-Content%
ECHO Web-Default-Doc=%Web-Default-Doc%
ECHO Web-Asp-Net=%Web-Asp-Net%
ECHO Web-Net-Ext=%Web-Net-Ext%
ECHO Web-ISAPI-Ext=%Web-ISAPI-Ext%
ECHO Web-ISAPI-Filter=%Web-ISAPI-Filter%
ECHO Web-Windows-Auth=%Web-Windows-Auth%
ECHO Web-Filtering=%Web-Filtering%
ECHO Web-Mgmt-Console=%Web-Mgmt-Console%
ECHO WMF3=%WMF3%

ping 127.0.0.1 -n 5 >NUL

IF /I '%DOTNET%' EQU '1' (
ECHO Installing .NetFramework 4.0...
"PreRequisites\dotNetFx40_Full_x86_x64.exe" /Q /norestart
)

IF /I '%MSVC2010x86%' EQU '1' (
ECHO Installing Microsoft Visual C++ 2010 SP1 Redistributable Package (x86)
"PreRequisites\vcredist_x86.exe"  /passive /norestart
)

IF /I '%MSVC2010x64%' EQU '1' (
ECHO Installing Microsoft Visual C++ 2010 SP1 Redistributable Package (x64)
"PreRequisites\vcredist_x64.exe"  /passive /norestart
)

:: ===========================================================================================================
:: Web Server + required features
:: ===========================================================================================================
        >InstallIIS.ps1 ECHO.
        >>InstallIIS.ps1 ECHO Import-Module servermanager

IF /I '%Web-Server%' EQU '1' (
        >>InstallIIS.ps1 ECHO Add-WindowsFeature Web-Server
)
IF /I '%Web-Static-Content%' EQU '1' (
        >>InstallIIS.ps1 ECHO Add-WindowsFeature Web-Static-Content
)
IF /I '%Web-Default-Doc%' EQU '1' (
        >>InstallIIS.ps1 ECHO Add-WindowsFeature Web-Default-Doc
)
IF /I '%Web-Asp-Net%' EQU '1' (
        >>InstallIIS.ps1 ECHO Add-WindowsFeature Web-Asp-Net
)
IF /I '%Web-Net-Ext%' EQU '1' (
        >>InstallIIS.ps1 ECHO Add-WindowsFeature Web-Net-Ext
)
IF /I '%Web-ISAPI-Ext%' EQU '1' (
        >>InstallIIS.ps1 ECHO Add-WindowsFeature Web-ISAPI-Ext
)
IF /I '%Web-ISAPI-Filter%' EQU '1' (
        >>InstallIIS.ps1 ECHO Add-WindowsFeature Web-ISAPI-Filter
)
IF /I '%Web-Windows-Auth%' EQU '1' (
        >>InstallIIS.ps1 ECHO Add-WindowsFeature Web-Windows-Auth
)
IF /I '%Web-Filtering%' EQU '1' (
        >>InstallIIS.ps1 ECHO Add-WindowsFeature Web-Filtering
)
IF /I '%Web-Mgmt-Console%' EQU '1' (
        >>InstallIIS.ps1 ECHO Add-WindowsFeature Web-Mgmt-Console
)

ECHO Installing Web Server and required features...
        "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" Set-ExecutionPolicy Unrestricted
        "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" .\InstallIIS.ps1
        "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" Set-ExecutionPolicy Restricted
        DEL /F /Q InstallIIS.ps1 >NUL

ECHO Installing Windows Management Framework 3.0...
IF /I '%WMF3%' EQU '1' (
c:\windows\system32\wusa.exe "PreRequisites\Windows6.1-KB2506143-x64.msu" /quiet /norestart
)

ECHO Installing Silverlight x64...
"PreRequisites\Silverlight_x64.exe" /q /doNotRequireDRMPrompt /ignorewarnings

ECHO Prepping AppV Server install post-reboot...
ECHO.
ECHO You may have to login to this server with a local admin account
ECHO to execute the install...

cd /d "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"
        >startup.cmd ECHO @ECHO OFF
        >>startup.cmd ECHO c:\windows\microsoft.net\framework\v4.0.30319\aspnet_regiis.exe -ir
        >>startup.cmd ECHO c:\windows\microsoft.net\framework64\v4.0.30319\aspnet_regiis.exe -ir
        >>startup.cmd ECHO net use Z: "\\FILESERVER\ctx_images_bdc\_ISO\AppV\App-V for RDS v5.0 SP1\APP-V 5.0 SERVER SP1"
        >>startup.cmd ECHO Z:
        >>startup.cmd ECHO ECHO Installing Management Server...
        >>startup.cmd ECHO APPV_SERVER_SETUP.EXE /QUIET  /AcceptEULA /MANAGEMENT_SERVER /MANAGEMENT_ADMINACCOUNT="DOMAIN\APV.Admins" /MANAGEMENT_WEBSITE_NAME="Microsoft App-V Management Service" /MANAGEMENT_WEBSITE_PORT="12345" /EXISTING_MANAGEMENT_DB_REMOTE_SQL_SERVER_NAME="WSSQL" /EXISTING_MANAGEMENT_DB_CUSTOM_SQLINSTANCE="PRDINST01" /EXISTING_MANAGEMENT_DB_NAME="APPV5DB"
        >>startup.cmd ECHO ECHO Installing Publishing Server...
        >>startup.cmd ECHO APPV_SERVER_SETUP.EXE /QUIET /AcceptEULA /PUBLISHING_SERVER /PUBLISHING_MGT_SERVER="http://%COMPUTERNAME%.%USERDNSDOMAIN%:12345" /PUBLISHING_WEBSITE_NAME="Microsoft App-V Publishing Service" /PUBLISHING_WEBSITE_PORT="55555"
        >>startup.cmd ECHO cd /d "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"
        >>startup.cmd ECHO START shutdown.exe -r -t 60 -f
        >>startup.cmd ECHO DEL /F /Q startup.cmd

ECHO Rebooting...
shutdown -r -t 60 -f